[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Re: [pygame] [OPENGL]Combining blended and unblended scenes



due to the fact i've been lost in my initialization code, I decided co copy it again from NeHe's 8th tutorial. Now it contains:
    self.win=display.set_mode((width,height),(FULLSCREEN*fscreen)|OPENGL|DOUBLEBUF)
    if height==0:   height=1.0
    glViewport(0, 0, width, height)
    glMatrixMode(GL_PROJECTION)
    glLoadIdentity()
    gluPerspective(45, 1.0*width/height, 0.1, 100.0)
    glMatrixMode(GL_MODELVIEW)
    glLoadIdentity()
    glEnable(GL_TEXTURE_2D)
    glShadeModel(GL_SMOOTH)
    glClearColor(0.0, 0.0, 0.0, 0.0)
    glClearDepth(1.0)
    glEnable(GL_DEPTH_TEST)
    glDepthFunc(GL_LEQUAL)
    glEnable(GL_BLEND)
    glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)
and after that I'm defining GL_LIGHT0 with ambient [ 0.1, 0.1, 0.1, 0.0]
The effect is the same as I described before.
I add two pictures of what it does:

http://amigopolis.net/myfiles/blend01.png << with glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA). There should be visible spheres in those colored cubes. But they are opaque though I set their alphas to 0.5
http://amigopolis.net/myfiles/blend02.png << with glBlendFunc(GL_ONE, GL_SRC_ALPHA). I know it's maybe nonsense, but everything in this scene is blended though I set it's alpha to 1.0.