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 |
|
|
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 |
694 |
GLERR |
GLERR |
695 |
|
|
696 |
if(standardcoords) { |
if(standardcoords) { |
697 |
releaseWindow(window); |
releaseWindow(); |
698 |
} |
} |
699 |
|
|
700 |
|
|
760 |
GLERR |
GLERR |
761 |
|
|
762 |
if(standardcoords) { |
if(standardcoords) { |
763 |
releaseWindow(window); |
releaseWindow(); |
764 |
} |
} |
765 |
|
|
766 |
|
|