summaryrefslogtreecommitdiff
path: root/src/gl_start.cxx
diff options
context:
space:
mode:
authorBill Spitzak <spitzak@gmail.com>2001-03-14 17:20:02 +0000
committerBill Spitzak <spitzak@gmail.com>2001-03-14 17:20:02 +0000
commit97234fb3e28e7c8eaf844ae0fd841122de2c47dc (patch)
treebd60a8df587b31d829e6c253ae79dc093364668e /src/gl_start.cxx
parent8470c05b5802bddbc6f02769e0d013332bbdf9a4 (diff)
Replaced remaining _WIN32 symbols with WIN32
Stuff from work: Removed reference to unused GL/glu.h header file, which is missing on some Linux systems. Fl_Gl_Window has a new method to allow you to get and set the context: void Fl_Gl_Window::context(void*, int destroy = 0) void* Fl_Gl_Window::context() const; Return or set a pointer to the GLContext that this window is using. This is a system-dependent structure, but it is portable to copy the context from one window to another. You can also set it to NULL, which will force FLTK to recreate the context the next time make_current() is called, this is useful for getting around bugs in OpenGL implementations. If destroy_flag is true the context will be destroyed by fltk when the window is destroyed, or when the mode() is changed, or the next time context(x) is called. Some cleanup of Fl_Gl_Choice to move most of the system dependent #ifdefs into Fl_Gl_Choice.cxx. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1413 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/gl_start.cxx')
-rw-r--r--src/gl_start.cxx33
1 files changed, 12 insertions, 21 deletions
diff --git a/src/gl_start.cxx b/src/gl_start.cxx
index 3438fc464..f0274eaf4 100644
--- a/src/gl_start.cxx
+++ b/src/gl_start.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: gl_start.cxx,v 1.6.2.4 2001/01/22 15:13:41 easysw Exp $"
+// "$Id: gl_start.cxx,v 1.6.2.5 2001/03/14 17:20:02 spitzak Exp $"
//
// OpenGL context routines for the Fast Light Tool Kit (FLTK).
//
@@ -20,7 +20,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
-// Please report all bugs and problems to "fltk-bugs@fltk.org".
+// Please report all bugs and problems to "fltk-bugs@easysw.com".
//
// You MUST use gl_visual() to select the default visual before doing
@@ -42,35 +42,27 @@
#include <FL/Fl_Window.H>
#include <FL/x.H>
#include <FL/fl_draw.H>
-
#include "Fl_Gl_Choice.H"
-extern GLXContext fl_first_context; // in Fl_Gl_Choice.C
extern int fl_clip_state_number; // in fl_rect.C
-static GLXContext context;
+static GLContext context;
static int clip_state_number=-1;
static int pw, ph;
#ifdef WIN32
-static int default_mode;
+static Fl_Gl_Choice* gl_choice;
#endif
Region XRectangleRegion(int x, int y, int w, int h); // in fl_rect.C
void gl_start() {
-#ifdef WIN32
- HDC hdc = fl_private_dc(Fl_Window::current(), default_mode,0);
-#endif
if (!context) {
#ifdef WIN32
- context = wglCreateContext(hdc);
- if (!fl_first_context) fl_first_context = context;
- else wglShareLists(fl_first_context, context);
+ if (!gl_choice) Fl::gl_visual(0);
+ context = fl_create_gl_context(Fl_Window::current(), gl_choice);
#else
- context = glXCreateContext(fl_display, fl_visual, fl_first_context, 1);
- if (!context) Fl::fatal("OpenGL does not support this visual");
- if (!fl_first_context) fl_first_context = context;
+ context = fl_create_gl_context(fl_visual);
#endif
}
fl_set_gl_context(Fl_Window::current(), context);
@@ -100,19 +92,18 @@ void gl_start() {
}
void gl_finish() {
-#ifdef WIN32
glFlush();
-#else
+#ifndef WIN32
glXWaitGL();
#endif
}
int Fl::gl_visual(int mode, int *alist) {
-#ifdef WIN32
- default_mode = mode;
-#else
Fl_Gl_Choice *c = Fl_Gl_Choice::find(mode,alist);
if (!c) return 0;
+#ifdef WIN32
+ gl_choice = c;
+#else
fl_visual = c->vis;
fl_colormap = c->colormap;
#endif
@@ -122,5 +113,5 @@ int Fl::gl_visual(int mode, int *alist) {
#endif
//
-// End of "$Id: gl_start.cxx,v 1.6.2.4 2001/01/22 15:13:41 easysw Exp $".
+// End of "$Id: gl_start.cxx,v 1.6.2.5 2001/03/14 17:20:02 spitzak Exp $".
//