PDA

View Full Version : GenList and GenTextures



Agostino
02-27-2008, 01:50 AM
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

EvilOne
02-27-2008, 05:52 AM
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);

Agostino
02-27-2008, 07:39 AM
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)

Komat
02-27-2008, 08:02 AM
The glGenTextures command is not recorded into the display list, it is executed immediatelly.

-NiCo-
02-27-2008, 08:02 AM
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.

Agostino
02-27-2008, 08:08 AM
Excuse me but does it fall? Or is it immediately executed?

-NiCo-
02-27-2008, 08:15 AM
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.