OpenGL Vertex buffers.

Started by
1 comment, last by dxantos 23 years, 10 months ago
Is there any way to get the vertex processed once, but at the same time have more than one UV per vertex? for a oversimplified example a CUBE has 8 vertex, but each vertex have 3 different UVS. Using vertex buffers and vertex index I manage to process the 8 vertex only once. But the cube looks ugly. Do I need to process each vertex 3 times? Or is there a better way. BTW I only show the as an example, I really need a solutions that works in meshes with a 1,000 vertex or more (thus the question). If not, would it be nice, If someone propose an extension to opengl to process the position of the vertex only once, and then add multiple UVS, vertex colors and vertex normals (this one could be tricky) to those processed vertices? (Just a tought).
Advertisement
For OpenGL 1.1 there exists an ARB extension for multi-texture support. OpenGL 1.2 has such a solution build in. Search at www.opengl.org for extensions this will lead you to a registry site with a list of the most ogl extionsions and there specifications. However this will only help you on hardware with multiple texture units - the most common graphiccards only incoorperate 2 texture units - so what to do? Do what Quake does - multiple passes.

You define one vertex array for you model and as many texturecoordinate arrays as you need. Then you draw your model with the first texture array enabled, then you draw it a second time with your second texture array enabled (and ofcourse with the texture you need) and so on. Most hardware supports an ogl extension for so called comiled vertex arrays. This extension allows the hardware to only translate the vertices of your model once and apply all subsequent renderings of this model without tranlating them twice. A description of this extension can be found at the same place where the description for the multi texture extension is.

Bjoern
I think bjoern misunderstood the Question or i didn''t understand his answer :-) So excuse me if i say something twice.

I think you only need to apply one Texture, but wan''t to reuse as much Vertices as possible.
The only way i know that this is possible, is to apply the Textures intelligent enough, for example you can lay a texture around the cube, then you only need some Vertices twice.
Another way, is to use the extra Texture Sets, like Bjoern discribed, but you can''t use Hardware Acceleration with that Method. You also need many Index Lists, so that you can transform your Buffer once, and than (for the cube) you would render the index Lists, which make up the different Sides.

Lars
--------> http://www.larswolter.de <---------

This topic is closed to new replies.

Advertisement