Opengl: Indexed Vertex arrays and glLockArrayExt, is it crap?

In the case of a cube(consisting of quads) specified by it´s corners:
You could make an array of 8 vertices(the cubes corners)and an array of 24 indices to draw it with.The code with glLockArrayExt would look like this:

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(…,vertices);
glLockArrayExt();
glDrawElements(GL_QUADS,24,GL_Unsigned_Int,indices);
glUnlockArrayExt()//don´t know how it is called,tell me if it´s wrong

This would give a nice speed increase,´cause only 8 vertices would be transformed instead of 24 without the use of an indexed array and glLockArrayExt().

But I think this is all useless if you want to texture the cube cause one corner vertex of the cube needs 3 different Tex-Coords therefore one has to use an array of 24 Texcoords,and then an array of 24 vertices,´cause AFAIK one vertex cannot have more than one Tex-Coord in OGl,making the Indexed array unnecessary.

Is this correct?I don´t think,if it is you could throw all Vertex Array stuff in the can,except for multiple rendering passes.

Please tell me,XBTC!

it is correct. But a cube isn’t representative of what is drawn in graphics.

Let’s take a terrain mesh that will be covered with grass texture. Every vertices will only need 1 texture coordinates(you’ll have to split the texture coordinates(0.0, 0.1, 0.2, 0.3,… 1.0). The problem are normals, but you can just average them, or you can use another technique for lighting.

So Vertex arrays are great for I weirdly call smooth models.

And your are also right when you say that they are better with multipass algorithm. If you just do a one pass algorithm, you do better stick with display list and vanilla opengl because the memory used to stored the transformed vertices will be lost. And there is also a bandwith reason, but I don`t really understand it, so I’ll leave that for others.

[This message has been edited by Gorg (edited 05-21-2000).]

Correct me if i’m not right, but as far as i know, you can lock the vertex array, and leave the texture coord array not locked. something like that you specify the arrays
you want to lock first, then you call the lock function, and then you specify the other arrays you don’t need to have locked…

How do you implement glLockArraysEXT? I cant find any good documentation, it looks like I need to add something like
PFNGLLOCKARRAYSEXTPROC glLockArraysEXT;

typedef void (APIENTRY * PFNGLLOCKARRAYSEXTPROC)(GLint first, GLsizei count);
to gl.h but that doesnt work
The second parameter is an integer right? so that means its not going to work on objects with more than 65536 vertices?

65536 is not enough? Hmm, about the use of the extension, it could be good to read the article about extensions at this site (there’s a link from the main page somewhere). Or for some examples and the extension definition, I’ve seen something nice in SGI’s MMX OpenGL implementation, again a link is provided somewhere on this site, follow the links from main page for implementations…

Thanx alot,guys!

And flashp:You´re right,one doesn´t have to lock all arrays and I could leave the Texcoord-array unlocked but that doesn´t solve the problem,´cause a Index can only call one vert and the texcoord belonging to it not one vert and different texcoords.

Thanx again,XBTC!

no 65536 isnt enough, Im working with an object that has 1.8 million vertices, now why couldnt they have made that parameter a long

btw guys I got my Mars3D demo on www.demonews.com and www.3dfiles.com )

65535? Man. I haven’t used a system that assumed 16-bit words in like a decade. Now adays the 'ol int is assumed to be a 32-bit word. Thus the limit is 4294967295. That should be more than plenty.

Well this is the definition for the function,
void LockArraysEXT (int first, sizei count)

typedef int GLsizei;

int in C is most definitely 16bits.

And not only is LockArrays limited to 65536 but SO is glVertexArrayRangeNV!! the words “foresight” and “lack of” spring to mind here is some text from the spec…
This section describes implementation-defined limits for NV10:

     The value of MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV is 65535.

…my implementation of this backs this up. I get 13 degrees drawn from my 360 degree globe(1890x945)
Can anyone else confirm or deny this plz?

Adrian: Just wanted to say that all int’s I have been using (on all platforms and compilers) have been 32 bit long. However, I have no idea what system you are using. To find out, just call sizeof(int) or sizeof(GLsizei) and check the result. Would be surprised if you get 2 as result (unless you are using an old system).

Hmm just thought about things and further questions arrise:
I´m programming a Quake like 3d-engine.
But in Quake 3 for example everything consists of neighboring triangles and their corners all need different texcoords as the ones of their neighbours,so in this case nearly no vertex would be exactly the same as another if one thinks of it´s texcoords.This is even more worse with individual lightmaps for each triangle.So does carmack only use glLockArraysExt and vertex arrays ´cause he does multiple rendering passes on every triangle
And another question( ):How does one sort the triangles by textures in this case(every triangle has another lightmap)?
These problems really confuses me and I thought about them alot but seem not to be able to find a “the” solution(maybe there isn´t one )
so I would be very happy about a soultion or just some ideas or ressorces.

Thanx in advance,XBTC!

Q3A uses traingle strips on the most part, or at least that’s what this paper Carmack wrote says.
http://www.gamers.org/dEngine/quake3/johnc_glopt.html

Thanx but I think this isn´t true,he tells they do strip finding and drawing triangle strips only if the gl_compiled_vertex_array extension is not available on a system.

Please don´t feel offended but this isn´t really a solution to my problem,heh

Perhaps it is one and I don´t understand?
If so please tell me!

Thanx anyway this paper is really interesting!

If someone else has an idea,please let me know and thanx in advance, XBTC!

[This message has been edited by XBCT (edited 05-22-2000).]

Don´t wont to annoy sb,but I this problem makes me really !

Thanx in advance,XBTC!