开发者

Texture mapping to triangle strip from atlas Opengl ES

开发者 https://www.devze.com 2023-01-13 13:02 出处:网络
I\'m new to opengl-es on android and struggling to get my head around the concept of texturin开发者_StackOverflowg.

I'm new to opengl-es on android and struggling to get my head around the concept of texturin开发者_StackOverflowg.

I am looking to produce a tilemap of various difference textures. I understand that it is better to use an atlas of all the combined textures so I don't repeatedly rebind. However I am unsure quite how to then map these textures on to my tilemap.

I understand the process of specifiying vertices and then coordinates of where on the texture map I wish to take them from (i drew a picture too!)

Click for image - curse newbies not allowed to post images :(

But my question is can I draw a triangle strip that is, in effect, longer than one "tile" but map a different area of the texture to that "tile".

So instead of drawing a triangle strip pretending to be a quad, one at a time for each tile, can I somehow draw a whole row of the tilemap (like 1,2,3,4 and cleverly shift around the texture coordinates so each "tile" is now from a different area of the texture? So for example I draw a triangle strip 4 tiles long but shift the texture coordinates so the first "tile" is the yellow of my texture the second red ... third blue... etc

If I've not explained myself too well apologies!

It might just be that this is not possible and I have to draw each one individually which seems like I've saved effort with an atlas, then had to draw them all out slowly anyway regardless. Hmm.


Sure, just adjust texture coordinates, that is how texture atlases work.

0

精彩评论

暂无评论...
验证码 换一张
取 消