Sign in to follow this  
GreyHound

glDrawElements() and multiple textures possible?

Recommended Posts

Possible or not? I think it's impossible but would like to get some confirmation. Argh this sucks, an array where you put your image indices and then upload to the server, that would be nice. Each primitive would have each texture. ;/

Share this post


Link to post
Share on other sites
Just supply and enable the texture coordinate array for each textuer unit.

glClientActiveTexture(GL_TEXTURE0);
glTexCoordPointer(...);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glClientActiveTexture(GL_TEXTURE1);
glTexCoordPointer(...);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

... and so on.

Share this post


Link to post
Share on other sites
Hm, thx, i need to read some more about this to really understand what you suggest. I didn't use Multitex before.

As far as i understand by now i should bind all the textures up to GL_TEXTURE(i)_ARB and then somehow decide whether to render the texture "layer" or not?

Edit: I thought i should explain my needs some more, mayb it requires a total different approach. I want to render a 2D grid which represents a Civ4 scenario/map. Currently i works pretty well and everything but i draw each tile of the grid with short triangle_strips. That's pretty performant since most of the time the user is zoomed in quite far anyway so i have to render like 20x20x10 (HEIGHTxWIDTHxLAYERS) fields. When zoomed out the chances are quite good that you will see 300x300x10 grind elements which is kinda much all of a sudden.

I've layers like terrain, features, bonus, routes, selection, etc.

That's the actual problem i face and i thought vertex_arrays could really increase the performance a lot. But the places of the different textures are absolutly dynamic i've no idea what to do.

The total number of textures is about 100 and mayb 10 of them would be enought to correctly show 80% of the map. (terrain and forests,hills)

The probably best solution would be to have all textures stuffed into 1 big texture so i can dynamicly control the texture by the UVs and since the textures have the size of 64x64 atm i shoulnd't run into space problems.

But since i want the program to be as much Plug & Playable as possible i don't like the idea of having all textures in 1 bigger file.

How do ppl render bigger terrains where you have to blend several textures together etc. That'S pretty much the same problem. One quite huge structure which needs to be render with several different textures. But i think my need of different textures is quite higher. (Especially nowadays where you would probably do a lot of the terrain effects by using fragment shaders)

[Edited by - GreyHound on August 16, 2007 3:15:03 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this