1
\$\begingroup\$

Some help is needed. I'm developing drawing application on OpenGL (deployment target 4.0) for iOS (iPad). We have 3 drawing tools: pen, marker (with alfa) and eraser. I apply drawing with textures using blending in orthographic projection. I can't use z-ordering because in this case I have to face a lot of troubles with cutting and erasing. The thing that I need is to make the pen be always on the top. When I first use the marker and then the pen - it's ok. But if I use pen first and marker over the pen - I can't see the pen color under marker. I'd appreciate any help or advice.

\$\endgroup\$
2
  • \$\begingroup\$ You forgot to actually ask a question. \$\endgroup\$ Oct 7, 2012 at 1:21
  • \$\begingroup\$ Have you enabled Alpha blending? glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); \$\endgroup\$ Oct 8, 2012 at 18:05

1 Answer 1

1
\$\begingroup\$

I suggest you use opengl lines, since all you can draw are lines with a pen and a marker. That should be more efficient than textures and would eliminate the overlaps. Also keep track of the order in which the lines were drawn.

The thing of using opengl blending in this case is that these kind of problems arise a lot, and the only way to solve them is through trial and error. So I suggest you use opengl lines instead of textures with blending.

\$\endgroup\$
0

Not the answer you're looking for? Browse other questions tagged .