bool EnvironmentEs::supportsInstancedArrays() const { #if defined( CINDER_GL_ES_2 ) static bool result = isExtensionAvailable( "GL_EXT_draw_instanced" ) || isExtensionAvailable( "GL_NV_draw_instanced" ); return result; #else return true; #endif }
bool EnvironmentEs::supportsHardwareVao() const { #if defined( CINDER_GL_ES_2 ) static bool result = isExtensionAvailable( "GL_OES_vertex_array_object" ) || isExtensionAvailable( "GL_ARB_vertex_array_object" ); return result; #else // Assumes OpenGL ES 3 or greater return true; #endif }
GLenum EnvironmentEs::getPreferredIndexType() const { #if defined( CINDER_GL_ES_2 ) return isExtensionAvailable( "GL_OES_element_index_uint" ) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT; #else return GL_UNSIGNED_INT; #endif }
void TGen::OpenGL::Renderer::checkCompatibility() { bool compatible = true; if (!isExtensionAvailable("GL_ARB_vertex_buffer_object")) compatible = false; if (!compatible) throw TGen::RuntimeException("OpenGL::Renderer::CheckCompatibility", "not compatible!"); }
bool EnvironmentEs::supportsTextureLod() const { #if defined( CINDER_COCOA_TOUCH ) || defined( CINDER_GL_ES_3 ) return true; #else static bool result = isExtensionAvailable( "GL_EXT_shader_texture_lod" ); return result; #endif }
void TGen::OpenGL::Renderer::readCaps() { GLint viewportDims[2]; glGetIntegerv(GL_MAX_TEXTURE_UNITS , reinterpret_cast<GLint *>(&caps.maxTextureUnits)); glGetIntegerv(GL_MAX_LIGHTS, reinterpret_cast<GLint *>(&caps.maxActiveLights)); glGetIntegerv(GL_MAX_CLIP_PLANES, reinterpret_cast<GLint *>(&caps.maxClipPlanes)); glGetIntegerv(GL_MAX_ELEMENTS_INDICES, reinterpret_cast<GLint *>(&caps.maxIndexBufferIndicies)); glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, reinterpret_cast<GLint *>(&caps.maxVertexBufferVertices)); glGetIntegerv(GL_MAX_TEXTURE_SIZE, reinterpret_cast<GLint *>(&caps.maxTextureSize)); glGetIntegerv(GL_MAX_VIEWPORT_DIMS, viewportDims); glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, reinterpret_cast<GLint *>(&caps.maxFrameBufferColorAttachments)); glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT, reinterpret_cast<GLint *>(&caps.maxGeometryVerticesOutput)); #if 0 //defined(_PLATFORM_OSX) glClear(GL_COLOR_BUFFER_BIT); CGLError err; CGLContextObj ctx = CGLGetCurrentContext(); err = CGLEnable(ctx, kCGLCEMPEngine); // TODO: disable/enable mt ogl engine caps.multithreadable = (err == kCGLNoError); #else caps.multithreadable = false; #endif caps.maxViewportSize = TGen::Rectangle(viewportDims[0], viewportDims[1]); if (glGetString(GL_SHADING_LANGUAGE_VERSION)) caps.shadingLanguageVersion = (char *)(glGetString(GL_SHADING_LANGUAGE_VERSION)); else caps.shadingLanguageVersion = "N/A"; caps.driverName = "OpenGL "; caps.driverName += (char *)glGetString(GL_VERSION); caps.rendererName = (char *)glGetString(GL_RENDERER); caps.driverVendor = (char *)glGetString(GL_VENDOR); caps.vertexShader = isExtensionAvailable("GL_ARB_vertex_shader"); caps.fragmentShader = isExtensionAvailable("GL_ARB_fragment_shader"); caps.geometryShader = isExtensionAvailable("GL_EXT_geometry_shader4"); caps.framebuffer = isExtensionAvailable("GL_EXT_framebuffer_object"); caps.multitexturing = isExtensionAvailable("GL_ARB_multitexture"); caps.rectTexture = isExtensionAvailable("GL_ARB_texture_rectangle"); caps.cubeMaps = isExtensionAvailable("GL_ARB_texture_cube_map"); }
bool EnvironmentEs::supportsTessellationShader() const { static bool result = isExtensionAvailable( "GL_EXT_tessellation_shader" ); return result; }
bool EnvironmentEs::supportsGeometryShader() const { static bool result = isExtensionAvailable( "GL_EXT_geometry_shader" ); return result; }