inline void VL_glGenRenderbuffers(GLsizei n, GLuint *renderbuffers) { if (glGenRenderbuffersOES) glGenRenderbuffersOES(n, renderbuffers); else VL_TRAP(); }
inline void VL_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { if (glRenderbufferStorageOES) glRenderbufferStorageOES(target, internalformat, width, height); else VL_TRAP(); }
inline void VL_glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers) { if (glDeleteRenderbuffersOES) glDeleteRenderbuffersOES(n, renderbuffers); else VL_TRAP(); }
inline void VL_glBindRenderbuffer(GLenum target, GLuint renderbuffer) { if (glBindRenderbufferOES) glBindRenderbufferOES(target, renderbuffer); else VL_TRAP(); }
inline void VL_glBlendEquation(GLenum mode) { if(glBlendEquationOES) glBlendEquationOES(mode); else VL_TRAP(); }
inline void VL_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params) { if (glGetRenderbufferParameterivOES) glGetRenderbufferParameterivOES(target, pname, params); else VL_TRAP(); }
inline void VL_glGenFramebuffers(GLsizei n, GLuint *framebuffers) { if (glGenFramebuffersOES) glGenFramebuffersOES(n, framebuffers); else VL_TRAP(); }
inline void VL_glBlendFuncSeparate( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { if(glBlendFuncSeparateOES) glBlendFuncSeparateOES(srcRGB, dstRGB, srcAlpha, dstAlpha); else VL_TRAP(); }
inline void VL_glGenerateMipmap(GLenum target) { if (glGenerateMipmapOES) glGenerateMipmapOES(target); else VL_TRAP(); }
inline void VL_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { if (glFramebufferRenderbufferOES) glFramebufferRenderbufferOES(target, attachment, renderbuffertarget, renderbuffer); else VL_TRAP(); }
inline void VL_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params) { if (glGetFramebufferAttachmentParameterivOES) glGetFramebufferAttachmentParameterivOES(target,attachment,pname,params); else VL_TRAP(); }
inline void VL_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { if (glFramebufferTexture2DOES) glFramebufferTexture2DOES(target, attachment, textarget, texture, level); else VL_TRAP(); }
inline void VL_glBlendEquationSeparate( GLenum modeRGB, GLenum modeAlpha) { if(glBlendEquationSeparateOES) glBlendEquationSeparateOES(modeRGB, modeAlpha); else VL_TRAP(); }
inline void VL_glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers) { if (glDeleteFramebuffersOES) glDeleteFramebuffersOES(n, framebuffers); else VL_TRAP(); }
inline GLboolean VL_glIsFramebuffer(GLuint framebuffer) { if (glIsFramebufferOES) return glIsFramebufferOES(framebuffer); else VL_TRAP(); return GL_FALSE; }
virtual void render(bool use_vbo) const { VL_CHECK(GLEW_VERSION_1_4); VL_CHECK(!use_vbo || (use_vbo && (GLEW_ARB_vertex_buffer_object||GLEW_VERSION_1_5||GLEW_VERSION_3_0))) use_vbo &= GLEW_ARB_vertex_buffer_object||GLEW_VERSION_1_5||GLEW_VERSION_3_0; // && indices()->gpuBuffer()->handle() && indices()->sizeGPU(); if ( !use_vbo && !indices()->size() ) return; // apply patch parameters if any and if using PT_PATCHES applyPatchParameters(); // primitive restart enable if(primitiveRestartEnabled()) { if(GLEW_VERSION_3_1) { glEnable(GL_PRIMITIVE_RESTART); glPrimitiveRestartIndex(primitiveRestartIndex()); } else if(GLEW_NV_primitive_restart) { glEnable(GL_PRIMITIVE_RESTART_NV); glPrimitiveRestartIndexNV(primitiveRestartIndex()); } else { vl::Log::error("MultiDrawElements error: primitive restart not supported by this OpenGL implementation!\n"); VL_TRAP(); return; } } GLvoid **indices_ptr = (GLvoid**)&mPointerVector[0]; if (use_vbo && indices()->gpuBuffer()->handle()) { VL_glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indices()->gpuBuffer()->handle()); indices_ptr = (GLvoid**)&mNULLPointerVector[0]; } else VL_glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); if (baseVertices().size()) { VL_CHECK( baseVertices().size() == pointerVector().size() ) VL_CHECK( baseVertices().size() == countVector().size() ) if (GLEW_ARB_draw_elements_base_vertex || GLEW_VERSION_3_1) glMultiDrawElementsBaseVertex( primitiveType(), (GLsizei*)&mCountVector[0], indices()->glType(), indices_ptr, (GLsizei)mCountVector.size(), (GLint*)&mBaseVertices[0] ); else { vl::Log::error("MultiDrawElements::render(): glMultiDrawElementsBaseVertex() not supported!\n" "OpenGL 3.1 or GL_ARB_draw_elements_base_vertex extension required.\n" ); } }
inline GLenum VL_glCheckFramebufferStatus(GLenum target) { if (glCheckFramebufferStatusOES) return glCheckFramebufferStatusOES(target); else VL_TRAP(); return GL_FRAMEBUFFER_UNSUPPORTED; }
inline GLboolean VL_glUnmapBuffer(GLenum target) { if (glUnmapBufferOES) return glUnmapBufferOES(target); else { VL_TRAP(); return GL_FALSE; } }
inline void* VL_glMapBuffer( GLenum target, GLenum access) { if(glMapBufferOES) return glMapBufferOES(target, access); else { VL_TRAP(); return 0; } }
inline void VL_glRenderbufferStorageMultisample( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height ) { #ifdef GL_APPLE_framebuffer_multisample if (glRenderbufferStorageMultisampleAPPLE) glRenderbufferStorageMultisampleAPPLE(target, samples, internalformat, width, height); else #endif #ifdef GL_IMG_multisampled_render_to_texture if (glRenderbufferStorageMultisampleIMG) glRenderbufferStorageMultisampleIMG(target, samples, internalformat, width, height); else #endif #ifdef GL_ANGLE_framebuffer_multisample if (glRenderbufferStorageMultisampleANGLE) glRenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, height); else #endif VL_TRAP(); }