I am creating a 2D application using pyOpenGL. Here is the init function:
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
glEnable(GL_TEXTURE_2D)
glEnable(GL_LINE_SMOOTH)
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST)
glClearColor(0.5, 0.5, 0.5, 0.0) # This Will Clear The Background Color To Black
glDepthFunc(GL_LESS) # The Type Of Depth Test To Do
glClearDepth(1.0) # Enables Clearing Of The Depth Buffer
glEnable(GL_DEPTH_TEST) # Enables Depth Testing
glShadeModel(GL_SMOOTH) # Enables Smooth Color Shading
glMatrixMode(GL_PROJECTION)
glLoadIdentity() # Reset The Projection Matrix
gluOrtho2D(0,640,480,0) #This is to make (0,0) at Top-Left
glMatrixMode(GL_MODELVIEW)
Everything I am drawing with 'z' less the 1.0 is visible. If I am drawing something where 'z' is greater then 1.0 it's not visible. Although I am creating a 2D application but still I need to maintain a depth of my sprites. The sprites are basically a rectangle with some points and text written on it. For this purpose I am thinking to draw every sprite and it's related content between a fix depth, say between 1.0-2.0. Next one will be 2.1-3.0.
This way when I drag the sprite they will properly over lap another one. But some how things are not working here. Badly need some tips or suggestions.
Cheers
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ |