开发者

Mapping Multiple Textures to a Cube's faces in Android

开发者 https://www.devze.com 2023-01-04 15:43 出处:网络
I have just began opengl programming in android and i am fairly new to opengl as well. I\'ve been using nehe\'s opengl tutorials as well as insanitydesign\'s android ports. I successfully managed to c

I have just began opengl programming in android and i am fairly new to opengl as well. I've been using nehe's opengl tutorials as well as insanitydesign's android ports. I successfully managed to create a cube with a single texture mapped to all its 6 faces. I even mapped multiple textures to different faces of the cube. But the way I did it was to create 6 faces seperately, have 6 seperate index and texture buffers and then using glBindTexture() with the selected texture for each face and then calling glDrawElements. Isn't there an efficient way around this. Should i use a cube map texture inste开发者_C百科ad of a GL_TEXTURE_2D?

Any suggestions would be appreciated? Thanks


A very efficient way is using a texture atlas, and adjusting texture coordinates of each cube face to match coordinates in the atlas.

0

精彩评论

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