You may need to update your libraries or try another compiler, the program
runs fine on my Ubuntu64 Linux.


[image: Inline image 3]


On Tue, Apr 2, 2013 at 3:28 AM, Ivan Nedrehagen <ivann...@gmail.com> wrote:

> This was originally a FTGL question on stack overflow
>
>
> http://stackoverflow.com/questions/15568520/fl-gl-window-flashes-on-creation
>
> I have some simple fltk code:
>
> #include <FL/Fl.H>
> #include <FL/Fl_Gl_Window.H>
> #include <FL/gl.h>
>
> class MyWin : public Fl_Gl_Window {
>   public:
>   MyWin(int x,int y, int w,int h, const char*l = 0) :
>     Fl_Gl_Window(x,y,w,h,l)
>   {
>   }
>   void draw();
>   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();
>   }
> };
>
> void MyWin::draw() {
>   ortho();
>   glBegin(GL_QUADS);
>     glColor3d(1,0,0);
>     glVertex3f(10,10,0);
>     glColor3d(0,1,0);
>     glVertex3f(w()-10,10,0);
>     glColor3d(0,0,1);
>     glVertex3f(w()-10,h()-10,0);
>     glColor3d(1,1,0);
>     glVertex3f(10,h()-10,0);
>   glEnd();
> }
>
> int main(int argc,char* argv[]) {
>   Fl_Window win(500,500, "OpenGL");
>   MyWin window(10,10,win.w()-20,win.h()-20);
>   win.end();
>   win.resizable(window);
>   win.show(argc,argv);
>   return Fl::run();
> }
>
> This example compiles and links perfectly for me on Windows 7 using mingw,
> but when I run it, it gets quite ugly. First the screen turns dark, and
> flashes with white. Then the screen is redrawn and my window appears. The
> same happens when I shut down the application.
>
> I have tried to remove the drawing code, the same happens, then I removed
> the gl window from the outer window and it still happens. So it is not
> affected by the actual drawing. So my suspicion is that the opengl context
> creation causes this. Removing the creation of the gl window supports this
> hypothesis as the window now appears "quietly".
>
> Does anyone know how I can get the Fl_Gl_Window to play nicely in windows?
> _______________________________________________
> fltk-opengl mailing list
> fltk-opengl@easysw.com
> http://lists.easysw.com/mailman/listinfo/fltk-opengl
>



-- 
---
Cheers,

Gnusci

<<image.png>>

_______________________________________________
fltk-opengl mailing list
fltk-opengl@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-opengl

Reply via email to