Multitexturing & VertexArrays

Is there any other way to do this…

glBegin(GL_TRIANGLES);
glMultiTexCoord2fvARB(GL_TEXTURE1_ARB, data[0 + i].tcoord[1]);
glArrayElement(0 + i);
glMultiTexCoord2fvARB(GL_TEXTURE1_ARB, data[1 + i].tcoord[1]);
glArrayElement(1 + i);
glMultiTexCoord2fvARB(GL_TEXTURE1_ARB, data[2 + i].tcoord[1]);
glArrayElement(2 + i);
glEnd();

Please tell me something encouraging…

hold thight… afaik… ehmm… err… no. );
the only think i would do is to use locked vertex arrays and dereference vertex data with glArrayElement().

btw, always remember GL_TEXTURE0_ARB is the same as glTexCoord… just in case you didn’t know.

Dolo//\ightY

Yes I know but… It suck… why there is not any kind of glMultiTexCoordPointer?

Are glLockArrays and multipass could be a faster solution?

why not a glMultiTexCoordPointer? i’m also wondering why…

about multipass, i don’t think so.
multipass should be avoided where possible because it needs blending, wich involves many memory accesses, therefore it is intrinsically slow.

you say it sucks: yes, it’s not a elegant solution.
but what about performances? well, there’s no point in performance, since it’s the only way to go…
…well, afaik: is it the only way people?

Dolo//\ightY

[This message has been edited by dmy (edited 05-23-2000).]

What are glLockArrays ? Never heard, never read, and didn’t find in the reference pages.

Here is the spec for the extension
http://oss.sgi.com/projects/ogl-sample/registry/EXT/compiled_vertex_array.txt

I too am looking at lock arrays and could do with seeing a source code example if anyone has one.

Apologies for my previous comment about ints I stand corrected.

Ok I’ve found a source code example of glLockArrays here
http://trant.sgi.com/opengl/examples/more_samples/more_samples.html

the vertex culling test at the bottom of the page.

There is a multitexture option to work with vertex arrays :

glClientActiveTextureARB

Concerning glLockArrays : although I use it in some of my software, it does not seem to bring any performance improvement (on my Dual PIII 600,512Mb RAM,ELSA Erazor X2)…

Just to let you know…

Eric

when you use glClientActiveTextureARB, can you use glDrawElements?

I wonder, how do you specify textures coordinates on all textures levels in only one command since there is no glMultiTexCoordPointer?

There is no way to cram it into one command unfortunately, but it can be done in a simple 4:

// vertex pointer
glVertexPointer(3,GL_FLOAT,0,vpoints);

glClientActiveTextureARB(GL_TEXTURE0_ARB);
glTexCoordPointer(2,GL_FLOAT,0,vtexcoords1);
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glTexCoordPointer(2,GL_FLOAT,0,vtexcoords2);

then you go ahead and render the object using either glDrawElements or glDrawArrays.

hope this helps.
-Trotsky

It might be my drivers (NVIDIA 3.68 - TNT2 ULTRA) but if I do what Trotsky wrote, it’s aint working… In fact, its only working if the glTexGen functions are at on on both the S and T coordinate… the following is the source I wrote…

// spoint = sizeof(data[0])

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tex[0]->name);

glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tex[1]->name);
// glEnable(GL_TEXTURE_GEN_S);
// glEnable(GL_TEXTURE_GEN_T);

glVertexPointer(4, GL_FLOAT, spoint, &data[0].vertex);
glColorPointer(4, GL_FLOAT, spoint, &data[0].vcolor);
glNormalPointer(GL_FLOAT, spoint, &data[0].normal);

glClientActiveTextureARB(GL_TEXTURE0_ARB);
glTexCoordPointer(2, GL_FLOAT, spoint, &data[0].tcoord1);
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glTexCoordPointer(2, GL_FLOAT, spoint, &data[0].tcoord2);

glDrawElements(GL_TRIANGLES, vertexNB, GL_UNSIGNED_INT, index);

If I made a mistake somewhere… please tell me where.

Thank you.

Oups… My mistake,
I should have put my glEnableClientState(GL_TEXTURE_COORD_ARRAY); in both glClientActiveTextureARB(GL_TEXTURE0_ARB) and
glClientActiveTextureARB(GL_TEXTURE1_ARB)…

Now it work wonderfully…

Thank you all!