I want to make a program similar to GLPaint using CGContext that is very smooth and easy to put images behind. I understand that GLPaint has no allowance for putting an Image behind the painting canvas, rather than having just a black one.
+2
A:
You can very simply use an image behind the painting canvas. 4 basic steps
- load your image in a texture (for example 256x256)
- enable TEXTURE_2D mode and set the current texture to the texture id you loaded.
- draw a rectangle with that texture enabled and set a texture map coordinates pointer (array of u,v points)
- loop on your screen touch events to overlay with points like in GL_PAINT (without clearing your buffer) to keep the old points and bg image. Render your buffer after drawing points (brush).
Do you need more precision or sample code ?
Vincent Zgueb
2010-04-01 15:30:03
I think I do because I don't know any OpenGL and that would helpful in reading you sudo
Jaba
2010-04-05 12:23:59