3d world using rectangles instead....
Hi, in lesson 10 it was possible to create a 3d world by mapping textures onto triangles. Is it possible create the same 3d world with squares instead and use four vertices? I have no clue how to do it, but if you change it, wont you have to change everywhere it says TRIANGLES to QUADS and similar to other code? Thanks!!
~Dan~
Also, is it possible to read in triangles and quads while creating the same world. The reason I ask is because if you are creating a floor with a brick texture, it is safe to use triangles, because the pattern is repetitive. BUT, if you have a unique rectangular texture like a rug on top of the floor, you need to read it in as a quad and then display the rectangular texture over your newly formed rectangle on top of the floor. See what I mean? Is it possible to read in both types in the same program.
~Dan~
~Dan~
Yes, it is possible to do both in the same program, just draw all your triangles and then all of your quads (or vice versa, you can even switch back and forth). Example:
Good luck
glBegin(GL_TRIANGLES); //Draw all the triangles ...glEnd();glBegin(GL_QUADS); //Draw all the quads ...glEnd();glBegin(GL_TRIANGLES); //More triangles if you want ...glEnd();
Good luck
Take care using quads. They may look nice but most video cards won''t like them.
When tons of primitives are being drawn, you can expect triangles to be much faster even with the extra vertices. This benchmarking was done a year ago but I think it still holds true.
When tons of primitives are being drawn, you can expect triangles to be much faster even with the extra vertices. This benchmarking was done a year ago but I think it still holds true.
Previously "Krohm"
Quads usually have to be converted to triangles before being rendered anyway. Its just a waste of time.
I don''t really know what they were thinking when they made the quad primitive. While I''m not certain on why they use polygons, I suppose its because they are easier for a computer to handle and rasterize than other visualization methods. Sure we can have voxels to display 3d, but they are too painfully slow to use on a wide scale basis (And on anything besides a lab computer!). Perhaps someone knows the true reason behind using triangles?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement