OpenGL polygon not working on different machines

I have a situation where I am trying to draw a semi-transparent rectangle over a background that does not use openGL and therefore I cannot use blending. I decided to use a polygon stroke for the transparency effect of the screen door as recommended by some. It works fine on my machine and some others, but on some machines with slightly old Intel graphics cards it doesn't create a rectangle at all. If I turn off the polygon, it will be fine (but without stripping). I have mapped many state variables that I thought could 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);

      

+2


a source to share


2 answers


Try applying a patterned texture to a polygon with filtering turned off.



+1


a source


It's pretty straightforward if you are using frame buffers. Create a frame buffer and paint it. You now have a texture with RGBA information. Get this texture pixel data into an array on the CPU and use the background paint commands to paint the image. This way you can store alpha information for any scene.
The problem is that it might not be as fast as other more expensive solutions.



+1


a source







All Articles