Build an OpenGL model in parallel?

I have a program that draws some landscape and simulates the water flowing over it (in a cheap and easy way).

Water updates were easy to parallelize using OpenMP, so I can do ~ 50 updates per second. The problem is that even with a small amount of water, my draws per second are very low (start at 5 and drop to 2 if there is a significant amount of water).

This is not a problem with the video card, because the terrain is more complex and builds up so fast that it boost::timertells me that I get endless draws per second if I turn off the water. This may be due to the memory bandwidth (although I assume that the model remains on the card and should not be transferred every time).

What bothers me is that on every draw I call glVertex3f()about a million times (the maximum size is 450 * 600, 4 vertices each), and it runs completely sequentially because Glut won't allow me to call something in parallel .

So .. is there any way to build the list in parallel and then pass it to OpenGL right away? Or some other way to do it faster? Am I using the wrong method (besides the obvious โ€œusing smaller verticesโ€)?

+3
source share
4 answers

, . , . , , . glVertex() .

: glVertexPointer(), glDrawElements() glDrawArrays(), , , Vertex. . GPU .

+8

, , glVertex3f()

glVertexPointer().

+7

glVertexPointer ARB_vertex_buffer_object, , , , Vertex.

+4

glVertex() . (2D-) glVertex().
- , :

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3,GL_FLOAT,0,vertCoords);
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glTexCoordPointer(2,GL_FLOAT,0,texCoords);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_FLOAT,0,vertNorm);
glDrawElements(drawtype,tCount*3,GL_UNSIGNED_INT,tris);

- VBO, .
, . , . OpenGL.

+2

Source: https://habr.com/ru/post/1745696/


All Articles