PDA

View Full Version : Surface Texure

aus79er
03-28-2002, 12:52 PM
I have written a program in c++ which gives me the value of x,y,z co-ordinates.Using these particular values(x,y,z)I want to display a 3D picture.
How can i display the surface texture using these(x,y,z) values.

Can anybody explain/show me the steps required to display the surface.

Thanks
aus

03-28-2002, 01:23 PM
Originally posted by aus79er:
I have written a program in c++ which gives me the value of x,y,z co-ordinates.Using these particular values(x,y,z)I want to display a 3D picture.
How can i display the surface texture using these(x,y,z) values.

Can anybody explain/show me the steps required to display the surface.

Thanks
aus

Groups these points together in triangles, then render them by using

glBegin(GL_TRIANGLES);
glVertex3f(/*the point coordinates go here*/);
...
glEnd();

aus79er
03-28-2002, 01:42 PM
I have written the following code
glClear(GL_COLOR_BUFFER_BIT);
for (int si = 1; si < 39; si++)
{
glColor3f (0.0f, 1.0f, 0.f);
glVertex3f(xw[si], yw[si], zw[si][si]);
glVertex3f(xw[si+1], yw[si+1], zw[si+1][si+1]);
glVertex3f(xw[si+2], yw[si+2], zw[si+2][si+2]);
glVertex3f(xw[si+3], yw[si+3], zw[si+3][si+3]);

}
glEnd();

where xw[42] having values 1,2,3,4,5..etc
yw[42] has 1,2,3,4 etc
while zw[42][42]has 100,99,99.67,99.75 etc..
But i get a blank screen .
Can any body explain me the problem
thanks,
aus

aus79er
03-28-2002, 02:20 PM
I got something after scaling down the x,y,z values but the display is not what i wanted.
I doesn't look 3D

Can i enhance it ,

How can i use mouse to zoom the image..

aus

03-29-2002, 05:42 AM
Originally posted by aus79er:

I doesn't look 3D

I think you forgot to set the lights. Lights are needed by OpenGL to calculate how darker or brighter will the polygon be because of its position. Also you must calculate the normals to each polygon to get real light shading.