Archived

This topic is now archived and is closed to further replies.

wazoo69

Question about blending...

Recommended Posts

wazoo69    157
Hey guys, I''m trying to get a scene working where I have a background rendered with textured quads, then in the foreground I have transparent cubes.... I can''t get the cubes to display no matter what I try! argh! My procedure for drawing the cubes: glDepthMask(GL_FALSE); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_SRC_ALPHA); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glTranslatef(0.0f, 0.0f, -20.0f); glScalef(1.5f, 1.0f, 0.9f); glBegin(GL_QUADS); //cube vertices here glEnd(); glPopMatrix(); glDisable(GL_BLEND); glDepthMask(GL_TRUE); can ANYBODY see anything wrong with this?? Do I need to disable lighting as well?? I can''t seem to see what''s wrong with this code (I''ve checked nehe''s tutorials, and what I''m doing appears right!)... thanks in advance!! Wazoo

Share this post


Link to post
Share on other sites
davepermen    1047
perhaps glDepthMask dont work korrekt on your gf (NeHe told this)
try it with glDisable(GL_DEPTH_TEST); and glEnable(GL_DEPTH_TEST);

we wanna play, not watch the pictures

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
It would be a good idea to specify the alpha of the polygons, unless u use the RGBA format for the textures. If u use the RGB format then u should set the alpha value of the texture by using the glColor4f(r, g, b, a) command with a varying from 0.0 to 1.0.
also u should use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) for a better approach. Dont'' forget to disable lighting.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
It would be a good idea to specify the alpha of the polygons, unless u use the RGBA format for the textures. If u use the RGB format then u should set the alpha value of the texture by using the glColor4f(r, g, b, a) command with a varying from 0.0 to 1.0.
also u should use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) for a better approach. Dont'' forget to disable lighting.

u can contact me at boct@romwest.ro

Share this post


Link to post
Share on other sites
wazoo69    157
Yup I forgot to mention that I specified a color of
glColor4f(1.0f, 0.5f, 0.5f, 0.9f);

I disabled lighting and disabled GL_DEPTH_TEST...no difference (at least none that I could detect)..

I tried the GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA for my blend function and nope..

I''ll play around some more but if anybody could help more..

THANKS!!
(and thanks to those who have helped so far already)

wazoo

Share this post


Link to post
Share on other sites