开发者

Drawing many quads [closed]

开发者 https://www.devze.com 2023-03-11 08:40 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I'm making something similar to Minecraft Classic. I already got terrain generator , but frame rate is very low !

I already optimized it , that's it's drawing only quads which can be visible. I'm using glBegin(GL_QUADS) and glEnd() but only once, and a lot of glVertex3fv. I'm starting to learning this, so I don't want to use VBO etc. So what I can do ?

PS. I'm not using textures.

edit

Picture img580.imageshack.us/img580/5547/fpsx.j开发者_StackOverflowpg

edit 2

In fact my pseudo optimization don't do anything at all ...

img143.imageshack.us/img143/9163/fps5.jpg

That's when everything is drawn , only 3 fps worse ... That's not good ...

But look there's much more glVertex... calls (almost 47 times more) but frame rate is similar , so maybe that's not a problem , so where is it ?

edit 3

Also I will add information that there isn't any fps limit :

img339.imageshack.us/img339/4111/fps6.jpg

it's probably all

Anyway, thanks for help. Now I'm going to learn how to use VBO (wish me good luck). After changing from Debug to Release there was small (or even not so small) improvement (over 100 fps - before 18). But it was only for 3x3 chunks (48x48 blocks), now when I increased it to 5x5 chunks (80x80 blocks) it's again 30-40 fps ...

http://img90.imageshack.us/img90/2321/fps7.jpg

Again thanks for help. Probably I will keep asking with VBO :)


You need to use VRAM buffers.

Optimizing the visible faces helps significantly, as does batching faces when drawing, but neither will have a really significant benefit when all faces are stored in system RAM and you're sending the verts one-by-one.

You need to create a VBO on the GPU and download the geometry to that whenever it changes. Render that each frame and it will be far more efficient.

Rough testing while writing a (non-Minecraft) voxel engine showed roughly a 50-80x gain when the cubes were organized into a small set of buffers on the GPU. That was over raw cubes stored on the GPU, going from immediate to buffers will be even greater.

There are some libraries and engines that may help you handle the buffers and underlying objects. Once you have the geometry generation algorithm, most engines will accept the created mesh for use in an object of some sort. For OpenGL in specific, the Visualization Library may be of help.


If you could optimize your series of quads into a trianglestrip instead you would probably see a significant increase.

http://en.wikipedia.org/wiki/Triangle_strip

0

精彩评论

暂无评论...
验证码 换一张
取 消