From 6ce1a939dc5c2f764ea1623492855e889134a8ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 3 Jan 2014 00:53:14 +0100 Subject: [PATCH] Enable VAOs by default for ES3. The fallback code is kept, as somebody might want to use the "possibly faster" path sometime. --- src/Mesh.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/Mesh.cpp b/src/Mesh.cpp index 8fa370336..f8da0e95e 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -241,33 +241,47 @@ void Mesh::vertexAttribPointer(const LongAttribute& attribute) { #endif void Mesh::initializeContextBasedFunctionality(Context& context) { - /** @todo VAOs are in ES 3.0 and as extension in ES 2.0, enable them when some extension wrangler is available */ + /** @todo Enable when some extension wrangler is available in ES 2.0 */ #ifndef MAGNUM_TARGET_GLES - if(context.isExtensionSupported()) { + if(context.isExtensionSupported()) + #elif defined(MAGNUM_TARGET_GLES2) + if(context.isExtensionSupported()) + #else + static_cast(context); + #endif + { + #ifndef MAGNUM_TARGET_GLES Debug() << "Mesh: using" << Extensions::GL::APPLE::vertex_array_object::string() << "features"; + #elif defined(MAGNUM_TARGET_GLES2) + Debug() << "Mesh: using" << Extensions::GL::OES::vertex_array_object::string() << "features"; + #endif createImplementation = &Mesh::createImplementationVAO; destroyImplementation = &Mesh::destroyImplementationVAO; + #ifndef MAGNUM_TARGET_GLES if(context.isExtensionSupported()) { Debug() << "Mesh: using" << Extensions::GL::EXT::direct_state_access::string() << "features"; attributePointerImplementation = &Mesh::attributePointerImplementationDSA; attributeIPointerImplementation = &Mesh::attributePointerImplementationDSA; attributeLPointerImplementation = &Mesh::attributePointerImplementationDSA; - } else { + } else + #endif + { attributePointerImplementation = &Mesh::attributePointerImplementationVAO; + #ifndef MAGNUM_TARGET_GLES2 attributeIPointerImplementation = &Mesh::attributePointerImplementationVAO; + #ifndef MAGNUM_TARGET_GLES attributeLPointerImplementation = &Mesh::attributePointerImplementationVAO; + #endif + #endif } bindIndexBufferImplementation = &Mesh::bindIndexBufferImplementationVAO; bindImplementation = &Mesh::bindImplementationVAO; unbindImplementation = &Mesh::unbindImplementationVAO; } - #else - static_cast(context); - #endif } void Mesh::createImplementationDefault() { _id = 0; }