*/}}
YimingWu 3 kuukautta sitten
vanhempi
commit
0ba0949a4b
2 muutettua tiedostoa jossa 10 lisäystä ja 2 poistoa
  1. 2 1
      la_interface.h
  2. 8 1
      la_kernel.c

+ 2 - 1
la_interface.h

@@ -341,6 +341,7 @@ STRUCTURE(laProgressDisplay){
 
 STRUCTURE(laInitArguments){
     int GLMajor,GLMinor,BufferSamples;
+    int GLESMajor,GLESMinor;
     int UseColorManagement;
     int HasWorldObjects;
     int HasAction;
@@ -413,7 +414,7 @@ STRUCTURE(LA){
 #endif
     laSafeString* CopyPending;
 
-    int GLMajor,GLMinor,BufferSamples;
+    int GLMajor,GLMinor,GLESMajor,GLESMinor,BufferSamples;
     GLuint TempVAO;
     SYSTEMDISPLAY* dpy;
     SYSGLCONTEXT glc;

+ 8 - 1
la_kernel.c

@@ -998,6 +998,8 @@ int laGetReadyWith(laInitArguments* ia){
     memcpy(&MAIN.InitArgs,ia,sizeof(laInitArguments));
     if(MAIN.InitArgs.GLMajor>4||MAIN.InitArgs.GLMajor<1){ MAIN.InitArgs.GLMajor=3; }
     if(MAIN.InitArgs.GLMinor<1){ MAIN.InitArgs.GLMinor=3; }
+    if(MAIN.InitArgs.GLESMajor>3||MAIN.InitArgs.GLESMajor<2){ MAIN.InitArgs.GLESMajor=3; }
+    if(MAIN.InitArgs.GLESMinor<0){ MAIN.InitArgs.GLESMinor=0; }
     if(MAIN.BufferSamples==1){ MAIN.BufferSamples=0; }
 
     tnsInit();
@@ -1025,7 +1027,12 @@ int laGetReadyWith(laInitArguments* ia){
     la_ScanWacomDevices(MAIN.dpy,XIAllDevices);
     
     MAIN.GLMajor=MAIN.InitArgs.GLMajor; MAIN.GLMinor=MAIN.InitArgs.GLMinor; MAIN.BufferSamples=MAIN.InitArgs.BufferSamples;
+    MAIN.GLESMajor=MAIN.InitArgs.GLESMajor; MAIN.GLESMinor=MAIN.InitArgs.GLESMinor;
+#ifdef LA_USE_GLES
+    logPrint("Chosen OpenGL version %d.%d\n",MAIN.GLESMajor,MAIN.GLESMinor);
+#else
     logPrint("Chosen OpenGL version %d.%d\n",MAIN.GLMajor,MAIN.GLMinor);
+#endif
 
 #ifdef LA_USE_GLES
 
@@ -1071,7 +1078,7 @@ int laGetReadyWith(laInitArguments* ia){
 
     eglBindAPI(EGL_OPENGL_ES_API);
     static const EGLint ctx_attribs[] = {
-        EGL_CONTEXT_CLIENT_VERSION, 3,
+        EGL_CONTEXT_CLIENT_VERSION, MAIN.GLESMajor,
         EGL_CONTEXT_MINOR_VERSION, 2,
         EGL_NONE
     };