Hi Hartwig,

I've just done a review of your changes and have decided to tidy up
the existing conversions for GLES and add yours as below:

svn diff
Index: Texture.cpp
===================================================================
--- Texture.cpp (revision 13060)
+++ Texture.cpp (working copy)
@@ -1432,13 +1432,23 @@
         }
     }

+#if defined (OSG_GLES1_AVAILABLE) || defined (OSG_GLES2_AVAILABLE)
+    // GLES doesn't cope with internal formats of 1,2,3 and 4 and
glTexImage doesn't
+    // handle the _OES pixel formats so map them to the appropriate
equivilants.
+    switch(internalFormat)
+    {
+        case(1) : internalFormat = GL_LUMINANCE; break;
+        case(2) : internalFormat = GL_LUMINANCE_ALPHA; break;
+        case(3) : internalFormat = GL_RGB; break;
+        case(4) : internalFormat = GL_RGBA; break;
+        case(GL_RGB8_OES) : internalFormat = GL_RGB; break;
+        case(GL_RGBA8_OES) : internalFormat = GL_RGBA; break;
+        default: break;
+    }
+#endif
+
     _internalFormat = internalFormat;

-    // GLES doesn't cope with internal formats of 1,2,3 and 4 so map
them to the appropriate equivilants.
-    if (_internalFormat==1) _internalFormat = GL_LUMINANCE;
-    if (_internalFormat==2) _internalFormat = GL_LUMINANCE_ALPHA;
-    if (_internalFormat==3) _internalFormat = GL_RGB;
-    if (_internalFormat==4) _internalFormat = GL_RGBA;

     computeInternalFormatType();


I haven't merged your change for mipmapping issue as I feel checking
the existence of the extension everytime you need to make the decision
is inefficient, it would be much better to use cache the required
result in the Texture::Extensions object - there is already a variable
in Texture::Extensions for it and is set thus:

    bool builtInSupport = OSG_GLES2_FEATURES || OSG_GL3_FEATURES;

    ....

    _isGenerateMipMapSupported = builtInSupport ||
isGLExtensionOrVersionSupported(contextID,"GL_SGIS_generate_mipmap",
1.4f);


Is it that this is not quite appropriate?

Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to