G’day,
I am having a few depth buffer resolution problems. Not sure if it’s my fault or just expected behaviour. Here is a screeny:
http://img251.imageshack.us/img251/5294/untitledwi8.th.png
You can see on the edges where the hidden lines are shown.
I initialise my render device like this:
GLCapabilities glc = new GLCapabilities();
glc.setDoubleBuffered(true);
glc.setStencilBits(0);
glc.setDepthBits(32);
myGLPanel = new GLJPanel(glc);
myGLPanel.setOpaque(true);
myGLPanel.setDoubleBuffered(true);
I draw the lines (black) and the elements (green) separately, and since they are overlapped I set glDepthRange() like this for lines:
gl.glDepthRange(0.0f, 0.995f); //draw lines over polygons
and like this for elements
gl.glDepthRange(0.005f, 1.0f); //draw polygons under lines
The only other thing I can think of that affects the resolution is the orthographic projection, which I do like this:
//orthographic projection
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(-glWidth, glWidth, -glHeight, glHeight,
-vertices.modelRadius * mouseHandler.zoomScale,
vertices.modelRadius * mouseHandler.zoomScale);
The zooming with the mouse is performed on the projection matrix.
If anyone can spot anything glaringly wrong with this approach, I would welcome any suggestions.
Cheers,
Pinky