Texture Coordinates
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
June 07, 2002 06:09 AM
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!
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!

This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement