Loading images into OpenGL in iPhone
So you can’t make a game without images, right? Well, actually you can but that’s another story. But how can you load a jpg or a png and use then on OpenGLES? First let’s make a simple class Texture2D class Texture2D { public: Texture2D(int id, int width, int height) { _textureId = id; _width = width; _height = height; } virtual ~Texture2D(void) { // Delete Texture from HGL Memory glDeleteTextures(1, ((GLuint*)&_textureId)); } int getTextureId() {return _textureId; } protected: int _textureId; // The reference ID of the texture in OpenGL memory int _width; int _height; }; Now for the code to actually load the image ...