blending question
I have created a texture with an alpha channel. I know this part works because the alpha test clipps the testure. Now I''m stuck on how to get the blending working properly. The problem is that the transparency appears to be backward!?!? The colored part is see through and the black is solid.
Before I go farther I suppose I should explain what my program is doing a bit better.
1) Randomly generate 10k quads.
2) Randomly assign a color to each quad.
2) Load the starburst texture.
(This is a white center that fades to black on the outside)
(The alpha channel is 1 in the center and fades to 0 on the outside)
3) Sort quads by distance.
4) Set transparency with...
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
5) Draw the quads.
The result is supposed to be circles that fade to transparent at the edges but I end up with solid black on the edjes. Any sugestions would be apprediated.
I''ve tryed alot of combinations of the glBlendFunc parameters and still can seam to find the righ ones.
------------------------------Piggies, I need more piggies![pig][pig][pig][pig][pig][pig]------------------------------Do not invoke the wrath of the Irken elite. [flaming]
No source code, so it is difficult to say what is wrong. But
if you got 3D exploration, you can draw quad, then set the
texture and alpha values to the quad, after that generate the
OpenGL source code , take a look at code you might know what
to do.
skyline
if you got 3D exploration, you can draw quad, then set the
texture and alpha values to the quad, after that generate the
OpenGL source code , take a look at code you might know what
to do.
skyline
skyline
i think i''ve a similar problem with tut09.
The black part of the star texture is not blended out. Is it possible that my old gra. card makes the probs?
I have diamonds viper v330 (riva 128). I''m running win2k using nvidias latest nt4 drivers for to get opengl support. (are there still real win2k driver with opengl and d3d support avalible?)
The black part of the star texture is not blended out. Is it possible that my old gra. card makes the probs?
I have diamonds viper v330 (riva 128). I''m running win2k using nvidias latest nt4 drivers for to get opengl support. (are there still real win2k driver with opengl and d3d support avalible?)
Ok, I figured out that the error was in the sort routine! It was not sorting the points on the oposite side of the z axis properly! I got that fixed and it works.
but, here''s the drawing code if anyone is interested...
NOTE: the polys must be drawn farthest first!
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture);
glBegin(GL_QUADS);
glColor4f(red / 255.0f,green / 255.0f,blue / 255.0f,1.0f);
glTexCoord2f(0.0f,0.0f);
glVertex3d(Star.Location.X + 500.0f,Star.Location.Y + 500.0f,Star.Location.Z);<br> glTexCoord2f(1.0f,0.0f);<br> glVertex3d(Star.Location.X - 500.0f,Star.Location.Y + 500.0f,Star.Location.Z);<br> glTexCoord2f(1.0f,1.0f);<br> glVertex3d(Star.Location.X - 500.0f,Star.Location.Y - 500.0f,Star.Location.Z);<br> glTexCoord2f(0.0f,1.0f);<br> glVertex3d(Star.Location.X + 500.0f,Star.Location.Y - 500.0f,Star.Location.Z);<br> glEnd();<br><br> </i>
but, here''s the drawing code if anyone is interested...
NOTE: the polys must be drawn farthest first!
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture);
glBegin(GL_QUADS);
glColor4f(red / 255.0f,green / 255.0f,blue / 255.0f,1.0f);
glTexCoord2f(0.0f,0.0f);
glVertex3d(Star.Location.X + 500.0f,Star.Location.Y + 500.0f,Star.Location.Z);<br> glTexCoord2f(1.0f,0.0f);<br> glVertex3d(Star.Location.X - 500.0f,Star.Location.Y + 500.0f,Star.Location.Z);<br> glTexCoord2f(1.0f,1.0f);<br> glVertex3d(Star.Location.X - 500.0f,Star.Location.Y - 500.0f,Star.Location.Z);<br> glTexCoord2f(0.0f,1.0f);<br> glVertex3d(Star.Location.X + 500.0f,Star.Location.Y - 500.0f,Star.Location.Z);<br> glEnd();<br><br> </i>
------------------------------Piggies, I need more piggies![pig][pig][pig][pig][pig][pig]------------------------------Do not invoke the wrath of the Irken elite. [flaming]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement