On Sat, Jul 7, 2012 at 10:54 AM, Massimo Tarantini <[email protected]> wrote:
> Hello,
>
> i have compiled OSG and VPB for Android, and i'm using Necessitas on an 
> Archos 80G9. All the stuff works (well, the touch events are lost...) but i 
> can't see the texture.
>
> I have tryied some combinations for the options --image-ext and 
> [--compressed, --RGBA-compressed, --RGB-16, --RGB-24], but unsuccesfully.
>
> I suppose that OpenGL compression can't work on Android. But if i use for 
> example --image-ext jpeg  --RGB-16, why it does not work?
>
> In the debug output i read:
> [...]
> 07-07 16:39:42.039: D/Qt(1611): uncompressed ive stream
> [...]
> 07-07 16:39:42.343: D/Qt(1611): TreatBoundariesToValidDataAsDefaultValue=0
> 07-07 16:39:42.343: D/Qt(1611):  4
> 07-07 16:39:42.343: D/Qt(1611): Created new 0xde6e60 TextureObject, 
> _numOfTextureObjects 5
> 07-07 16:39:42.343: D/Qt(1611):  4
> 07-07 16:39:42.343: D/Qt(1611): Created new 0xde6e60 TextureObject, 
> _numOfTextureObjects 6
> 07-07 16:39:42.343: D/Qt(1611):  4
> 07-07 16:39:42.343: D/Qt(1611): Created new 0xde6e60 TextureObject, 
> _numOfTextureObjects 7
> 07-07 16:39:42.343: D/Qt(1611):  4
> 07-07 16:39:42.351: D/Qt(1611): Warning: detected OpenGL error 'invalid 
> enumerant' at after RenderBin::draw(..)

I ran into something like this with GL ES 2. You didn't specify what
version you compiled against, so this may or may not help you.

Note the error generated. I found a couple of fixes by searching
through the list and after some trial and error this is what worked on
my platform:

In the State header file (/include/osg/State i think) there's a
function called State::applyModeOnTexUnit() that calls
glEnable(GL_TEXTURE_2D). This isn't valid for GLES 2 so comment it
out... I did something like:

              #ifndef OSG_GLES2_AVAILABLE
                    // with opengl es 2, GL_TEXTURE_2D is always enabled
                    // so trying to enable it explicitly causes errors
                    if (enabled) glEnable(mode);
                    else glDisable(mode);
              #endif

Also in State.cpp (/src/osg/State.cpp) there's a function called
initializeExtensionProcs(). Line 900 [i pulled osg from git] has an
if() clause that checks for the max number of texture units available.
I replaced it with:

    if ( osg::getGLVersionNumber() >= 2.0 ||
osg::isGLExtensionSupported(_contextID,"GL_ARB_vertex_shader") ||
OSG_GLES2_FEATURES)
    {
        glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,&_glMaxTextureUnits);

         #ifdef OSG_GLES2_AVAILABLE
            _glMaxTextureCoords = 1;
         #else
            glGetIntegerv(GL_MAX_TEXTURE_COORDS,&_glMaxTextureCoords);
         #endif
    }

After those changes, textures started working for me.

However, I noticed you're using Qt/Necessitas... not sure exactly what
you're using Qt for, but just as a heads up, I ran into more problems
using textures with QML that as of now I've been unable to solve (ie
it makes QML unusable with OSG).

> 07-07 16:39:42.351: D/Qt(1611):  2
> 07-07 16:39:42.351: D/Qt(1611): end cull_draw() 0xdbf838
> 07-07 16:39:42.351: D/Qt(1611):  5
>
>
> Some advice?
>
> Thank you!
>
> Cheers,
> Massimo
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=48741#48741
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to