GenList and GenTextures

Hi all

I have problems with these funcs, I create a texture and than I bind the texture in more lists. But the texture are white, it’s good for one list, why?
How do I resolve it? Thanks

Have you enabled texturing?

// Load the texture.
GLuint texture = LoadTexture(…);

// Compile list.
GLuint list = glGenLists(1);
glNewList(list, GL_COMPILE);
glBindTexture(GL_TEXTURE_2D, texture);
glEnable(GL_TEXTURE_2D);
glEndList();

// When rendering…
glCallList(list);
DrawGeometry();

// When shutdown.
glDeleteTextures(1, &texture);
glDeleteLists(list, 1);

Yes the texturing is enabled, but I have this situation :

GLuint list = glGenLists(1);
glNewList(list, GL_COMPILE);
glGenTextures(…);
glEndList()

GLuint list1 = glGenLists(1);
glNewList(list1, GL_COMPILE);
glBindTexture(Prevoius texture);
glEndList()

glCallList(list)
glCallList(list1)

The glGenTextures command is not recorded into the display list, it is executed immediatelly.

You can’t use glGenTextures in a display list.

Certain commands, when called while compiling a display list, are not com-

piled into the display list but are executed immediately. These commands fall in
several categories including
Display lists: GenLists and DeleteLists.
Render modes: FeedbackBuffer, SelectBuffer, and RenderMode.
Vertex arrays: ClientActiveTexture, ColorPointer, EdgeFlagPointer, Fog-
CoordPointer, IndexPointer, InterleavedArrays, NormalPointer, Secondary-
ColorPointer, TexCoordPointer, VertexAttribPointer, and VertexPointer.
Client state: EnableClientState, DisableClientState, EnableVertexAttrib-
Array, DisableVertexAttribArray, PushClientAttrib, and PopClientAttrib.
Pixels and textures: PixelStore, ReadPixels, GenTextures, DeleteTextures,
and AreTexturesResident.
Occlusion queries: GenQueries and DeleteQueries.
Vertex buffer objects: GenBuffers, DeleteBuffers, BindBuffer, BufferData,
BufferSubData, MapBuffer, and UnmapBuffer.
Program and shader objects: CreateProgram, CreateShader, DeletePro-
gram, DeleteShader, AttachShader, DetachShader, BindAttribLocation,
CompileShader, ShaderSource, LinkProgram, and ValidateProgram.
GL command stream management: Finish and Flush.
Other queries: All query commands whose names begin with Get and Is (see
chapter 6).

N.

Excuse me but does it fall? Or is it immediately executed?

It’s executed immediately, so in theory you can do it. It’s just that the glGenTextures command won’t be executed when you call the display list in the future using glCallList…

N.