summaryrefslogtreecommitdiff
path: root/src/Fl_Gl_Window.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2001-11-27 17:44:08 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2001-11-27 17:44:08 +0000
commit2b85bf81680e2243ef5a5daf85d9eb04321c7278 (patch)
treedc7d3e1cdbd44ed10b358412098b73d24b64d143 /src/Fl_Gl_Window.cxx
parent4dc5732a3e0f376786d1d6b788e5cf601439e890 (diff)
Preliminary commit of my MacOS X work.
**** THIS CODE COMPILES BUT DOES NOT WORK. **** TODO: fix event handling - getting blank windows, etc. TODO: re-port OpenGL code. TODO: add support for images with alpha. TODO: add support for more then just beeps in fl_beep(). TODO: other stuff I'm sure... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1765 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Gl_Window.cxx')
-rw-r--r--src/Fl_Gl_Window.cxx33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx
index 690e78783..9e185ccf3 100644
--- a/src/Fl_Gl_Window.cxx
+++ b/src/Fl_Gl_Window.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Gl_Window.cxx,v 1.12.2.22 2001/07/18 08:11:02 spitzak Exp $"
+// "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.1 2001/11/27 17:44:06 easysw Exp $"
//
// OpenGL window code for the Fast Light Tool Kit (FLTK).
//
@@ -68,7 +68,7 @@ void Fl_Gl_Window::show() {
g = Fl_Gl_Choice::find(mode_,alist);
if (!g) {Fl::error("Insufficient GL support"); return;}
}
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
Fl_X::make_xid(this, g->vis, g->colormap);
if (overlay && overlay != this) ((Fl_Gl_Window*)overlay)->show();
#endif
@@ -85,7 +85,7 @@ void Fl_Gl_Window::invalidate() {
int Fl_Gl_Window::mode(int m, const int *a) {
if (m == mode_ && a == alist) return 0;
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
int oldmode = mode_;
Fl_Gl_Choice* oldg = g;
#endif
@@ -93,7 +93,7 @@ int Fl_Gl_Window::mode(int m, const int *a) {
mode_ = m; alist = a;
if (shown()) {
g = Fl_Gl_Choice::find(m, a);
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
// under X, if the visual changes we must make a new X window (yuck!):
if (!g || g->vis->visualid!=oldg->vis->visualid || (oldmode^m)&FL_DOUBLE) {
hide();
@@ -142,12 +142,14 @@ void Fl_Gl_Window::ortho() {
void Fl_Gl_Window::swap_buffers() {
#ifdef WIN32
-#if HAVE_GL_OVERLAY
+# if HAVE_GL_OVERLAY
// Do not swap the overlay, to match GLX:
wglSwapLayerBuffers(Fl_X::i(this)->private_dc, WGL_SWAP_MAIN_PLANE);
-#else
+# else
SwapBuffers(Fl_X::i(this)->private_dc);
-#endif
+# endif
+#elif defined(__APPLE__)
+ aglSwapBuffers((AGLContext)context_);
#else
glXSwapBuffers(fl_display, fl_xid(this));
#endif
@@ -191,6 +193,12 @@ void Fl_Gl_Window::flush() {
}
#endif
+#ifdef __APPLE__
+ //: clear previous clipping in this shared port
+ CGrafPort *port = (CGrafPort*)fl_xid(this);
+ SetRectRgn( port->clipRgn, 0, 0, 0x7fff, 0x7fff );
+#endif
+
make_current();
if (mode_ & FL_DOUBLE) {
@@ -279,7 +287,14 @@ void Fl_Gl_Window::flush() {
void Fl_Gl_Window::resize(int X,int Y,int W,int H) {
if (W != w() || H != h()) {
valid(0);
-#ifndef WIN32
+#ifdef __APPLE__
+ if ( parent() ) { //: resize our GL buffer rectangle
+ CGrafPort *port = (CGrafPort*)fl_xid(this);
+ GLint rect[] = { X, port->portRect.bottom-h()-y(), W, H };
+ aglSetInteger( (GLXContext)context_, AGL_BUFFER_RECT, rect );
+ aglEnable( (GLXContext)context_, AGL_BUFFER_RECT );
+ }
+#elif !defined(WIN32)
if (!resizable() && overlay && overlay != this)
((Fl_Gl_Window*)overlay)->resize(0,0,W,H);
#endif
@@ -325,5 +340,5 @@ void Fl_Gl_Window::draw_overlay() {}
#endif
//
-// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.22 2001/07/18 08:11:02 spitzak Exp $".
+// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.1 2001/11/27 17:44:06 easysw Exp $".
//