I am having difficulty understanding the relationship between a texture and an image in OpenGL. I understand that their is an inherent overhead when a texture is rendered by the GPU on the iPhone, and this is exactly the reason that you create a CCSpriteBatchNode (cocos2d) along with a texture atlas for reducing this overhead. But how can the GPU draw different images like rocks, enemies, maybe boats or even huge monsters using the same texture? I read somewhere that textures are supposed to be OpenGL buffers that store the color element values of an image but like I said there could be many different type of objects with different color values so how could they all be drawn using the same texture?
I am completely lost in differentiating between a texture and a real image that we can draw lets say on Illustrator and then copy it into our project using a Texture atlas. Another interesting thing is that a texture should have dimensions that are powers of two but an image can have any dimension! Can anybody please guide me exactly what a texture is and how does it differ from an image? Thank You.
About using CCSpriteBatchNode and drawing different thing using one texture. You can have several pictures, combined to the one texture atlas. For one file will be created one texture, that will contain all the images, and all the sprites (as you say, rocks, enemies and so on) will simply use different texture coordinates to draw only some part of the texture, not the whole texture.
It is useful not only for reducing number of draw calls, that will increase fps rate. It also help you to save application memory and load more pictures at one time. This is about your second question.
Yes. The dimensions of the loaded into memory texture will be powers of two. So, from the image, that have actual size 64×64 will be created texture with the same size, but for picture with size 65×65 will be created texture with size 128×128. It will increase memory usage. When you crete texture atlas, you can combine many pictures with different sizes in one huge texture atlas with size, for example, 2048×2048. Created texture will have the same size, and it will contain all the images(frames), so you can use it with CCSpriteBatchNode to reduce number of draw calls.