fix gles defs
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 13 Nov 2009 11:30:28 +0000 (11:30 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 13 Nov 2009 11:30:28 +0000 (11:30 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@43660 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/engines/gl_common/evas_gl_context.c
src/modules/engines/gl_common/evas_gl_texture.c

index 65bf696..ae470c8 100644 (file)
@@ -304,24 +304,21 @@ evas_gl_common_context_target_surface_set(Evas_GL_Context *gc,
    evas_gl_common_context_flush(gc);
 
    gc->shader.surface = surface;
-#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
-   // FIXME: XXX render-to-texture for gles2
-#else   
-   // FIXME: viewport goopies
    gc->change.size = 1;
 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
-   if (gc->shader.surface == gc->def_surface)
-     glBindFramebuffer(GL_FRAMEBUFFER_OES, 0);
-   else
-     glBindFramebuffer(GL_FRAMEBUFFER_OES, surface->tex->pt->fb);
+# ifndef GL_FRAMEBUFFER
+#  define GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
+# endif   
 #else
+# ifndef GL_FRAMEBUFFER
+#  define GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT
+# endif   
+#endif   
    if (gc->shader.surface == gc->def_surface)
-     glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
+     glBindFramebuffer(GL_FRAMEBUFFER, 0);
    else
-     glBindFramebuffer(GL_FRAMEBUFFER_EXT, surface->tex->pt->fb);
-#endif   
+     glBindFramebuffer(GL_FRAMEBUFFER, surface->tex->pt->fb);
    _evas_gl_common_viewport_set(gc);
-#endif   
 }
 
 #define PUSH_VERTEX(x, y, z) \
index e74ce00..ccd538b 100644 (file)
@@ -269,19 +269,20 @@ _pool_tex_render_new(Evas_GL_Context *gc, int w, int h, int intformat, int forma
    pt->dataformat = GL_UNSIGNED_BYTE;
    pt->references = 0;
 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
-   glGenTextures(1, &(pt->texture));
-   glBindTexture(GL_TEXTURE_2D, pt->texture);
-   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-   _tex_2d(pt->intformat, w, h, pt->format, pt->dataformat);
-   glGenFramebuffers(1, &(pt->fb));
-   glBindFramebuffer(GL_FRAMEBUFFER_OES, pt->fb);
-   glFramebufferTexture2DEXT(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_TEXTURE_2D, pt->texture, 0);
-   glBindFramebufferEXT(GL_FRAMEBUFFER_OES, 0);
-   glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex);
+# ifndef GL_FRAMEBUFFER
+#  define GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
+# endif
+# ifndef GL_COLOR_ATTACHMENT0
+#  define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES
+# endif
 #else
+# ifndef GL_FRAMEBUFFER
+#  define GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT
+# endif
+# ifndef GL_COLOR_ATTACHMENT0
+#  define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_EXT
+# endif
+#endif  
    glGenTextures(1, &(pt->texture));
    glBindTexture(GL_TEXTURE_2D, pt->texture);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -290,11 +291,10 @@ _pool_tex_render_new(Evas_GL_Context *gc, int w, int h, int intformat, int forma
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    _tex_2d(pt->intformat, w, h, pt->format, pt->dataformat);
    glGenFramebuffers(1, &(pt->fb));
-   glBindFramebuffer(GL_FRAMEBUFFER_EXT, pt->fb);
-   glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, pt->texture, 0);
-   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+   glBindFramebuffer(GL_FRAMEBUFFER, pt->fb);
+   glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, pt->texture, 0);
+   glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
    glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex);
-#endif   
    return pt;
 }