From ec5b0e17ff735e58de139b7f8ce0598928958bcc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 4 Jun 2014 17:55:58 +0300 Subject: Add buffers related OpenGL functions. --- src/graphicsmanager.cpp | 10 ++++++++-- src/render/mgl.cpp | 4 ++++ src/render/mgl.h | 9 +++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index 324337871..f7c877c1f 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -884,8 +884,7 @@ void GraphicsManager::initOpenGLFunctions() if (!mglPopGroupMarker) assignFunction(glPopGroupMarker, "glPopGroupMarker"); } - - if (checkGLVersion(3, 0) || supportExtension("GL_ARB_vertex_array_object")) + if (checkGLVersion(2, 1) && supportExtension("GL_ARB_vertex_array_object")) { assignFunction(glGenVertexArrays, "glGenVertexArrays"); assignFunction(glBindVertexArray, "glBindVertexArray"); @@ -895,6 +894,13 @@ void GraphicsManager::initOpenGLFunctions() assignFunction(glDisableVertexAttribArray, "glDisableVertexAttribArray"); } + if (checkGLVersion(1, 5)) + { + assignFunction(glGenBuffers, "glGenBuffers"); + assignFunction(glDeleteBuffers, "glDeleteBuffers"); + assignFunction(glBindBuffer, "glBindBuffer"); + assignFunction(glBufferData, "glBufferData"); + } #ifdef WIN32 assignFunction(wglGetExtensionsString, "wglGetExtensionsStringARB"); diff --git a/src/render/mgl.cpp b/src/render/mgl.cpp index efa2f736a..fc6624606 100644 --- a/src/render/mgl.cpp +++ b/src/render/mgl.cpp @@ -54,6 +54,10 @@ defName(glDeleteVertexArrays); defName(glVertexAttribPointer); defName(glEnableVertexAttribArray); defName(glDisableVertexAttribArray); +defName(glGenBuffers); +defName(glDeleteBuffers); +defName(glBindBuffer); +defName(glBufferData); #ifdef WIN32 defName(wglGetExtensionsString); diff --git a/src/render/mgl.h b/src/render/mgl.h index b762eed94..1bc82989b 100644 --- a/src/render/mgl.h +++ b/src/render/mgl.h @@ -125,6 +125,11 @@ typedef void (APIENTRY *glVertexAttribPointer_t) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRY *glEnableVertexAttribArray_t) (GLuint index); typedef void (APIENTRY *glDisableVertexAttribArray_t) (GLuint index); +typedef void (APIENTRY *glGenBuffers_t) (GLsizei n, GLuint *buffers); +typedef void (APIENTRY *glDeleteBuffers_t) (GLsizei n, GLuint *buffers); +typedef void (APIENTRY *glBindBuffer_t) (GLenum target, GLuint buffer); +typedef void (APIENTRY *glBufferData_t) (GLenum target, GLsizeiptr size, + const GLvoid *data, GLenum usage); // callback typedef void (APIENTRY *GLDEBUGPROC_t) (GLenum source, GLenum type, GLuint id, @@ -161,6 +166,10 @@ defNameE(glDeleteVertexArrays); defNameE(glVertexAttribPointer); defNameE(glEnableVertexAttribArray); defNameE(glDisableVertexAttribArray); +defNameE(glGenBuffers); +defNameE(glDeleteBuffers); +defNameE(glBindBuffer); +defNameE(glBufferData); #ifdef WIN32 typedef const char* (APIENTRY * wglGetExtensionsString_t) (HDC hdc); -- cgit v1.2.3-70-g09d2