Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
3.33/5 (3 votes)
See more:
I am looking to apply Texture to an already compiled OpenGL List.
Is it possible to apply texture to a GL List? Please let me know how to do it.
My OpenGL list contains TRIANGLE STRIPS (defined with gl.Normal3d & gl.Vertex3d)

Typically my code would be generating a GL List as below. To this List I want to apply some texture.

C#
gl.NewList(GLListTag, gl.COMPILE);
 {
   gl.Begin(gl.TRIANGLE_STRIP);
   for (int i = 0; i< PointsCount; i++)
  {
 
   gl.Normal3d(x,y,z)
   gl.Vertex3d(a,b,c)
   }
   gl.End();
}
gl.EndList();


Note: I have already asked the same question in the Graphics discussion forum
Posted
Updated 21-Sep-12 1:34am
v2

You need to set the texture coordinates (using gl.TexCoords if I remember right) at the same time as you set the vertex normal and location.
 
Share this answer
 
Comments
Anand V_ 24-Sep-12 0:08am    
I cannot do that as I have to re-use the compiled list with different Colours & Textures.

I am able to apply Color to a Compiled GL List and render but not able to do the same way for Texture mapping.
BobJanova 24-Sep-12 4:52am    
I don't think that is possible, as the texture coordinates are attached to a vertex just like its spatial coordinates.
C#
gl.NewList(GLListTag, gl.COMPILE);
 {
   gl.Begin(gl.TRIANGLE_STRIP);
   for (int i = 0; i< PointsCount; i++)
  {
   gl.TexCoord2f(u, v); // Texture coordinate of the vertex.
   gl.Normal3d(x,y,z)
   gl.Vertex3d(a,b,c)
   }
   gl.End();
}
gl.EndList();


http://nehe.gamedev.net/tutorial/display_lists/15003/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900