On 3/27/08, gherron <[EMAIL PROTECTED]> wrote: > > > > On Mar 26, 9:37 am, Thomas Woelz <[EMAIL PROTECTED]> wrote: > > Hi, > > I noticed that when I provide color with alpha to a Label the > > transparency works immediately, while doing the same to vertex lists > > it will only work if somewhere in my code I did put the following: > > > > glEnable(GL_BLEND) > > glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) > > > > Sorry if this is a newbie question, I swear I tried to figure this out > > looking at the code but I couldn't. Is there a way for the > > transparency to apply without setting the whole window thing to blend? > > > The question is not what portion of a window GL_BLEND applies to, but > rather what parts of your scene it applies to. That is controlled by > what parts of your scene are drawn between glEnable(GL_BLEND) and > glDisable(GL_BLEND) AND what is already in the color buffer to be > blended with when you do such blends. > > The proper use of GL_BLEND includes: > Draw the background objects first. > glEnable(GL_BLEND) > glBlendFunc(...) // usually unnecessary unless changed elsewhere > Draw transparent object with its alpha > glDisable(GL_BLEND) // A good idea so other objects are not > affected. > > Apparently the Label code already got all this stuff correct, and you > have just discovered that your code needs to get it right also.
Just to complete this explanation: the Label (actually TextLayout, it's superclass) uses an instance of pyglet.graphics.Group to set up the rendering state, including the blend state. See the graphics chapter of the programming guide for details, you can do the same with your vertex lists. Alex. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---
