HiTECNOLOGYs
HiTECNOLOGYs

Reputation: 327

How to texture cube with png image in OpenGL ES 2.0?

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

Upvotes: 1

Views: 2502

Answers (1)

101010
101010

Reputation: 15726

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!

Upvotes: 1

Related Questions