2

I understand that i can't adapt GLPainter example from apple to retina due to a bug mentioned here: Problems displaying full-screen CAEAGLLayer on Retina iPad

Any one knows a good starting point to creating an Open-GL basic painter with brushes, that will work on Retina?

or - creating an openGL painter without CAEAGLLayer

Community
  • 1
  • 1
Yogev Shelly
  • 1,373
  • 2
  • 13
  • 24
  • I just found out that weirdly the retina bug on the iPad3 starts after contentScale = 1.5 or any Frame that doesn't exceeds - 1,536 * 1,152 so you can get Half Retina for now :) – Yogev Shelly Jul 10 '12 at 14:00

1 Answers1

0

I think that the starting point can still be GLPaint, only you need to set to NO hte value of kEAGLDrawablePropertyRetainedBacking and change the way you draw in your GL view.

GLPaint will only render to the gl buffer the strokes you draw by touching the screen, relying on kEAGLDrawablePropertyRetainedBacking to make the full buffer content retained. An alternative might be redrawing at each step the full content of the buffer. This would require keeping track of all the strokes that were drawn and kind-of "replay" them.

I suspect that in any serious painting app you would not rely on kEAGLDrawablePropertyRetainedBacking to retain the buffer content due both to performance and the need for managing you own data structure representing the painting (for anything like storing, sending the painting etc.) and would therefore implement your own solution for it.

sergio
  • 68,819
  • 11
  • 102
  • 123
  • Changing kEAGLDrawablePropertyRetainedBacking to NO will result in an animated like ant trail. how can i avoid this behavior? – Yogev Shelly Jul 09 '12 at 07:19
  • Have you changed the drawing logic so you redraw the whole scene instead of just the last stroke? – sergio Jul 09 '12 at 09:03
  • I will, busy busy day! and i'm not sure how to extend the bounty period, i'm also not experienced with openGL so i'll need a moment. any tips based on the GLPaint on how to achieve that to make things faster?thanks. – Yogev Shelly Jul 09 '12 at 18:58
  • I store all the drawing steps and then draw them all at once. the problem is that i erase my canvas before wach draw, resulting in a fast blink of an empty canvas, any ideas on how to avoid the blinking? – Yogev Shelly Jul 10 '12 at 10:27
  • Fixed -no blinking, i clear the buffer and recreate it before each draw, but the drawing becomes slow, what should i do to have a clean canvas before each draw and effect my speed? – Yogev Shelly Jul 10 '12 at 10:36
  • I do enjoy these conversation with myself... destroying and creating the buffer is a heavy task for each draw, so i went back to calling the erase method, but i don't call - [context presentRenderbuffer:GL_RENDERBUFFER_OES];. now everything works, still a lot of headache compared to - kEAGLDrawablePropertyRetainedBacking:YES. THANKS! – Yogev Shelly Jul 10 '12 at 10:41
  • So, your suggestion does work, but after many draw steps the drawing process of all of them is getting slower and slower, so some kind of backing process must happen... (i read something about render to texture here - http://stackoverflow.com/questions/9753230/ipad-3-opengl-bug-with-keagldrawablepropertyretainedbacking-and-retina – Yogev Shelly Jul 10 '12 at 11:09
  • rendering to texture seems like a good idea. if you google around you will find many sources out there. this is one: http://stackoverflow.com/questions/1024603/opengl-es-render-to-texture; or this: http://ogltotd.blogspot.com.es/2006/12/render-to-texture.html; hope this helps... – sergio Jul 10 '12 at 14:16