OpenGL Polygon Stipple Not Working On Different Machine
Posted
by FranticPedantic
on Stack Overflow
See other posts from Stack Overflow
or by FranticPedantic
Published on 2010-05-18T22:36:40Z
Indexed on
2010/05/18
22:40 UTC
Read the original article
Hit count: 355
I have a situation where I am trying to draw a semi-transparent rectangle over a background that is not using openGL and so I can not use blending. I decided to use polygon stippling for a 'screen door transparency' effect as recommended by some. It works fine on my machine and some others, but on some machines with slightly old Intel graphics cards it's failing to render the rectangle at all. If I turn off polygon stipple, it renders fine (but without the stipple). I have compared many of the state variables that I thought might affect it (see code) between machines and they are all the same, and I get no errors.
static const GLubyte stipplePatternChkr[128]; //definition omitted for clarity
//but works on my machine
// stipple the box
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glColor4ubv(Color(COLORREF_PADGRAY));
glEnable(GL_POLYGON_STIPPLE);
glPolygonStipple(stipplePatternChkr);
CRect rcStipple(dim);
rcStipple.DeflateRect(padding - 1, padding - 1);
glBegin(GL_QUADS);
glVertex2i(rcStipple.left, rcStipple.bottom);
glVertex2i(rcStipple.right, rcStipple.bottom);
glVertex2i(rcStipple.right, rcStipple.top);
glVertex2i(rcStipple.left, rcStipple.top);
glEnd();
glDisable(GL_POLYGON_STIPPLE);
int err = glGetError();
if (err != GL_NO_ERROR) {
TRACE("glError(%s: %s)\n", s, gluErrorString(err));
}
float x;
glGetFloatv(GL_UNPACK_ALIGNMENT, &x);
TRACE("unpack alignment %f\n", x);
glGetFloatv(GL_UNPACK_IMAGE_HEIGHT, &x);
TRACE("unpack height %f\n", x);
glGetFloatv(GL_UNPACK_LSB_FIRST, &x);
TRACE("unpack lsb %f\n", x);
glGetFloatv(GL_UNPACK_ROW_LENGTH, &x);
TRACE("unpack length %f\n", x);
glGetFloatv(GL_UNPACK_SKIP_PIXELS, &x);
TRACE("upnack skip %f\n", x);
glGetFloatv(GL_UNPACK_SWAP_BYTES, &x);
TRACE("upnack swap %f\n", x);
© Stack Overflow or respective owner