0

I have geometry stored in a display list, but I'd like to be able to draw the same display list with different "tints" on them. For example, if I had a black and white skull in a display list, I'd like to set a red tint and draw a skull, then set a blue tint and draw the skull.

If I can get the RGBA values I know exactly how to transform them, but I'm not sure where I can intercept them. Currently the display lists do not contain textures, but they probably will in the future so it would be good if the answer works with or without textures.

1 Answer 1

0

Conceptually a display list is just a bunch of commands that are excuted when you glCallList. So whatever it contains it will just be as if you used those commands directly (but maybe more performant). So if your display list contains a bunch of geometry commands, how can you color them? Yes, you guessed it, using the usual glColor command right before calling the list:

glColor(...);
glCallList(...);

When you want your objects to have a texture and still be colorable you can just use set texture environment to GL_MODULATE (I guess you're not using shaders, otherwise the whole question would be quite obsolete, anyway). If you want your objects lit, well change glColor to glMaterial, of course.

But if you set the color inside the display list you don't have any chance to get it and change it. But I wouldn't advice you to use display lists, anyway. If you use them to store geometry and for reducing CPU-GPU copies and drawcall overhead, then why not use VBOs, which are exactly made for this (and don't suffer from such an indeterminate implementation).

1
  • There are already colors in the display lists, so I started playing with a fragment shader and I think that it will solve the problem. The first time I've used shaders was last night, so I'm not 100% sure what I can do with them. I might switch to VBOs, because I didn't realise that display lists were deprecated. Mar 14, 2012 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.