/[gzz]/gzz/gfx/jni/GzzGL-jni.cxx
ViewVC logotype

Diff of /gzz/gfx/jni/GzzGL-jni.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by tjl, Wed Sep 4 07:37:10 2002 UTC revision 1.12 by tjl, Wed Sep 4 08:02:13 2002 UTC
# Line 64  struct JavaException { }; Line 64  struct JavaException { };
64    
65  JNIEnv *jnienv_eventloop;  JNIEnv *jnienv_eventloop;
66    
67    vector<int> contextStack;
68    
69    Os::Window *getWindowByWID(int wid) {
70        return  (wid<0 ? defaultWindow : windows.get(wid));
71    }
72    
73  void setWindow(int wid = -1) {  void setWindow(int wid = -1) {
74      Os::Window *win = (wid<0 ? defaultWindow :      Os::Window *win = getWindowByWID(wid);
75                  windows.get(wid));      if(!win->setCurrent()) {
       if(!win->setCurrent()) {  
76            cerr << "Couldn't set window to current -> returning\n";            cerr << "Couldn't set window to current -> returning\n";
77            return;            return;
78        }      }
79        DBG(dbg) << "Set current "<<wid<<"\n";      contextStack.push_back(wid);
80        DBG(dbg) << "Set current "<<wid<<"\n";
81    
82  }  }
83  void releaseWindow(int wid = -1) {  void releaseWindow() {
84      Os::Window *win = (wid<0 ? defaultWindow :      if(contextStack.size() == 0) {
85                  windows.get(wid));            cerr << "TRYING TO RELEASE CONTEXT WHEN STACK EMPTY!!! PLEASE REPORT BUG!";
86              return;
87        }
88        int wid = contextStack[contextStack.size()-1];
89        contextStack.pop_back();
90        Os::Window *win = getWindowByWID(wid);
91      if(!win->releaseCurrent()) {      if(!win->releaseCurrent()) {
92            cerr << "Couldn't release window current!!!";            cerr << "Couldn't release window current!!!";
93            exit(17);            exit(17);
94      }      }
95        if(contextStack.size() != 0) {
96            getWindowByWID(contextStack[contextStack.size()-1])->setCurrent();
97        }
98      DBG(dbg) << "Release current "<<wid<<"\n";      DBG(dbg) << "Release current "<<wid<<"\n";
99  }  }
100    
# Line 553  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 567  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
567        glEndList();        glEndList();
568        GLERR        GLERR
569    
570        releaseWindow(wid);        releaseWindow();
571    }    }
572    
573  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GZZGL_compileCallGL  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GZZGL_compileCallGL
# Line 680  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 694  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
694         GLERR         GLERR
695    
696        if(standardcoords) {        if(standardcoords) {
697            releaseWindow(window);            releaseWindow();
698        }        }
699    
700    
# Line 746  JNIEXPORT jfloat JNICALL Java_gzz_gfx_gl Line 760  JNIEXPORT jfloat JNICALL Java_gzz_gfx_gl
760         GLERR         GLERR
761    
762        if(standardcoords) {        if(standardcoords) {
763            releaseWindow(window);            releaseWindow();
764        }        }
765    
766    

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26