Question

How do you texture a cube with png image in OpenGL ES 2.0? And how do you use atlas for the texturing?

Was it helpful?

Solution

For the good old cube demo, check this out.

The code is written in WebGL, but you can easily convert it.

However, if you have trouble converting it, then I suggest you start with the "Hello Triangle" demo first -- to get used to this.

There are two links.

  1. Tutorial on Hello Triangle
  2. Source Code for Hello Triangle -- Look at Chapter 2

To do the PNG part, you have a few options depending on your platform (Android, Palm, iPhone)

To give you at least one answer, if you are coding in C++, then you can use libPNG and that also requires zlib. There are many sites with the code to load a PNG into a Texture using C++. For instance.

Good luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top