*/}}
Browse Source

Windows texture binding fix.

YimingWu 1 year ago
parent
commit
ef0ab2e7f0
2 changed files with 6 additions and 4 deletions
  1. 4 4
      la_kernel.c
  2. 2 0
      la_tns_kernel.c

+ 4 - 4
la_kernel.c

@@ -402,7 +402,7 @@ void APIENTRY glDebugOutput(GLenum source, GLenum type, unsigned int id,
     strsource = "";
     switch (type) {
     case GL_DEBUG_TYPE_ERROR:               strsource = "Type: Error"; break;
-    case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: strsource = "Type: Deprecated Behaviour"; break;
+    case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: return; strsource = "Type: Deprecated Behaviour"; break;
     case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:  strsource = "Type: Undefined Behaviour"; break;
     case GL_DEBUG_TYPE_PORTABILITY:         strsource = "Type: Portability"; break;
     case GL_DEBUG_TYPE_PERFORMANCE:         strsource = "Type: Performance"; break;
@@ -438,7 +438,7 @@ int la_CreateSystemWindow(laWindow *window, int SyncToVBlank){
     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);
+    glDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_ERROR, GL_DONT_CARE, 0, 0, GL_TRUE);
 
     RECT rc; GetClientRect(window->win, &rc);
     window->CW = rc.right - rc.left;
@@ -1864,7 +1864,7 @@ void la_PanelDrawDescendBorder(laPanel *Panel, laBoxedTheme *bt, int Width, real
     tnsVertex2d(Panel->X-1, Panel->Y + Panel->H+1);
     tnsVertex2d(Panel->X+1 + Panel->W, Panel->Y + Panel->H+1);
     tnsVertex2d(Panel->X+1 + Panel->W, Panel->Y-1);
-    tnsPackAs(GL_LINE_LOOP);
+    tnsLineWidth(2.0); tnsPackAs(GL_LINE_LOOP); tnsLineWidth(1.0);
 }
 
 int la_AnimateUiListRecursive(laUiList *uil);
@@ -1960,7 +1960,7 @@ void la_PanelDefDraw(laWindow *w, laPanel *p, laBoxedTheme *bt){
             if (!p->IsMenuPanel){
                 la_PanelDrawDescendBorder(p, bt, MAIN.SolidShadowLength, MAIN.FloatingAlpha);
             }
-            glLineWidth(2.0); tnsFlush(); glLineWidth(1.0);
+            tnsFlush();
         }
 
         la_PanelDrawToWindow(p, w);

+ 2 - 0
la_tns_kernel.c

@@ -130,6 +130,7 @@ void tnsSwitchToCurrentWindowContext(void *wnd){
 #endif
 #ifdef _WIN32
     wglMakeCurrent(win->hdc, win->glc);
+    tnsUnbindTexture(); tnsUseNoTexture(); // reset states needed for fonts to work correctly??
 #endif
 };
 void tnsViewportWithScissor(int x, int y, int w, int h){
@@ -2809,6 +2810,7 @@ tnsFontSingleCharacter *tfntFetchCharTextureIDW(uint32_t ch, int UseMono){
         }
     }
 
+    if(ch<128) printf("%c\n", ch);
     glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
     glTexSubImage2D(GL_TEXTURE_2D, 0, fsc->bufferx, fsc->buffery, w, h, GL_RED, GL_UNSIGNED_BYTE, buf);