Knowledge Base

OpenGL to OpenSceneGraph Lookup

Feel free to add other OpenGL calls

 Lookup table for helping people with converting OpenGL code to OpenSceneGraph code.

OpenGL function OpenSceneGraph implementation
glClear( GLbitfield mask ) osg::Camera::setClearMask(GLbitfield mask)
osg::GraphicsContext::setClearMask(GLbitfield mask)
osg::ClearNode::setClearMask(GLbitfield mask)
osg::RenderStage::setClearMask(GLbitfield mask)
glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) osg::Camera::setClearColor(const osg::Vec4& color)
osgUtil::SceneView::setClearColor(const osg::Vec4& color)
glClearDepth osg::Camera::setClearDepth(double depth)
glClearStencil osg::Camera::setClearStencil(int stencil)
State Attributes
glAlphaFunc( GLenum func, GLclampf ref ) osg::AlphaFunc(ComparisonFunction func, float ref)
glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) osg::BlendColor(const osg::Vec4& constantColor)
glBlendFunc( GLenum sfactor, GLenum dfactor) osg::BlendFunc(GLenum source, GLenum destination, GLenum source_alpha, GLenum destination_alpha)
glBlendEquation(GLenum mode) osg::BlendEquation(Equation equation)
glClampColor(GLenum target, GLenum mode) osg::ClampColor(GLenum vertexMode, GLenum fragmentMode, GLenum readMode);
glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) osg::ColorMask(bool red, bool green, bool blue, bool alpha);
glMatrixMode( GL_COLOR ) osg::ColorMatrix()
glCullFace(GLenum mode) osg::CullFace(Mode mode)
glDepthFunc( GLenum func)
glDepthRange( GLclampd zNear, GLclampd zFar )
glDepthMask( GLboolean flag )
osg::Depth(Function func, double zNear, double zFar, bool writeMask)
glFog*( GLenum pname, GLfloat param )
glFog*v(GLenum pname, const GLfloat *params )
glFogf( GL_FOG_MODE, GLfloat param ) osg::Fog::setMode( Mode mode )
glFogf( GL_FOG_DENSITY, GLfloat param ) osg::Fog::setDensity( float density )
glFogf( GL_FOG_START, GLfloat param ) osg::Fog::setStart( float start )
glFogf( GL_FOG_END, GLfloat param ) osg::Fog::setEnd( float end )
glFogf( GL_FOG_INDEX, GLfloat param ) Color indexing not supported
glFogfv(GL_FOG_COLOR, const GLfloat *params ) osg::Fog::setColor( const Vec4 &color )
glFogi(GL_FOG_COORDINATE_SOURCE, GLenum mode) osg::Fog::setFogCoordinateSource(GLint source)
glFrontFace( GLenum mode ) osg::FrontFace(Mode face)
glHint( GLenum target, GLenum mode ) osg::Hint(GLenum target, GLenum mode)
glLight*(GLenum light, GLenum pname, GLfloat param )
glLight*v( GLenum light, GLenum pname, const GLfloat *params)
osg::Light(unsigned int lightnum)
glLightfv( GLenum light, GL_AMBIENT, const GLfloat *params) osg::Light::setAmbient( const Vec4& ambient )
glLightfv( GLenum light, GL_DIFFUSE, const GLfloat *params) osg::Light::setDiffuse( const Vec4& diffuse )
glLightfv( GLenum light, GL_SPECULAR, const GLfloat *params) osg::Light::setSpecular( const Vec4& specular )
glLightfv( GLenum light, GL_POSITION, const GLfloat *params) osg::Light::setPosition( const Vec4& position )
glLightfv( GLenum light, GL_SPOT_DIRECTION, const GLfloat *params) osg::Light::setDirection( const Vec3& direction )
glLightf(GLenum light, GL_CONSTANT_ATTENUATION, GLfloat param ) osg::Light::setConstantAttenuation( float constant_attenuation )
glLightf(GLenum light, GL_LINEAR_ATTENUATION, GLfloat param ) osg::Light::setLinearAttenuation ( float linear_attenuation )
glLightf(GLenum light, GL_QUADRATIC_ATTENUATION, GLfloat param ) osg::Light::setQuadraticAttenuation ( float quadratic_attenuation )
glLightf(GLenum light, GL_SPOT_EXPONENT, GLfloat param ) osg::Light::setSpotExponent( float spot_exponent )
glLightf(GLenum light, GL_SPOT_CUTOFF, GLfloat param ) osg::Light::setSpotCutoff( float spot_cutoff )
glLightModel*( GLenum pname, GLfloat param )
glLightModel*v( GLenum pname, const GLfloat *params )
glLightModelfv( GL_LIGHT_MODEL_AMBIENT, const GLfloat *params ) osg::LightModel::setAmbientIntensity(const osg::Vec4& ambient)
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GLint param) osg::LightModel::setColorControl(ColorControl cc)
glLightModeli( GL_LIGHT_MODEL_LOCAL_VIEWER, GLint param ) osg::LightModel::setLocalViewer(bool localViewer)
glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GLint param ) osg::LightModel::setTwoSided(bool twoSided)
glLineStipple( GLint factor, GLushort pattern ) osg::LineStipple(GLint factor, GLushort pattern)
glLineWidth( GLfloat width ) osg::LineWidth(float width=1.0f)
glLogicOp( GLenum opcode ) osg::LogicOp(Opcode opcode)
glMaterialf(GLenum face, GLenum pname, GLfloat param ) osg::Material()
  osg::PolygonMode(Face face,Mode mode)
  osg::PolygonOffset(float factor, float units)
  osg::PolygonStipple(const GLubyte* mask)
  osg::Scissor(int x,int y,int width,int height)
  osg::ShadeModel(Mode mode)
glStencilFunc( GLenum func, GLint ref, GLuint mask ) osg::Stencil::setFunction(Function func,int ref,unsigned int mask)
glStencilMask( GLuint mask ) osg::Stencil::setOperation(Operation sfail, Operation zfail, Operation zpass)
glStencilOp( GLenum fail, GLenum zfail, GLenum zpass )
osg::TexEnv(Mode mode)
glTexEnvi( GL_TEXTURE_ENV, ...)
Texture combiners extension
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, ...) osg::TexEnvFilter(float lodBias)
glTexGen_( GLenum coord, GLenum pname, GLdouble param ) osg::TexGen()
glMatrixMode( GL_TEXTURE ) osg::TexMat(const Matrix& matrix)
glTexImage1D( GL_TEXTURE_1D, ...) osg::Texture1D()
glTexImage2D( GL_TEXTURE_2D, ...) osg::Texture2D(Image* image)
glTexImage3D( GL_TEXTURE_2D_ARRAY_EXT, ...) osg::Texture2DArray()
glTexImage3D( GL_TEXTURE_3D, ...) osg::Texture3D()
glTexImage2D( GL_TEXTURE_RECTANGLE, ...) osg::TextureRectangle(Image* image)
glViewport( GLint x, GLint y, GLsizei width, GLsizei height ) osg::Viewport(value_type x,value_type y,value_type width,value_type height)