Ported osgUtil, osgDB, osgGA, NodeKits and plugins to compile against OpenGL ES 1.1 and OpenGL ES 2.0.

This commit is contained in:
Robert Osfield
2009-10-28 20:31:57 +00:00
parent 7e7135be59
commit d17d7159a1
37 changed files with 318 additions and 146 deletions

View File

@@ -947,11 +947,11 @@ void ShadowVolumeGeometry::drawImplementation(osg::RenderInfo& renderInfo) const
}
else
{
glNormal3f(0.0f, 0.0f, 0.0f);
state->Normal(0.0f, 0.0f, 0.0f);
}
glColor4f(0.5f, 1.0f, 1.0f, 1.0f);
state->Color(0.5f, 1.0f, 1.0f, 1.0f);
glDrawArrays( GL_QUADS, 0, _vertices.size() );
}

View File

@@ -313,9 +313,11 @@ void ShadowMap::init()
fakeTex->setImage(image);
// add fake texture
_stateset->setTextureAttribute(_baseTextureUnit,fakeTex,osg::StateAttribute::ON);
_stateset->setTextureMode(_baseTextureUnit,GL_TEXTURE_1D,osg::StateAttribute::OFF);
_stateset->setTextureMode(_baseTextureUnit,GL_TEXTURE_2D,osg::StateAttribute::ON);
_stateset->setTextureMode(_baseTextureUnit,GL_TEXTURE_3D,osg::StateAttribute::OFF);
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
_stateset->setTextureMode(_baseTextureUnit,GL_TEXTURE_1D,osg::StateAttribute::OFF);
#endif
}
}

View File

@@ -312,7 +312,14 @@ void SoftShadowMap::initJittering(osg::StateSet *ss)
// the GPU Gem implementation uses a NV specific internal texture format (GL_SIGNED_RGBA_NV)
// In order to make it more generic, we use GL_RGBA4 which should be cross platform.
image3D->setImage(size, size, R, GL_RGBA4, GL_RGBA, GL_UNSIGNED_BYTE, data3D, osg::Image::USE_NEW_DELETE);
#ifdef GL_RGBA4
GLenum internalTextureFormat = GL_RGBA4;
#else
// OpenGLES 1.1 doesn't define GL_RGBA4, so we'll just assume RGBA
GLenum internalTextureFormat = GL_RGBA;
#endif
image3D->setImage(size, size, R, internalTextureFormat, GL_RGBA, GL_UNSIGNED_BYTE, data3D, osg::Image::USE_NEW_DELETE);
texture3D->setImage(image3D);
ss->setTextureAttributeAndModes(_jitterTextureUnit, texture3D, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);

View File

@@ -478,9 +478,11 @@ void StandardShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv
fakeTex->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);
_stateset->setTextureAttribute(st->_baseTextureUnit,fakeTex,osg::StateAttribute::ON);
_stateset->setTextureMode(st->_baseTextureUnit,GL_TEXTURE_1D,osg::StateAttribute::OFF);
_stateset->setTextureMode(st->_baseTextureUnit,GL_TEXTURE_2D,osg::StateAttribute::ON);
_stateset->setTextureMode(st->_baseTextureUnit,GL_TEXTURE_3D,osg::StateAttribute::OFF);
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
_stateset->setTextureMode(st->_baseTextureUnit,GL_TEXTURE_1D,osg::StateAttribute::OFF);
#endif
}
{ // Add shadow texture
@@ -582,7 +584,9 @@ void StandardShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv
for( unsigned stage = 1; stage < 4; stage ++ )
{
stateset->setTextureMode( stage, GL_TEXTURE_1D, osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF );
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
stateset->setTextureMode( stage, GL_TEXTURE_1D, osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF );
#endif
stateset->setTextureMode( stage, GL_TEXTURE_2D, osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF );
stateset->setTextureMode( stage, GL_TEXTURE_3D, osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF );
}