void InstancedTessellation::initRendering(void) { if( requireMinAPIVersion(NvGfxAPIVersionES3(), false) ) { m_hwInstancing = true; glDrawElementsInstancedInternal = (PFNDrawElementsInstanced)getGLContext()->getGLProcAddress("glDrawElementsInstanced"); glVertexAttribDivisorInternal = (PFNVertexAttribDivisor)getGLContext()->getGLProcAddress("glVertexAttribDivisor"); } else { // We need at least _one_ of these two extensions if (!requireExtension("GL_ARB_instanced_arrays", false) && !requireExtension("GL_NV_draw_instanced", false)) { m_hwInstancing = false; } else { m_hwInstancing = true; if (requireExtension("GL_ARB_instanced_arrays", false) ) { glDrawElementsInstancedInternal = (PFNDrawElementsInstanced)getGLContext()->getGLProcAddress("glDrawElementsInstancedARB"); glVertexAttribDivisorInternal = (PFNVertexAttribDivisor)getGLContext()->getGLProcAddress("glVertexAttribDivisorARB"); } else { glDrawElementsInstancedInternal = (PFNDrawElementsInstanced)getGLContext()->getGLProcAddress("glDrawElementsInstancedNV"); glVertexAttribDivisorInternal = (PFNVertexAttribDivisor)getGLContext()->getGLProcAddress("glVertexAttribDivisorNV"); } } } if( m_hwInstancing ) { m_instancing = true; } glClearColor(0.0f, 0.0f, 0.0f, 1.0f); NvAssetLoaderAddSearchPath("es2-aurora/InstancedTessellation"); LOGI("Hardware Instancing %s\n", m_hwInstancing ? "Available" : "Not available" ); int len; char *pBuff; initShaders(); for( int i = 0; i < eNumModels; ++i ) { std::string path = "models/"; path += m_pModelNames[i]; path += ".obj"; pBuff = NvAssetLoaderRead(path.c_str(), len); loadModelFromData(i,pBuff); initPerModelTessellationInstancingData(m_pModel[i], i ); delete [] pBuff; } initGeneralTessellationInstancingData(); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glClearColor(0.0, 0.0, 0.0, 1.0); CHECK_GL_ERROR(); }
void OptimizationApp::configurationCallback(NvEGLConfiguration& config) { config.depthBits = 24; config.stencilBits = 0; config.apiVer = NvGfxAPIVersionES3(); }
void InstancedTessellation::configurationCallback(NvEGLConfiguration& config) { config.depthBits = 24; config.stencilBits = 0; config.apiVer = NvGfxAPIVersionES3(); }