|
@@ -57,8 +57,7 @@ laColumn *DEBUG_C;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#ifdef __linux__
|
|
#ifdef __linux__
|
|
-typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
|
|
|
|
-typedef Bool (*glXMakeContextCurrentARBProc)(Display*, GLXDrawable, GLXDrawable, GLXContext);
|
|
|
|
|
|
+typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*);\
|
|
typedef void (*glXSwapIntervalEXTProc)(Display *dpy, GLXDrawable drawable, int interval);
|
|
typedef void (*glXSwapIntervalEXTProc)(Display *dpy, GLXDrawable drawable, int interval);
|
|
glXCreateContextAttribsARBProc glXCreateContextAttribsF;
|
|
glXCreateContextAttribsARBProc glXCreateContextAttribsF;
|
|
glXSwapIntervalEXTProc glXSwapIntervalEXTF;
|
|
glXSwapIntervalEXTProc glXSwapIntervalEXTF;
|
|
@@ -191,7 +190,7 @@ SYSWINDOW la_CreateWindowX11(int x, int y, int w, int h, char *title, int SyncTo
|
|
|
|
|
|
XStoreName(MAIN.dpy, win, title);
|
|
XStoreName(MAIN.dpy, win, title);
|
|
//XMapWindow(MAIN.dpy, win);
|
|
//XMapWindow(MAIN.dpy, win);
|
|
- glXMakeCurrent(MAIN.dpy, win, MAIN.glc);
|
|
|
|
|
|
+ tnsContextMakeCurrent((*r_glc),win);
|
|
|
|
|
|
int sync=SyncToVBlank?1:0; glXSwapIntervalEXTF(MAIN.dpy, win, sync);
|
|
int sync=SyncToVBlank?1:0; glXSwapIntervalEXTF(MAIN.dpy, win, sync);
|
|
|
|
|
|
@@ -222,8 +221,8 @@ SYSWINDOW la_CreateWindowX11(int x, int y, int w, int h, char *title, int SyncTo
|
|
return win;
|
|
return win;
|
|
};
|
|
};
|
|
void la_DestroySystemWindowX11(laWindow* w) {
|
|
void la_DestroySystemWindowX11(laWindow* w) {
|
|
- glXMakeCurrent(MAIN.dpy, None, NULL);
|
|
|
|
- glXDestroyContext(MAIN.dpy, w->glc);
|
|
|
|
|
|
+ tnsContextMakeCurrent(0,0);
|
|
|
|
+ tnsDeleteContext(w->glc);
|
|
XDestroyWindow(MAIN.dpy, w->win);
|
|
XDestroyWindow(MAIN.dpy, w->win);
|
|
};
|
|
};
|
|
#endif //linux
|
|
#endif //linux
|
|
@@ -350,13 +349,11 @@ void la_SetupGLEnviornment(laWindow* window, HWND hwnd, int Sync) {
|
|
hdc = GetDC(hwnd);
|
|
hdc = GetDC(hwnd);
|
|
la_SetupPxlFormat(hdc, &a, &b);
|
|
la_SetupPxlFormat(hdc, &a, &b);
|
|
|
|
|
|
- wglMakeCurrent(0, 0);
|
|
|
|
hglrc = wglCreateContextAttribsARB(hdc, MAIN.glc, Attrib);
|
|
hglrc = wglCreateContextAttribsARB(hdc, MAIN.glc, Attrib);
|
|
|
|
|
|
if (!hglrc) SEND_PANIC_ERROR("Can't Create Opengl Context!\n", );
|
|
if (!hglrc) SEND_PANIC_ERROR("Can't Create Opengl Context!\n", );
|
|
|
|
|
|
- //wglShareLists(hglrc, MAIN.glc);
|
|
|
|
- wglMakeCurrent(hdc, hglrc);
|
|
|
|
|
|
+ tnsContextMakeCurrent(hglrc, hdc);
|
|
|
|
|
|
//int sync = Sync ? 1 : 0; wglSwapIntervalEXT(sync);
|
|
//int sync = Sync ? 1 : 0; wglSwapIntervalEXT(sync);
|
|
wglSwapIntervalEXT(-1);
|
|
wglSwapIntervalEXT(-1);
|
|
@@ -373,7 +370,8 @@ SYSWINDOW la_CreateWindowWin32(int x, int y, int w, int h, char* title, int Sync
|
|
return hwnd;
|
|
return hwnd;
|
|
};
|
|
};
|
|
void la_DestroySystemWindowWin32(laWindow* w) {
|
|
void la_DestroySystemWindowWin32(laWindow* w) {
|
|
- wglDeleteContext(w->glc);
|
|
|
|
|
|
+ tnsContextMakeCurrent(0,0);
|
|
|
|
+ tnsDeleteContext(w->glc);
|
|
ReleaseDC(w->win, w->hdc);
|
|
ReleaseDC(w->win, w->hdc);
|
|
DestroyWindow(w->win);
|
|
DestroyWindow(w->win);
|
|
};
|
|
};
|
|
@@ -421,6 +419,17 @@ void glDebugOutput(GLenum source, GLenum type, unsigned int id,
|
|
}printf("%s\n\n", strsource);
|
|
}printf("%s\n\n", strsource);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void la_SetCurrentGLContextDebug(){
|
|
|
|
+ glEnable(GL_DEBUG_OUTPUT);
|
|
|
|
+ glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
|
|
|
+ glDebugMessageCallback(glDebugOutput, 0);
|
|
|
|
+ glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_HIGH|GL_DEBUG_SEVERITY_MEDIUM, 0, 0, GL_TRUE);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void la_SetupWindowGLStates(laWindow* w){
|
|
|
|
+ tnsBindVertexArray(w->vao); tnsUnbindTexture(); tnsUseImmShader(); tnsEnableShaderv(T->immShader);
|
|
|
|
+}
|
|
|
|
+
|
|
int la_CreateSystemWindow(laWindow *window, int SyncToVBlank){
|
|
int la_CreateSystemWindow(laWindow *window, int SyncToVBlank){
|
|
SYSGLCONTEXT glc;
|
|
SYSGLCONTEXT glc;
|
|
#ifdef __linux__
|
|
#ifdef __linux__
|
|
@@ -430,6 +439,7 @@ int la_CreateSystemWindow(laWindow *window, int SyncToVBlank){
|
|
SYSWINDOW hwnd = la_CreateWindowWin32(window->X, window->Y, window->W, window->H, window->Title->Ptr, SyncToVBlank, &glc);
|
|
SYSWINDOW hwnd = la_CreateWindowWin32(window->X, window->Y, window->W, window->H, window->Title->Ptr, SyncToVBlank, &glc);
|
|
#endif
|
|
#endif
|
|
window->win = hwnd;
|
|
window->win = hwnd;
|
|
|
|
+ window->glc = glc;
|
|
|
|
|
|
#ifdef _WIN32
|
|
#ifdef _WIN32
|
|
la_SetupGLEnviornment(window, hwnd, SyncToVBlank);
|
|
la_SetupGLEnviornment(window, hwnd, SyncToVBlank);
|
|
@@ -443,14 +453,10 @@ int la_CreateSystemWindow(laWindow *window, int SyncToVBlank){
|
|
XGetWindowAttributes(MAIN.dpy, window->win, &attr);
|
|
XGetWindowAttributes(MAIN.dpy, window->win, &attr);
|
|
window->CW =attr.width;
|
|
window->CW =attr.width;
|
|
window->CH = attr.height;
|
|
window->CH = attr.height;
|
|
- window->glc = glc;
|
|
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
- glEnable(GL_DEBUG_OUTPUT);
|
|
|
|
- glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
|
|
|
- glDebugMessageCallback(glDebugOutput, 0);
|
|
|
|
- glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, 0, GL_TRUE);
|
|
|
|
-
|
|
|
|
|
|
+ la_SetCurrentGLContextDebug();
|
|
|
|
+ glGenVertexArrays(1,&window->vao); tnsBindVertexArray(window->vao);
|
|
|
|
+ la_SetupWindowGLStates(window);
|
|
return 1;
|
|
return 1;
|
|
};
|
|
};
|
|
|
|
|
|
@@ -464,10 +470,12 @@ int la_DestroySystemWindow(laWindow* wnd){
|
|
}
|
|
}
|
|
|
|
|
|
void la_DestroyWindow(laWindow *wnd){
|
|
void la_DestroyWindow(laWindow *wnd){
|
|
- laLayout *l; laPanel *p;
|
|
|
|
-
|
|
|
|
- if (!wnd) return;
|
|
|
|
|
|
+ laLayout *l; laPanel *p; if (!wnd) return;
|
|
|
|
|
|
|
|
+ tnsSwitchToCurrentWindowContext(wnd);
|
|
|
|
+
|
|
|
|
+ tnsBindVertexArray(0); glDeleteVertexArrays(1,&wnd->vao);
|
|
|
|
+
|
|
la_StopAllOperators();
|
|
la_StopAllOperators();
|
|
strSafeDestroy(&wnd->Title);
|
|
strSafeDestroy(&wnd->Title);
|
|
|
|
|
|
@@ -733,6 +741,8 @@ int laGetReadyWith(laInitArguments* ia){
|
|
if(MAIN.InitArgs.GLMinor<1){ MAIN.InitArgs.GLMinor=3; }
|
|
if(MAIN.InitArgs.GLMinor<1){ MAIN.InitArgs.GLMinor=3; }
|
|
if(MAIN.BufferSamples==1){ MAIN.BufferSamples=0; }
|
|
if(MAIN.BufferSamples==1){ MAIN.BufferSamples=0; }
|
|
|
|
|
|
|
|
+ tnsInit();
|
|
|
|
+
|
|
#ifdef __linux__
|
|
#ifdef __linux__
|
|
SYSWINDOW root, win;
|
|
SYSWINDOW root, win;
|
|
GLint att[] = {GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER, None};
|
|
GLint att[] = {GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER, None};
|
|
@@ -809,7 +819,7 @@ int laGetReadyWith(laInitArguments* ia){
|
|
}
|
|
}
|
|
glXSwapIntervalEXTF = (glXSwapIntervalEXTProc) glXGetProcAddressARB( (const GLubyte *) "glXSwapIntervalEXT" );
|
|
glXSwapIntervalEXTF = (glXSwapIntervalEXTProc) glXGetProcAddressARB( (const GLubyte *) "glXSwapIntervalEXT" );
|
|
|
|
|
|
- glXMakeCurrent(MAIN.dpy, win, MAIN.glc);
|
|
|
|
|
|
+ tnsContextMakeCurrent(MAIN.glc,win);
|
|
|
|
|
|
int major,minor; glGetIntegerv(GL_MAJOR_VERSION, &major); glGetIntegerv(GL_MINOR_VERSION, &minor);
|
|
int major,minor; glGetIntegerv(GL_MAJOR_VERSION, &major); glGetIntegerv(GL_MINOR_VERSION, &minor);
|
|
logPrint(" OpenGL Version: %d.%d\n",major,minor);
|
|
logPrint(" OpenGL Version: %d.%d\n",major,minor);
|
|
@@ -820,6 +830,10 @@ int laGetReadyWith(laInitArguments* ia){
|
|
printf("%d\n",err); printf("%s\n",glewGetErrorString(err));
|
|
printf("%d\n",err); printf("%s\n",glewGetErrorString(err));
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ glGenVertexArrays(1,&MAIN.TempVAO); tnsBindVertexArray(MAIN.TempVAO);
|
|
|
|
+
|
|
|
|
+ la_SetCurrentGLContextDebug();
|
|
|
|
+
|
|
MAIN.MsgDelWindow = XInternAtom(MAIN.dpy, "WM_DELETE_WINDOW", 0);
|
|
MAIN.MsgDelWindow = XInternAtom(MAIN.dpy, "WM_DELETE_WINDOW", 0);
|
|
MAIN.bufid = XInternAtom(MAIN.dpy, "CLIPBOARD", False),
|
|
MAIN.bufid = XInternAtom(MAIN.dpy, "CLIPBOARD", False),
|
|
MAIN.fmtid = XInternAtom(MAIN.dpy, "UTF8_STRING", False),
|
|
MAIN.fmtid = XInternAtom(MAIN.dpy, "UTF8_STRING", False),
|
|
@@ -875,7 +889,7 @@ int laGetReadyWith(laInitArguments* ia){
|
|
|
|
|
|
SetPixelFormat(hdc, 1, &cpfd);
|
|
SetPixelFormat(hdc, 1, &cpfd);
|
|
hglrc = wglCreateContext(hdc);
|
|
hglrc = wglCreateContext(hdc);
|
|
- wglMakeCurrent(hdc, hglrc);
|
|
|
|
|
|
+ tnsContextMakeCurrent(hglrc, hdc);
|
|
|
|
|
|
//MAIN.hdc = hdc;
|
|
//MAIN.hdc = hdc;
|
|
// MAIN.tWND = hwnd;
|
|
// MAIN.tWND = hwnd;
|
|
@@ -1044,6 +1058,18 @@ void laShutoff(int SavePrefereces){
|
|
|
|
|
|
logClear();
|
|
logClear();
|
|
|
|
|
|
|
|
+ tnsBindVertexArray(0); glDeleteVertexArrays(1,&MAIN.TempVAO);
|
|
|
|
+
|
|
|
|
+#ifdef __linux__
|
|
|
|
+ tnsContextMakeCurrent(0,0);
|
|
|
|
+ tnsDeleteContext(MAIN.glc);
|
|
|
|
+#endif
|
|
|
|
+#ifdef _WIN32
|
|
|
|
+ tnsContextMakeCurrent(0,0);
|
|
|
|
+ tnsDeleteContext(MAIN.glc);
|
|
|
|
+ UnloadWintab();
|
|
|
|
+#endif
|
|
|
|
+
|
|
tnsQuit();
|
|
tnsQuit();
|
|
|
|
|
|
laPropContainer* pc; while(pc=lstPopItem(&MAIN.PropContainers)){ la_FreePropertyContainer(pc); }
|
|
laPropContainer* pc; while(pc=lstPopItem(&MAIN.PropContainers)){ la_FreePropertyContainer(pc); }
|
|
@@ -1053,14 +1079,6 @@ void laShutoff(int SavePrefereces){
|
|
|
|
|
|
hshFree(&MAIN.DBInstMemLeft);
|
|
hshFree(&MAIN.DBInstMemLeft);
|
|
memNoLonger();
|
|
memNoLonger();
|
|
-
|
|
|
|
-#ifdef __linux__
|
|
|
|
- glXDestroyContext(MAIN.dpy,MAIN.glc);
|
|
|
|
-#endif
|
|
|
|
-#ifdef _WIN32
|
|
|
|
- wglDeleteContext(MAIN.glc);
|
|
|
|
- UnloadWintab();
|
|
|
|
-#endif
|
|
|
|
}
|
|
}
|
|
|
|
|
|
void laSaveUserPreferences(){
|
|
void laSaveUserPreferences(){
|
|
@@ -1703,11 +1721,7 @@ void laEnsurePanelInBound(laPanel *p, laUiList *uil){
|
|
p->TX = p->X; p->TY = p->Y;
|
|
p->TX = p->X; p->TY = p->Y;
|
|
p->TW = p->W; p->TH = p->H;
|
|
p->TW = p->W; p->TH = p->H;
|
|
|
|
|
|
- if (p->OffScr &&
|
|
|
|
- (p->W != p->OffScr->pColor[0]->Width ||
|
|
|
|
- p->H != p->OffScr->pColor[0]->Height)){
|
|
|
|
- tnsConfigureOffscreen(p->OffScr, p->W,p->H);
|
|
|
|
- }
|
|
|
|
|
|
+ if (p->OffScr){ tnsEnsureOffscreenStatus(p->OffScr, p->W,p->H); }
|
|
}
|
|
}
|
|
void la_SetPanelMatrix(laPanel *p, laBoxedTheme *bt){
|
|
void la_SetPanelMatrix(laPanel *p, laBoxedTheme *bt){
|
|
tnsDrawToOffscreen(p->OffScr, 1, 0);
|
|
tnsDrawToOffscreen(p->OffScr, 1, 0);
|
|
@@ -2349,7 +2363,7 @@ void la_WindowDefDraw(laWindow *w, laBoxedTheme *bt){
|
|
int laStartWindow(laWindow *w){
|
|
int laStartWindow(laWindow *w){
|
|
#ifdef __linux__
|
|
#ifdef __linux__
|
|
XMapWindow(MAIN.dpy,w->win);
|
|
XMapWindow(MAIN.dpy,w->win);
|
|
- glXMakeContextCurrent(MAIN.dpy, w->win,w->win, w->glc);
|
|
|
|
|
|
+ tnsContextMakeCurrent(w->glc,w->win);
|
|
#endif
|
|
#endif
|
|
#ifdef _WIN32
|
|
#ifdef _WIN32
|
|
ShowWindow(w->win, SW_SHOWNORMAL);
|
|
ShowWindow(w->win, SW_SHOWNORMAL);
|
|
@@ -7283,7 +7297,7 @@ void laMainLoop(){
|
|
if(MAIN.PreDraw){ MAIN.PreDraw(); }
|
|
if(MAIN.PreDraw){ MAIN.PreDraw(); }
|
|
|
|
|
|
for(w=MAIN.Windows.pFirst;w;w=w->Item.pNext){
|
|
for(w=MAIN.Windows.pFirst;w;w=w->Item.pNext){
|
|
- tnsSwitchToCurrentWindowContext(w);
|
|
|
|
|
|
+ tnsSwitchToCurrentWindowContext(w); la_SetupWindowGLStates(w);
|
|
la_DrawWindow(w);
|
|
la_DrawWindow(w);
|
|
}
|
|
}
|
|
for(w=MAIN.Windows.pFirst;w;w=w->Item.pNext){
|
|
for(w=MAIN.Windows.pFirst;w;w=w->Item.pNext){
|