Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r303 - trunk/Engine/Display


Chronological Thread 
  • From: sparker@sci.utah.edu
  • To: rtrt@sci.utah.edu
  • Subject: [MANTA] r303 - trunk/Engine/Display
  • Date: Thu, 12 May 2005 22:59:10 -0600 (MDT)

Author: sparker
Date: Thu May 12 22:59:09 2005
New Revision: 303

Modified:
   trunk/Engine/Display/OpenGLDisplay.cc
Log:
James and I fixed the window resizing problem by polling X for events 
once per frame


Modified: trunk/Engine/Display/OpenGLDisplay.cc
==============================================================================
--- trunk/Engine/Display/OpenGLDisplay.cc       (original)
+++ trunk/Engine/Display/OpenGLDisplay.cc       Thu May 12 22:59:09 2005
@@ -1,4 +1,6 @@
 
+#include <Core/Thread/Thread.h>
+
 #include <Engine/Display/OpenGLDisplay.h>
 #include <Engine/Display/XHelper.h>
 #include <Core/Exceptions/IllegalArgument.h>
@@ -72,7 +74,6 @@
   bool stereo;
   int xres, yres;
   context.getResolution(stereo, xres, yres);
-  cerr << "OpenGLDisplay::setupDisplayChannel: res("<<xres<<", 
"<<yres<<")\n";
   if(!windowOpen){
     createWindow(xres, yres, context.masterWindow);
     old_xres = xres;
@@ -136,7 +137,6 @@
   if(!parent){
     if(masterWindow){
       parent = masterWindow->window;
-      cerr << "Using masterWindow: " << parent << "\n";
     }
     else
       parent = RootWindow(dpy, screen);
@@ -163,6 +163,10 @@
     if(e.type == MapNotify)
       break;
   }
+
+  // Turn off events from this window
+  atts.event_mask = 0;
+  XChangeWindowAttributes(dpy, win, CWEventMask, &atts);
   windowOpen = true;
 
   cx = glXCreateContext(dpy, vi, NULL, True);
@@ -204,7 +208,7 @@
 
   // Compute the framerate
   double currentTime = SCIRun::Time::currentSeconds();
-  
+
   if(!madeCurrent){
     if(!glXMakeCurrent(dpy, win, cx))
       throw InternalError("glXMakeCurrent failed!\n");
@@ -213,7 +217,6 @@
   bool stereo;
   int xres, yres;
   image->getResolution(stereo, xres, yres);
-  //  cerr << "OpenGLDisplay::displayImage:: res("<<xres<<", "<<yres<<")\n";
   glViewport(0, 0, xres, yres);
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
@@ -286,6 +289,15 @@
   last_frame_time = currentTime;
   
   glXSwapBuffers(dpy, win);
+  GLenum errcode = glGetError();
+  if(errcode != GL_NO_ERROR)
+    cerr << "OpenGLDisplay: Error code from OpenGL: " << 
gluErrorString(errcode) << '\n';
+
+  // Suck up X events to keep opengl happy
+  while (XPending(dpy)) {
+    XEvent e;
+    XNextEvent(dpy, &e);
+  }
 }
 
 void OpenGLDisplay::display_frame_rate(double framerate) {




  • [MANTA] r303 - trunk/Engine/Display, sparker, 05/12/2005

Archive powered by MHonArc 2.6.16.

Top of page