码迷,mamicode.com
首页 > 其他好文 > 详细

获取 OpenGL 常用信息

时间:2014-12-01 19:18:37      阅读:477      评论:0      收藏:0      [点我收藏+]

标签:io   ar   color   sp   for   on   bs   ad   ef   

 void Context::getGLExtension()
   {
           const char* sVersion = (const char*)glGetString(GL_VERSION);
           this->_version = std::string(sVersion);

           const char* sShadingLanguageVersion =  (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
           this->_shadingLanguageVersion = std::string(sShadingLanguageVersion);

           const char* sVendor =  (const char*)glGetString(GL_VENDOR);
           this->_vendor = std::string(sVendor);

           const char* sRenderer =  (const char*)glGetString(GL_RENDERER);
           this->_renderer = std::string(sRenderer);

           glGetIntegerv(GL_RED_BITS, &this->_redBits);
           glGetIntegerv(GL_GREEN_BITS, &this->_greenBits);
           glGetIntegerv(GL_BLUE_BITS, &this->_blueBits);
           glGetIntegerv(GL_ALPHA_BITS, &this->_alphaBits);

           glGetIntegerv(GL_DEPTH_BITS, &this->_depthBits);
           glGetIntegerv(GL_STENCIL_BITS, &this->_stencilBits);


           glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &this->_maximumCombinedTextureImageUnits); // min: 8
           glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &this->_maximumCubeMapSize); // min: 16
           glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &this->_maximumFragmentUniformVectors); // min: 16
           glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &this->_maximumTextureImageUnits); // min: 8
           glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &this->_maximumRenderbufferSize); // min: 1
           glGetIntegerv(GL_MAX_TEXTURE_SIZE, &this->_maximumTextureSize); // min: 64
           glGetIntegerv(GL_MAX_VARYING_VECTORS, &this->_maximumVaryingVectors); // min: 8
           glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &this->_maximumVertexAttributes); // min: 8
           glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &this->_maximumVertexTextureImageUnits); // min: 0
           glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &this->_maximumVertexUniformVectors); // min: 128
           glGetIntegerv(GL_ALIASED_LINE_WIDTH_RANGE, &this->_aliasedLineWidthRange); // must include 1
           glGetIntegerv(GL_ALIASED_POINT_SIZE_RANGE, &this->_aliasedPointSizeRange); // must include 1
           glGetIntegerv(GL_MAX_VIEWPORT_DIMS, this->_maximumViewportDimensions);

           // Query and initialize extensions
           this->_standardDerivatives = GL_OES_standard_derivatives;
           this->_elementIndexUint = GL_OES_element_index_uint;
           this->_depthTexture = GL_OES_depth_texture;
           this->_textureFloat = GL_OES_texture_float;

           this->_textureFilterAnisotropic = GL_EXT_texture_filter_anisotropic;
           this->_maximumTextureFilterAnisotropy =  1.0;

           this->_vertexArrayObject = GL_OES_vertex_array_object;
           //this->_fragDepth = getExtension(gl, [‘EXT_frag_depth‘]);

           //this._drawBuffers = getExtension(gl, [‘WEBGL_draw_buffers‘]);
           //this->_maximumDrawBuffers = defined(this._drawBuffers) ? gl.getParameter(this._drawBuffers.MAX_DRAW_BUFFERS_WEBGL) : 1;
           //this->_maximumColorAttachments = defined(this._drawBuffers) ? gl.getParameter(this._drawBuffers.MAX_COLOR_ATTACHMENTS_WEBGL) : 1; // min when supported: 4

            GLfloat cc[4] = { 0.0, 0.0, 0.0, 0.0 };
            glGetFloatv( GL_COLOR_CLEAR_VALUE, cc );
           this->_clearColor = new Color(cc[0], cc[1], cc[2], cc[3]);

           glGetIntegerv(GL_DEPTH_CLEAR_VALUE, &this->_clearDepth);
           glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &this->_clearStencil);
   }

获取 OpenGL 常用信息

标签:io   ar   color   sp   for   on   bs   ad   ef   

原文地址:http://blog.csdn.net/zangle260/article/details/41650699

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!