Blend Order
BlitzMax Forums/OpenGL Module/Blend Order
| ||
My texture triangle blend order seems to only be correct when I'm below the ground plane -Above the ground plane ![]() -Below the ground plane ![]() glMatrixMode(GL_MODELVIEW) Local modelView:Float[16] glPushMatrix glTranslatef Particle.x,Particle.y,Particle.z glGetFloatv(GL_MODELVIEW_MATRIX,modelView) For Local i:Int = 0 To 2 For Local j:Int = 0 To 2 If i = j modelview[i*4+j] = 1.0 Else modelview[i*4+j] = 0.0 EndIf Next Next glLoadMatrixf(modelView) glColor4f 0.2,0.2,0.2,Particle.Alpha glRotatef Particle.Rotation, 0.0,0.0,1.0 glBegin(GL_TRIANGLE_STRIP) ' Build Quad From A Triangle Strip glTexCoord2f(1,1); glVertex3f(Particle.size,Particle.size,0) ' Top Right glTexCoord2f(0,1); glVertex3f(-Particle.size,Particle.size,0) ' Top Left glTexCoord2f(1,0); glVertex3f(Particle.size,-Particle.size,0) ' Bottom Right glTexCoord2f(0,0); glVertex3f(-Particle.size,-Particle.size,0) ' Bottom Left glEnd() glPopMatrix If I translate after I set the current matrix the blending appears correct but the position isn't. Any help is really appreciated -Thanks |
| ||
It seems to work when the view angle is "up" but not "down" |
| ||
Ok found the solution had to call glDisable(GL_DEPTH_TEST) "The Z buffer doesn't work as you might hope for transparent polygons. The problem is that the Z buffer prevents OpenGL from drawing pixels that are behind things that have already been drawn. Generally, that's pretty convenient, but when the thing in front is translucent, you need to see the things that are behind it." |
| ||
Maybe I was wrong again... Apparently you have to "Depth Sort" My rendering order was causing the issue. |
| ||
Remember to disable gl_Alpha_test if you want to use alpha values less than 0.5ish. Cheers Charlie |