PDA

View Full Version : glBlendFunc - 'Blue Screen of Death'



AndrewJJ
06-04-2002, 09:58 AM
Hi,

Just looking for advice ... on some graphics cards, the code below seems to cause a complete system crash :-(

The loaded textures do not contain an alpha channel (24bit). I wanted to blend two textures and found that this code achieved what I wanted ... in this case it renders a light spotlight texture on a floor plane and then I blend a floor texture ...

Is this code likely to be the culprite or should I be looking elsewhere ?

Thanks

Andrew

glNewList(fGenList, GL_COMPILE);
glColor3ub(180, 180, 180);
glBindTexture(GL_TEXTURE_2D, TexNames[cSpotLight]);
glBegin(GL_QUADS);
glNormal3f(0.0, 1.0, 0.0);
glTexCoord2f(0.0, 0.0); glVertex3f(-100.0, -17.0, -100.0);
glTexCoord2f(0.0, 1.0); glVertex3f(-100.0, -17.0, 100.0);
glTexCoord2f(1.0, 1.0); glVertex3f( 100.0, -17.0, 100.0);
glTexCoord2f(1.0, 0.0); glVertex3f( 100.0, -17.0, -100.0);
glEnd;

glEnable(GL_BLEND);
glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR);
glDepthFunc(GL_EQUAL);

glBindTexture(GL_TEXTURE_2D, TexNames[cCarpet]);
glBegin(GL_QUADS);
glNormal3f( 0.0, 1.0, 0.0);
glTexCoord2f( 0.0, 0.0); glVertex3f(-100.0, -17.0, -100.0);
glTexCoord2f( 0.0, 20.0); glVertex3f(-100.0, -17.0, 100.0);
glTexCoord2f(20.0, 20.0); glVertex3f( 100.0, -17.0, 100.0);
glTexCoord2f(20.0, 0.0); glVertex3f( 100.0, -17.0, -100.0);
glEnd;

glDepthFunc(GL_LESS);
glDisable(GL_BLEND);

glEndList;

chowe6685
06-04-2002, 10:03 AM
I believe some video cards don't support destination colors, this might be why

Coconut
06-04-2002, 10:21 AM
What graphics card and driver you are having?
You can always blame the driver for this happening.

zeckensack
06-04-2002, 10:56 AM
Originally posted by AndrewJJ:
glEnd;
...
glEnd;
...
glEndList;These lines do nothing. You must use the brackets for function calls, otherwise the compiler evaluates this to, well, nothing.

glEnd(); is correct, as is glEndList();


[This message has been edited by zeckensack (edited 06-04-2002).]

AndrewJJ
06-04-2002, 11:40 AM
I've no idea as yet as to which particular cards are causing this problem ... I don't really want to be forced to use RGBA textures but maybe I'll have too ... unless there's another way of emulating a projected spotlight ...

(I'm one of those Delphi programmers ... we don't need the empty closing brackets !)

Thanks for the feedback

Andrew