kaalus
03-11-2001, 10:00 PM
Suppose, I want to draw ten thousand separate triangles, each one having one corner red, one corner green and one corner blue.
Suppose that I don't want to use ColorMaterial, because there is more than one component of each of 3 materials that I want to change per vertex.
For my best knowledge, in OpenGL there is no way of doing this without switching materials at least twice a triangle - this makes 20000 material switches a frame, although I have only 3 different materials in scene.
Switching materials in OpenGL is painfully slow (I don't know why), it takes more time than transforming and lighting several triangles.
Thus, using OpenGL I'm unable to draw these bloody 10000 triangles at smooth framerates, even using GeForce 2 Ultra.
If this is true, OpenGL seems to be a not-well-thinked-over API.
In DirectX I would need exactly 3 material changes a scene in such a situation, not 20000, because process of transformation and lighting can be separated from drawing in DirectX. So, I can first transform and light all vertices using material #1, then all vertices using material #2 and so on. Then I can draw all the triangles without any more processing and material-switching.
In OpenGL I can't do it, or at least don't know how to do it.
If anybody knows, please let me know.
Kaalus
Suppose that I don't want to use ColorMaterial, because there is more than one component of each of 3 materials that I want to change per vertex.
For my best knowledge, in OpenGL there is no way of doing this without switching materials at least twice a triangle - this makes 20000 material switches a frame, although I have only 3 different materials in scene.
Switching materials in OpenGL is painfully slow (I don't know why), it takes more time than transforming and lighting several triangles.
Thus, using OpenGL I'm unable to draw these bloody 10000 triangles at smooth framerates, even using GeForce 2 Ultra.
If this is true, OpenGL seems to be a not-well-thinked-over API.
In DirectX I would need exactly 3 material changes a scene in such a situation, not 20000, because process of transformation and lighting can be separated from drawing in DirectX. So, I can first transform and light all vertices using material #1, then all vertices using material #2 and so on. Then I can draw all the triangles without any more processing and material-switching.
In OpenGL I can't do it, or at least don't know how to do it.
If anybody knows, please let me know.
Kaalus