PDA

View Full Version : Question about display lists



Alessandro_dup1
07-30-2006, 05:32 AM
I have a display list which is built at startup and contains a simple mesh. Can i alter the mesh color to make the object lighter or darker, without having to rebuild the display list at runtime ?
I tried with a glColor4f() but doesn't work. I guess it is possible only with shaders ?

RigidBody
07-30-2006, 05:36 AM
if the list contains only geometry data (glVertex), you can change the color with glColor before you call glCallList. do you want the mesh to be drawn with only one color?

Alessandro_dup1
07-30-2006, 05:48 AM
The list contains geometry, has a white color for all the objects,and bind textures for each object.
Take for example a house: i have a texture for the roof and one for the sides. Both roof and sides have a material color = white.

What i'd like to do is, at run-time, alter the white color so that the house can become greenish, or lighter and so on ...

Alessandro_dup1
07-30-2006, 05:50 AM
Well, i tried to remove all the glColor calls in the display generation list routine (as you suggested) and it works now, thanks !

remdul
08-01-2006, 07:57 AM
You can put your 'material' calls (glColor*, glBindTexture etc.) in a seperate display list, and call that from within your mesh display list.

That way you can rebuild the material display list when needed (or every frame), and all meshes that call that list pick it up the changes automaticly.