Ngo Y-An
Ngo Y-An

Reputation: 77

How to draw background image for OpenGL ES for iPad App

I am trying to create an iPad notepad kind of application, where you can write/draw with your finger. I followed some Apple's examples and got it to work on either white or black background. But I would like have an image for a background, like a notebook page, or the like... I have searched, but none of what I've found helped me, or they just confused me even more!! I am very new to this so any suggestion, sample codes would be greatly appreciated. Thank you! :)

Upvotes: 0

Views: 558

Answers (1)

Bill Yan
Bill Yan

Reputation: 3468

you can load in your background image as a texture map and apply it to a quad that has the same size as the screen.

here is the workflow:

you push your current model view matrix and projection matrix into the matrix stack to save your current camera status.

and then clear these matrices to the default identity matrix, set depth buffer mask to true, so that you don't write to the depth buffer, and draw the quad with the background texture.

and then pop the old model view and projection matrices, and draw everything else.

Upvotes: 1

Related Questions