[Title] Error check and viewport bug fix
authorSangjin Kim <sangjin3.kim@samsung.com>
Tue, 8 May 2012 05:34:25 +0000 (14:34 +0900)
committerSangjin Kim <sangjin3.kim@samsung.com>
Tue, 8 May 2012 05:34:25 +0000 (14:34 +0900)
[Type] bug fix
[Module] opengl-es
[Priority]
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

tizen/src/hw/gloffscreen_test.c
tizen/src/hw/gloffscreen_xcomposite.c
tizen/src/hw/opengl_exec.c

index 887c32b921b3cd788cc93eadc40f2573002597a3..a685125d25af5431ba07a6b9b26bf60e252929cb 100755 (executable)
@@ -111,7 +111,11 @@ int gl_acceleration_capability_check (void) {
     glo_init();
     // new surface
     context = glo_context_create(bufferFlags, 0);
+       if (context == NULL)
+               return 1;
     surface = glo_surface_create(TX, TY, context);
+       if (surface == NULL)
+               return 1;
     glo_surface_makecurrent(surface);
     printf("GL VENDOR %s\n", glGetString(GL_VENDOR));
     printf("GL RENDERER %s\n", glGetString(GL_RENDERER));
index 446afdf911eac717b109db2bd8ee1f51e28b34ea..f111e9873c1fe8989c64eb48c38c8223fd56638f 100755 (executable)
@@ -470,7 +470,11 @@ static int glo_can_readback(void) {
     }
 
     context = glo_context_create(bufferFlags, 0);
+       if (context == NULL)
+               return 1;
     surface = glo_surface_create(TX, TY, context);
+       if (surface == NULL)
+               return 1;
 
     glo_surface_makecurrent(surface);
 
index 0aff747ca55ec4f6a0245b01dedecc9337e1b207..4721199d374d453c68d18db7ff19b67d40a4ec6d 100755 (executable)
@@ -521,6 +521,13 @@ static inline void resize_surface(ProcessState *process, QGloSurface *qsurface,
     // Client doesnt know surface is new - need to MakeCurrent
     if(process->current_state == qsurface->glstate) {
         glo_surface_makecurrent(qsurface->surface);
+        // set the viewport while the window size is changed. It is needed
+        // especially for the case that glViewport is not explicitly called
+        // in program. In this case, the viewport is set to incorrectly
+        // in the first MakeCurrent when the window size is not known.
+        // It will not impact normal GL programs with glViewport set as 
+        // programmers want.
+        glViewport (0, 0, w, h);
     }
     else {
         DEBUGF("Error: Surface is not current! %p %p\n",
@@ -1008,6 +1015,12 @@ static const char *opengl_strtok(const char *s, int *n, char **saveptr, char *pr
                     s++, (*n)--;
                 } while (*n > 2 && (s[1] != '*' || s[2] != '/'));
                 s++, (*n)--;
+                               s++, (*n)--;
+                               if (*n == 0) {
+                                       break;
+                               }
+                       } else {
+                               break;
             }
         }
     }
@@ -1023,6 +1036,11 @@ static const char *opengl_strtok(const char *s, int *n, char **saveptr, char *pr
        ret = malloc(retlen + 1);
        p = ret;
 
+       if (retlen == 0) {
+               *p = 0;
+               return;
+       }
+
        while (retlen > 0) {
         if (*start == '/' && retlen > 1) {
             if (start[1] == '/') {