I like to load a texture using the Apple Texture2D class. Create a quad (two triangles, six vertices) that are displayed in the corners of the screen. Then you map the texture coordinates to the vertices, go to glDrawArrays and go. Actually, I have a class that takes a frame in CG coordinates, converts it to OpenGL coordinates, and then draws the image in a frame.
Say you have a structure like this:
struct { GLfloat x; // OpenGL X Coordinate GLfloat y; // OpenGL Y Coordinate GLfloat z; // OpenGL Z Coordinate GLfloat s; // Texture S Coordinate Glfloat t; // Texture T Coordinate } vertexData;
And an array of vertex data like this:
struct vertexData verts[6];
And you have a Texture2D object:
texture = [[Texture2D alloc] initWithImage:[UIImage imageNamed:image] filter:filter pixelFormat:pixelFormat];
So now you have to populate the vertex array. Assuming 3D, x range [-1, 1] and y range [-1, 1], origin for z, you should initialize your vertices as follows:
verts[0].x = verts[1].x = verts[5].x = -1.0; verts[2].x = verts[3].x = verts[4].x = 1.0; verts[0].y = verts[2].y = verts[4].y = 1.0; verts[1].y = verts[3].y = verts[5].y = -1.0; verts[0].z = verts[1].z = verts[2].z = 0.0; verts[3].z = verts[4].z = verts[5].z = 0.0; verts[0].s = verts[1].s = verts[5].s = tlxf; verts[2].s = verts[3].s = verts[4].s = trxf; verts[0].t = verts[2].t = verts[4].t = ttyf; verts[1].t = verts[3].t = verts[5].t = tbyf;
Finally, you need to draw:
glBindTexture(GL_TEXTURE_2D, texture.name); glVertexPointer(3, GL_FLOAT, sizeof(struct vertexData), &verts[0].x); glTexCoordPointer(2, GL_FLOAT, sizeof(struct vertexData), &verts[0].s); glDrawArrays(GL_TRIANGLES, 0, 6);
I leave details about setting up OpenGL. I assume that you did this if you get to this.
There are tons of performance and memory limitations that you need to consider when working in OpenGL, but I would not worry too much about them. Once you earn it, review it with the OpenGL tool to find out if there are any performance issues, and then deal with them.
Apple has a really good document describing best practices, and there are also helpful questions on SO. I am sure that you will be able to find them as soon as you find out what you are faced with (if any).