Hi J.P.,

Finally I can figure out a way so I don't need the signed int. Anyway, I think 
my really problem is that by some reason, the texture is not uploading 
correctly to the GPU :S

In my OGL code I have:


Code:
        glGenTextures(1, &(this->triTableTex));
        glActiveTexture(GL_TEXTURE2);
        glEnable(GL_TEXTURE_2D);

        glBindTexture(GL_TEXTURE_2D, this->triTableTex);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_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);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);

glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA16I_EXT, 16, 256, 0, 
GL_ALPHA_INTEGER_EXT, GL_INT, &triTable);



and in osg I do:

        
Code:
osg::Texture2D *tex = new osg::Texture2D();

        tex->setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::NEAREST );
        tex->setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::NEAREST );
        tex->setWrap( osg::Texture2D::WRAP_S , osg::Texture2D::CLAMP_TO_EDGE );
        tex->setWrap( osg::Texture2D::WRAP_T , osg::Texture2D::CLAMP_TO_EDGE );
        tex->setWrap( osg::Texture2D::WRAP_R , osg::Texture2D::CLAMP_TO_EDGE );
        //tex->setDataVariance( osg::Object::DYNAMIC );

        unsigned char *cc = new unsigned char[256*16];

        for ( int i = 0 ; i < 256 ; i++)
        for ( int ii = 0 ; ii < 16 ; ii++)
        {
                //cc[ ii + i*16 ] = triTable[i][ii];
                cc[ ii + i*16 ] = 127;
        }


        osg::Image *i = new osg::Image();
        i->setImage( 16 , 256 , 0 , GL_ALPHA16I_EXT , GL_ALPHA_INTEGER_EXT , 
GL_INT , (unsigned char *)&triTable , osg::Image::NO_DELETE );

        tex->setImage( i );
        brickState->setTextureAttributeAndModes(1,tex,osg::StateAttribute::ON);



I'm just setting all the values to 127 so I can check in the GPU if the texture 
is uploaded to the geometry shader. I need this values to work in the GPU, as 
I'm using it for an Marching Cubes Algorithm based.

Do you think I need to do something else? Thanks!

Cheers,
Pau[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=15980#15980





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to