PDA

View Full Version : if vertex array count > 1000, glDrawArrays becomes slow?



hockeyman
08-20-2012, 02:14 AM
I have painting app. Mouse event coordinates are stored to VertexArray. Then vertex array is being drawn to screen. My code structure looks like this


// I get mouse event coordinates and store them to VertexArray
glPushMatrix();
//some new matrix settings
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer);
glClear(GL_COLOR_BUFFER_BIT);
//now I draw first full size textured quad and later I draw vertexArray

glDrawArrays(.....);

//and now I draw second full size textured quad on top of first quad ant that what have been drawn from vertex array

glPopMatrix();
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);


//immediately after that I draw FBO to screen:
glBindTexture(GL_TEXTURE_2D, fbTexture);
//Code for drawing textured quad
glBindTexture(GL_TEXTURE_2D, 0);


So everything is redrawn every time when new mouse event coordinate is being registered. And if there are more than 1000 coordinates, drawing becomes really slow. Where could be my problem? I thing 1000 vertices for OpenGL is not much

thokra
08-20-2012, 07:02 AM
No, 1000 vertices are nothing. 1000 draw calls, i.e. calls to glDrawArray, however, is a lot for something as simple as drawing 1000 verts. Please post you full code used to draw.