osg(osg中文社区)-osgEarth-osgViewer-基于OpenGL-开源三维渲染引擎-图形引擎-虚拟仿真工具-osg教程-osg仿真

OpenGL 到 OpenSceneGraph 对照

当前位置:首页 > 学习支持 > 基础知识

将OpenGL中的功能与OSG对应功能进行列举:

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 )

osg::Fog();

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 )

osg::LightModel()

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::Multisample()


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::StencilTwoSided()

glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, ...)
glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, ...)

osg::TexEnv(Mode mode)

glTexEnvi( GL_TEXTURE_ENV, ...)
Texture combiners extension

osg::TexEnvCombine()

glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, ...)

osg::TexEnvFilter(float lodBias)

glTexGen_( GLenum coord, GLenum pname, GLdouble param )

osg::TexGen()
osg::TexGenNode()

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_CUBE_MAP_POSITIVE_X, ...)
glTexImage2D( GL_TEXTURE_CUBE_MAP_NEGATIVE_X, ...)
glTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_Y, ...)
glTexImage2D( GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, ...)
glTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_Z, ...)
glTexImage2D( GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, ...)

osg::TextureCubeMap()

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)