what is the easiest way to...
what is the easiest way to change the dimension scale of one of the drawing dimensions in opengl?
i take input from files to draw a 3D object, i calculate all the 3D triangles to be drawn and also the normals for lighting. But when i display it, it is squished in one dimension because the input data is such. I need to expand this model in its one squished dimension to give better visualization.
[actually i take a stack of 2D slices (images) as input and render them into 3D object, but the dimension that increases along the number of slices is too thin... i need to space out the slices in 3D basically.]
any ideas?
glScale3f(x,y,z)
BUT try to post some code, if you have that object really flat (width = 0) glScale will do nothing and error will be elsewhere...
BUT try to post some code, if you have that object really flat (width = 0) glScale will do nothing and error will be elsewhere...
When I was younger, I used to solve problems with my AK-47. Times have changed. I must use something much more effective, killing, percise, pernicious, efficient, lethal and operative. C++ is my choice.
here is the code i use to generate the display list for the object... it basically loads values for 3D computed triangles.
no the width is not zero. for example if i have loaded 20 2D slices then the dimension are: x and y are same as the size of the 2D input slice and the z dimension is 20 since there are 20 input slices.. there is a distance of 1 for each slice in the object.. i want to increase this distance ie the depth of the 3D object.
could you please explain how to use this glScale3f(x,y,z) command.
thanks.
no the width is not zero. for example if i have loaded 20 2D slices then the dimension are: x and y are same as the size of the 2D input slice and the z dimension is 20 since there are 20 input slices.. there is a distance of 1 for each slice in the object.. i want to increase this distance ie the depth of the 3D object.
triangleCount = 0; linklist = glGenLists(1); glNewList(linklist, GL_COMPILE); glColor3ub(255, 255, 255); while(head->next!=NULL) { glBegin(GL_TRIANGLES); // Drawing Using Triangles glNormal3f( dummy.getNorm00(), dummy.getNorm01(), dummy.getNorm02()); glVertex3f( dummy.getVal00(), dummy.getVal01(), dummy.getVal02()); // glNormal3f(dummy.getNorm10(),dummy.getNorm11(), dummy.getNorm12()); glVertex3f(dummy.getVal10(),dummy.getVal11(), dummy.getVal12()); // glNormal3f( dummy.getNorm20(),dummy.getNorm21(), dummy.getNorm22()); glVertex3f( dummy.getVal20(),dummy.getVal21(), dummy.getVal22()); glEnd(); // Finished Drawing The Triangle triangleCount++; dummy.eraseOne(); } glEndList();
could you please explain how to use this glScale3f(x,y,z) command.
thanks.
could you not just multiply your dummy.getValx2() by a scale factor, such as 1.5 or 2? This would save changing the matrix everytime with glScale.
i just tried multiplying each dummy.getValx2() and dummy.getNormx2() by a scale factor... it scales alright but the shading gets all screwed.. i think it won''t work that simply for the normals that were calculated without the scaled data.
i am out of ideas.. plz help!
i am out of ideas.. plz help!
Either way you are going to have to recompute the normals if you move the vertices or scale them.
alright thanks... i scaled the z values of the triangles right after computing and before storing. so the normals are computed with the scaled values. and my scaling and lighting are done.
thanks for the tips.
but no ones telling me abt glut menu in my other post... i just need to have a look at an example use of the menu facility in glut.
thanks for the tips.
but no ones telling me abt glut menu in my other post... i just need to have a look at an example use of the menu facility in glut.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement