• Advertisement
Sign in to follow this  

can I switch texture withing a triangle_strip?

This topic is 1739 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

 

I am still a noob  w/ GL and I couldn't find an answer to this yet.

 

short version:

Assume I have 2 adjacent triangles which could be represented with Strip ABCD. Is it possible that ABC refere to a different texture than BCD?

 

 

 

 

long version:

Scenario: I have a tile based terrain. It will by split into smaller n*n pieces. Everything is more or less in x*y and I consider it "2d". Such an n*n piece will have one big texture which I want to compose of smaller tile textures (dirt, grass, ...) using render to texture (haven't done this yet) 

 

Now I want to go 2.5d and add different height levels and cliffs. So between tiles of different level there will be another quad in x*z or y*z plane. For those I want to use another texture (rock wall or something ...) .

 

 

Currently I have created the triangle strip without texturing. For performance reasons I want to do everything in one strip. But now I am not sure if I can switch texture in between ....

 

 

thx n rgds

  tmg

Share this post


Link to post
Share on other sites
Advertisement

Yes, it's possible. One option is to combine all the smaller tile textures into one big texture, and then just have each triangle reference the right portion of the large texture. Another option is to use multitexturing, but might make your shaders and draw calls a bit more complicated.

Share this post


Link to post
Share on other sites

Like cornstalks said, the best option for your scenario is to put all the tiny textures into a single texture (like a tile sheet), and simply use texture coordinates to refer to the part texture you want to use.

 

If you were thinking about using glBindTexture() inside the glBegin() glEnd() pair, i don't think it's valid,

Share this post


Link to post
Share on other sites

If you were thinking about using glBindTexture() inside the glBegin() glEnd() pair, i don't think it's valid,

Not to mention horribly deprecated. I hope no one uses glBegin()/glEnd().

Share this post


Link to post
Share on other sites

 

Yes, it's possible. One option is to combine all the smaller tile textures into one big texture, and then just have each triangle reference the right portion of the large texture. Another option is to use multitexturing, but might make your shaders and draw calls a bit more complicated.

 

Hi, thx for your and the others reply. I think I have to read more into multi texturing. BTW I am using Java and JogAmp.

"one big texture" get's difficult.

e.g.: if I have 3*3 tiles of gras (g) at the same Level (0) it looks like
 

 

ggg   000
ggg   000
ggg   000

 



and I think already about getting one big 30*30 texture (assuming a tile is 10*10 px).

But If I now change the top left Level to 1 I will need to render a cliff (c) additionally to it's right and one to it's lower neighbour
 

 

gcgg      100
c ||      000
g-gg      000
g-gg

 


'|' & '-' means the gs are directly connected. The big texture would not be symmetric or contains a lot of holes ... just writing this got me thinking but I also think this approach would not be feasible.


BWT I am inspired by the Warcraft 3 Engine.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement