summaryrefslogtreecommitdiff
path: root/glsize.hpp
diff options
context:
space:
mode:
authorZack Rusin <zack@kde.org>2011-04-29 01:22:59 -0400
committerZack Rusin <zack@kde.org>2011-04-29 01:22:59 -0400
commitac5128ff2e95439d41c686b6d4286449f2dcc347 (patch)
treef58d91f501e468c1d60681606b2d877606d360fe /glsize.hpp
parentc97d2c528c736dc8c971899a08d5baf191af9aca (diff)
Don't overflow the max index when the app isn't rendering anything.
fixes #16
Diffstat (limited to 'glsize.hpp')
-rw-r--r--glsize.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/glsize.hpp b/glsize.hpp
index 9e3bd82..838625a 100644
--- a/glsize.hpp
+++ b/glsize.hpp
@@ -94,6 +94,9 @@ __glArrayPointer_size(GLint size, GLenum type, GLsizei stride, GLsizei maxIndex)
static inline GLuint
__glDrawArrays_maxindex(GLint first, GLsizei count)
{
+ if (!count) {
+ return 0;
+ }
return first + count - 1;
}
@@ -102,6 +105,10 @@ __glDrawElements_maxindex(GLsizei count, GLenum type, const GLvoid *indices)
{
GLvoid *temp = 0;
GLint __element_array_buffer = 0;
+
+ if (!count) {
+ return 0;
+ }
__glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &__element_array_buffer);
if (__element_array_buffer) {
// Read indices from index buffer object