Jump to content

  • Log In with Google      Sign In   
  • Create Account


can I switch texture withing a triangle_strip?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 TMGeorge   Members   -  Reputation: 127

Like
0Likes
Like

Posted 14 April 2013 - 07:27 AM

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



Sponsor:

#2 Cornstalks   Crossbones+   -  Reputation: 6974

Like
0Likes
Like

Posted 14 April 2013 - 08:28 AM

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.


[ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

#3 __SKYe   Members   -  Reputation: 1020

Like
0Likes
Like

Posted 14 April 2013 - 12:46 PM

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,



#4 Cornstalks   Crossbones+   -  Reputation: 6974

Like
0Likes
Like

Posted 14 April 2013 - 02:53 PM

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().


[ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

#5 TMGeorge   Members   -  Reputation: 127

Like
0Likes
Like

Posted 15 April 2013 - 06:49 AM

 

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 © 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.



#6 mhagain   Crossbones+   -  Reputation: 7867

Like
0Likes
Like

Posted 15 April 2013 - 07:11 AM

The other option you could try is using a texture array.


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS