[Help] About OpenGL triangle limitation.

Started by
10 comments, last by linyang 19 years, 10 months ago
Hi guys, I am trying to draw as much triangles as I can with OPENGL under VC environment. It seems that if I draw only one triangle between a glBegin(GL_TRIANGLES) and a glEnd(). I can only draw less than 1 million triangles. Are their any limitations for the number of triangles that I can draw on the screen? And also, is there any method that I can take to draw more triangles on the screen? It is not only a test. I meet the limitation when I am trying to draw a big terrain. I saw you guys in this forum can always draw triangles more than 5 million or so. Please help me out. Thank you so much. BTW: my machine is Readon 8500/64m, P4 3G, 2G Mem. So I don''t think it is because of my hardware.
Thx
Advertisement
The only limitation is your graphics card.
To draw more triangles use triangles strips and lists, certainly not only one triangle per glbegin-glend.
You know that you can draw as many triangles you want in a glbegin-glend, right?
Killers don't end up in jailThey end up on a high-score!
quote:Original post by linyang
Hi guys, I am trying to draw as much triangles as I can with OPENGL under VC environment. It seems that if I draw only one triangle between a glBegin(GL_TRIANGLES) and a glEnd().

There you have your problem. First of all, you can put as many triangles as you wish in a begin/end pair. The more, the better the performance (theoretically).

Second, and this is the most important point, you shoudn''t use glBegin()/glEnd() at all (the so called immediate mode). It is extremely slow, and not a good way to draw large amounts of triangles. Use vertex arrays instead, any OpenGL book or online reference should cover their usage.

If you''re looking for maximum performance, then you have to use the VBO (ARB_vertex_buffer_object) extension. It builds on standard vertex arrays, so learning about simple arrays should get you started. Later on, when you feel ready, switch over to VBO.
quote:Original post by nife
The only limitation is your graphics card.
To draw more triangles use triangles strips and lists, certainly not only one triangle per glbegin-glend.
You know that you can draw as many triangles you want in a glbegin-glend, right?


Thank you for the replay.

I don''t think we can draw as many triangles as we want in one glbegin-glend. It is probably a little bit more than 5 million based on my test.

Thx
quote:Original post by Yann L
quote:Original post by linyang
Hi guys, I am trying to draw as much triangles as I can with OPENGL under VC environment. It seems that if I draw only one triangle between a glBegin(GL_TRIANGLES) and a glEnd().

There you have your problem. First of all, you can put as many triangles as you wish in a begin/end pair. The more, the better the performance (theoretically).

Second, and this is the most important point, you shoudn't use glBegin()/glEnd() at all (the so called immediate mode). It is extremely slow, and not a good way to draw large amounts of triangles. Use vertex arrays instead, any OpenGL book or online reference should cover their usage.

If you're looking for maximum performance, then you have to use the VBO (ARB_vertex_buffer_object) extension. It builds on standard vertex arrays, so learning about simple arrays should get you started. Later on, when you feel ready, switch over to VBO.


Thank you so much dude.

I have one more question for ya. I am drawing something on screen, as I told you, big number of triangles. Some of them are dymanic and some are static. I will have to redraw the static triangles(5 million) all the time. I am utilizing DrawList at the time. Everytime I wanna redraw it, I just call the drawlist.

As for vertex array, is it suitable for my implementation?

Also, could you explain the difference between hardware implementation and sofrware implementation? I find it is faster and more smooth in software environment. Is everybody using software way to work on OPENGL?

It is a great place and I love it. Thanks for your reply.

[edited by - linyang on June 1, 2004 3:08:39 PM]
Thx
You have to redraw both the static and dynamic triangles, not only the static ones.
Like Yann L said, you can draw (in theory, not in practice) as many triangles as you want. In practice you are limited by the memory.
So what do you mean you can only draw 5 million triangles? What happens if you try to draw 6 million?
As for the software vs hardware implementation, there is little difference. They are both the same (at least on Linux, if you have the latest MESA version).
Oh, the hardware implementation is a few orders of magnitutde faster.
quote:Original post by Raduprv
You have to redraw both the static and dynamic triangles, not only the static ones.
Like Yann L said, you can draw (in theory, not in practice) as many triangles as you want. In practice you are limited by the memory.
So what do you mean you can only draw 5 million triangles? What happens if you try to draw 6 million?
As for the software vs hardware implementation, there is little difference. They are both the same (at least on Linux, if you have the latest MESA version).
Oh, the hardware implementation is a few orders of magnitutde faster.


Talk about hardware and software. I found great difference when I am doing my test on 5.11 million triangles. Software implementation gives a better performance( using glbegin-glend ).

I think I am getting a windows error message if I am trying to draw 6 million triangles.

Something like "The instruction at "0x6920c763" referenced memory at "0x00000004", the memory could not be "written"" Something like that.

Talk about speed. Which is the best approach for my requirement(needs to redraw all the time).

Thank you all.



[edited by - linyang on June 1, 2004 3:30:22 PM]

[edited by - linyang on June 1, 2004 3:30:51 PM]
Thx
quote:Original post by linyang
I have one more question for ya. I am drawing something on screen, as I told you, big number of triangles. Some of them are dymanic and some are static. I will have to redraw the static triangles(5 million) all the time. I am utilizing DrawList at the time. Everytime I wanna redraw it, I just call the drawlist.

What is DrawList ?

quote:Original post by linyang
As for vertex array, is it suitable for my implementation?

I don''t know your implementation. But with high probability the answer is yes. Vertex arrays (through VBO) is the usual approach to get the maximum out of your card.

quote:Original post by linyang
Also, could you explain the difference between hardware implementation and sofrware implementation? I find it is faster and more smooth in software environment. Is everybody using software way to work on OPENGL?

Could you please rephrase your question ?

quote:
I think I am getting a windows error message if I am trying to draw 6 million triangles.

Something like "The instruction at "0x6920c763" referenced memory at "0x00000004", the memory could not be "written"" Something like that.

Looks like a bug in your code, you''re probably trying to dereference an uninialized pointer. Also, make sure to install the lastest drivers from ATI.
quote:Original post by Yann L
quote:Original post by linyang
What is DrawList ?


Sorry, it should be display list.

quote:
I don''t know your implementation. But with high probability the answer is yes. Vertex arrays (through VBO) is the usual approach to get the maximum out of your card.

Could you please rephrase your question ?


Good, I will read into ''Vertex arrays''. Try to get a better performance.


quote:
Looks like a bug in your code, you''re probably trying to dereference an uninialized pointer. Also, make sure to install the lastest drivers from ATI.


If I draw 1 million triangles with the same code, everything is fine. However, when I am drawing too many triangles,I will have this error message. I just simply utlizing glbegin(TRIANGLES) and glEnd(), nothing else. It might not be a bug in the code. But something about the limitation of triangles I can draw, I think.

Thx
Just out of curiosity, what kind of scene are you drawing that requires 5 million triangles? I mean with a screen resolution of 2048*1536 you have 3145728 pixels which would mean that each triangle takes less then a pixel in size.

Assuming you''re not using a higher resolution then that I suggest some culling algorithm.

This topic is closed to new replies.

Advertisement