You are not logged in.

1

Tuesday, September 18th 2012, 12:20pm

QPainter, opengl and depth test

Hi all,

in my program there are stuff that are being painted in the opengl area with native opengl commands (glMatrixMode, glEnable etc.). There are also few things that are painted using a QPainter. My problem now is that i don't know how to enable the depth test (glEnable(GL_DEPTH_TEST)) for that QPainter. In the documentation of QPainter i've seen there are the functions "beginNativePainting" and "endNativePainting" but if i call beginNativePainting and enable the depth test, then, in order to use the QPainter, i must first call endNativePainting which will reset the depth test (as i can read from the assistant). But even if this state isn't reset with the current release of Qt, noone guarrantees me it's state in a following release of Qt (again, reading from the assistant). What should i do in order to correctly enable the depth-test and, of course, set the Z coordinate?
Thanx in advance



p.s. i use a function which takes coordinates from the 3D system (x,y,z) and gives me the 2D projection (x,y) which i use for the QPainter.

2

Tuesday, October 2nd 2012, 7:50am

I think there's no solution to my problem, so the only way to continue is to draw them with native opengl code.

Similar threads

Used tags

DEPTH_TEST, OpenGL, QPainter