I'm investigating making some simple widgets using bgl and finding it difficult to use the depth buffer without making a mess of the area I'm drawing in.

Enable depth testing:


From here I've tried calls to glDepthRange(...) , glDepthFunc(...) , with varying degrees of success, but without a handle on writing above the view, ie when I do get an element to draw behind it ends up behind everything and can't be seen. (well at least I'm assuming that's the case)

Will keep editing the question as I get more o fay with bgl / opengl.


Ok I have found one way of doing this.

bgl.glDepthRange (0.0, 0.9);

# Draw "Something" here

bgl.glDepthRange (0.1, 1.0)

# Anything drawn now will be below "Something" drawn above

# restore opengl defaults

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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