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

[STR New]

Link: http://www.fltk.org/str.php?L2081
Version: 1.3-feature


I request opengl3 in fltk2/fltk.
The patch adds basic opengl3 context creation to fltk2 linux, and it works
for me.
My suggestion is to add 2 new modes (no driver support for these yet) for
the mode() function
OPENGL3_FORWARD_COMPATIBLE
OPENGL3_DEBUG
  
And by default enable opengl 3 if it's available.


Link: http://www.fltk.org/str.php?L2081
Version: 1.3-feature
diff -u ../origfltk/fltk/OpenGL/Fl_Gl_Choice.cxx OpenGL/Fl_Gl_Choice.cxx
--- ../origfltk/fltk/OpenGL/Fl_Gl_Choice.cxx    2008-10-31 19:39:57.844679794 
-0400
+++ OpenGL/Fl_Gl_Choice.cxx     2008-10-30 22:22:33.516924443 -0400
@@ -226,7 +226,40 @@
 #endif
 
 GLContext fltk::create_gl_context(XVisualInfo* vis) {
-  GLContext context = glXCreateContext(xdisplay, vis, first_context, 1);
+  
+  typedef  GLXFBConfig (*PFNGLXGETFBCONFIGFROMVISUALSGIXPROC)( Display *dpy,
+                                                                  XVisualInfo 
*vis );
+  typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARB)(
+               Display *dpy,
+               GLXFBConfig config,
+               GLXContext share_context,
+               Bool direct,
+               const int *attrib_list);
+  
+  PFNGLXGETFBCONFIGFROMVISUALSGIXPROC glXGetFBConfigFromVisualSGIX =  
(PFNGLXGETFBCONFIGFROMVISUALSGIXPROC)
+               glXGetProcAddress((const GLubyte *) 
"glXGetFBConfigFromVisualSGIX");
+
+  PFNGLXCREATECONTEXTATTRIBSARB glXCreateContextAttribsARB = 
+               (PFNGLXCREATECONTEXTATTRIBSARB)  glXGetProcAddress((const 
GLubyte *) "glXCreateContextAttribsARB");
+
+  GLContext context;
+  if (glXGetFBConfigFromVisualSGIX == 0 || glXCreateContextAttribsARB == 0)
+  {
+    context = glXCreateContext(xdisplay, vis, first_context, 1);
+  }
+  else
+  {
+         GLXFBConfig c = glXGetFBConfigFromVisualSGIX(xdisplay, vis);
+
+#define GLX_CONTEXT_MAJOR_VERSION_ARB          0x2091
+#define GLX_CONTEXT_MINOR_VERSION_ARB          0x2092
+
+       int arr2[] = {  GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
+                       GLX_CONTEXT_MINOR_VERSION_ARB, 0, None }; 
+
+         context = glXCreateContextAttribsARB(xdisplay, c, first_context, 
True, arr2);
+  }
+
 #if DESTROY_ON_EXIT
   Contexts* p = new Contexts;
   p->context = context;
Only in OpenGL/: .Fl_Gl_Choice.cxx.swp
Only in OpenGL/: makedepend
Common subdirectories: ../origfltk/fltk/OpenGL/.svn and OpenGL/.svn
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to