Archived

This topic is now archived and is closed to further replies.

NasMan

Texture Coordinates

Recommended Posts

NasMan    122
Hello, I''m fairly new to OGL. I''ve got some code that builds a space station. The station is constructed of many smaller parts, which the data is stored in arrays. The display lists are built from these arrays. My problem is that one part of the station (spheres) is built by a loop in which many polygons (GL_POLYGON) are constructed. I''m trying to add textures to this station...but I don''t really fully understand textures and the texture coordinate system. Typical data for building these spheres are...{1.64837f, 141.01301f, -295.02335f}, {1.65344f, -140.96367f, -294.77301f} etc... The spheres are built by a loop with three glVertex3fv calls with the data from the above array. Could someone please explain how to map the textures to a triangle and how to arrive at the texture coordinates? Thanks in advance

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
I don''t exactly know how it works, but why not to try Vertex Arrays? Then you will have to pipoint vertex coordinates, and your texture. After that OpenGL will do all the drawing for you!

glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(...);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(...);
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer (...);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
...

Is everything you need!

Good luck!


Share this post


Link to post
Share on other sites