On Thu, Oct 2, 2008 at 11:53 AM, 110110010 <[EMAIL PROTECTED]> wrote:

> glBlendFunc(GL_SRC_ALPHA,GL_SRC_COLOR)
>

That glBlendFunc line is saying that you want to the blending output to be:
(source_color*source_alpha + dest_color*source_color)
that is basically a weird additive-blend/lighting effect (kind of like a
spot-light), which might actually be interesting for some multi-pass
rendering effects, but is defintitely wrong for drawing stuff on top of
other stuff (i.e. painter's algorithm, as opposed to using z-buffering and
drawing)

what people usually use is:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
which does the same blending func pygame does...


...although that is often a poor choice for OpenGL, because it will most
likely cause your images to have soft darkened or soft lightneded edges when
you render something scaled or rotated (i.e. when bilinear filtering kicks
in) and what you probably actually want is:
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)
but then you have to upload pre-multiplied alpha (pygame's image.tostring
can convert for you) to the texture and your colors will be in premultiplied
space (so where you'd pass R, G, B, A in colorf, you pass R*A, G*A, B*A, A
instead)

... so what are you trying to accomplish exactly with PyOpenGL? are you
rendering 3d or 2d?

Reply via email to