开发者

Mapping textures to a sphere OpenGL ES

开发者 https://www.devze.com 2023-01-17 22:38 出处:网络
Right i am just getting into OpenGL ES, and if i am开发者_高级运维 honest it is very daunting.

Right i am just getting into OpenGL ES, and if i am开发者_高级运维 honest it is very daunting.

Just need a little guidance to point me in the right direction for my current challenge.

I have some code that produces a 3D sphere, that has a texture mapped on to it (A Globe).

I can get the touch co-ordinates on the sphere, and have a handle on that, but my question is how do i then add another texture to that sphere?

I want to be able to touch the globe and then "Highlight" particular areas, SO i have the "Highlight image" i then want to map that image onto the globe on the touch.

This image will wrap around the sphere at the touched point.

Am i right in thinking this is a case of adding another texture to the already textured sphere? What would be the right approach to this?

Do i need to just create a 2D texture to be mapped or do i need a 3D texture (is there such a thing?)

Do i need to re texture the whole sphere?

Its all very confusing and some general pointers would be highly appreciated.

Many thanks in advance!


If you have a highlight image that you want to apply to the point that's been touched, then, in short, you could apply the highlight image to the base texture first (simply rendering one on top of the other in a separate rendering pass), then using the compound image as your texture.

Things to consider:

  • Texture coordinates are independent of your geometry's coordinates, so if you haven't already, you should work out a mapping between the touch point and the point (coordinate pair) on the texture
  • To get the highlight to wrap over the edge, you must set the appropriate texture parameter - in this case, GL_REPEAT should work

As for your other questions, yes, there are 3D textures in OpenGL; however, I would not consider them relevant to your task.

0

精彩评论

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