DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L1945
Version: 1.1.9


There seems to be a problem enabling the Stencil Buffer in nvidia cards.

I used http://seriss.com/people/erco/fltk/#OpenGlSimple and added 
if (Fl_Gl_Window::can_do(FL_STENCIL))
                        mode(FL_STENCIL);
(See attached file)

This results in 
XRequest.144: GLXBadDrawable 0x3400007

Confirmed in different machines running Nvidia cards, I don't have
different cards to test.
I have one report of this code working in RedHat9, but the machine was
updated to FedoraCore4 and the error appears.

Using the Stencil buffer in a real life example results in a black window.

Please test.

Thanks!


Link: http://www.fltk.org/str.php?L1945
Version: 1.1.9
#include <FL/Fl.H>
#include <FL/Fl_Gl_Window.H>
#include <FL/gl.h>

//
// Simple resizable 2D GL window
// erco 10/08/05
//

class MyGlWindow : public Fl_Gl_Window {
    // DRAW METHOD
    //      OpenGL window: (w,h) is upper right, (-w,-h) is lower left, (0,0) 
is center
    //
    void draw() {
        // First time? init viewport, etc.
        if (!valid()) {
                if (Fl_Gl_Window::can_do(FL_STENCIL))
                        mode(FL_STENCIL);
            valid(1);
            glLoadIdentity();
            glViewport(0,0,w(),h());
            glOrtho(-w(),w(),-h(),h(),-1,1);
        }
        // Clear screen
        glClear(GL_COLOR_BUFFER_BIT);
        // Draw white 'X'
        glColor3f(1.0, 1.0, 1.0);
        glBegin(GL_LINE_STRIP); glVertex2f(w(), h()); glVertex2f(-w(),-h()); 
glEnd();
        glBegin(GL_LINE_STRIP); glVertex2f(w(),-h()); glVertex2f(-w(), h()); 
glEnd();
    }
    // HANDLE WINDOW RESIZING
    //    If window reshaped, need to readjust viewport/ortho
    //
    void resize(int X,int Y,int W,int H) {
        Fl_Gl_Window::resize(X,Y,W,H);
        glLoadIdentity();
        glViewport(0,0,W,H);
        glOrtho(-W,W,-H,H,-1,1);
        redraw();
    }
public:
    // CONSTRUCTOR
    MyGlWindow(int X,int Y,int W,int H,const char*L=0) : 
Fl_Gl_Window(X,Y,W,H,L) {
    }
};
// MAIN
int main() {
     Fl_Window win(500, 300);
     MyGlWindow mygl(10, 10, win.w()-20, win.h()-20);
     win.end();
     win.resizable(mygl);
     win.show();
     return(Fl::run());
}
    
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to