Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question

closed as not a real question by Byte56, Jonathan Hobbs, michael.bartnett, Josh Petrie, Trevor Powell Oct 17 '12 at 2:28

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
You forgot to actually ask a question. –  Jonathan Hobbs Oct 7 '12 at 1:21
    
Have you enabled Alpha blending? glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); –  Jonathan Connell Oct 8 '12 at 18:05
add comment

1 Answer 1

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.

share|improve this answer
    
Thank U, I'll try –  Alesia Oct 8 '12 at 8:25
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.