It appears as though GLJPanel doesn't support clockwise front faces for culling. I.e. the following causes issues:
gl.glEnable(GL.GL_CULL_FACE); gl.glFrontFace(GL.GL_CW); vs. the following is fine: gl.glEnable(GL.GL_CULL_FACE); gl.glFrontFace(GL.GL_CCW); Running the below code snippet, I expect the triangle to be culled and the blue background to be rendered. Instead I get a black background and if the window is resized, it shows garbage. If I change it to CCW culling and re-order the vertices, everything is fine. Similarly, GLCanvas is fine with CW culling. The same thing happens with newer GL profiles, I'm just using GL2 for brevity of the code. Java: 1.8.0_72 (But I've also seen it in 1.7 and 1.6) OSX Version 10.11.3 (But I've also seen it on Linux) JOGL version: 2.3 ----------------------------------------------------------------------------------------------------- Package: com.jogamp.opengl Extension Name: com.jogamp.opengl Specification Title: Java Bindings for OpenGL API Specification Specification Vendor: JogAmp Community Specification Version: 2.3 Implementation Title: Java Bindings for OpenGL Runtime Environment Implementation Vendor: JogAmp Community Implementation Vendor ID: com.jogamp Implementation URL: http://jogamp.org/ Implementation Version: 2.3.2 Implementation Build: 2.3-b1469-20151010 Implementation Branch: origin/master Implementation Commit: e794fc40ba723f2fca4ac892e873975fb393e007 ----------------------------------------------------------------------------------------------------- public class CullingTest { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { GLJPanel panel = new GLJPanel(); panel.addGLEventListener(new GLEventListener() { @Override public void reshape(GLAutoDrawable d, int x, int y, int w, int h) { d.getGL().glViewport(x, y, w, h); } @Override public void init(GLAutoDrawable d) { GL2 gl = d.getGL().getGL2(); gl.glClearColor(0, 0, 0.5f, 1); gl.glEnable(GL.GL_CULL_FACE); gl.glFrontFace(GL.GL_CW); } @Override public void dispose(GLAutoDrawable d) { } @Override public void display(GLAutoDrawable d) { GL2 gl = d.getGL().getGL2(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity(); gl.glBegin(GL.GL_TRIANGLES); gl.glVertex3f( 0.0f, 1.0f, 0.0f); gl.glVertex3f(-1.0f,-1.0f, 0.0f); gl.glVertex3f( 1.0f,-1.0f, 0.0f); gl.glEnd(); gl.glFlush(); } }); JFrame frame = new JFrame("Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(300, 200); frame.getContentPane().add(panel); frame.setVisible(true); } }); } } |
Administrator
|
Hi
It reminds a known bug, please look for it in our bug tracker. Maybe it contains a workaround. I'm sure that it's not fixed.
Julien Gouesse | Personal blog | Website
|
In reply to this post by Pascal
Don't use immediate rendering, the issue may come from the immediate simulation mode of the driver
|
Administrator
|
I didn't know that the emulation of the immediate mode with VBOs under the hood could cause such bugs. Thanks elect.
Julien Gouesse | Personal blog | Website
|
Wait, it's an hypotesis, not a fact :D |
- I searched Bugzilla, but didn't find anything using multiple different search terms
- It is not because of immediate rendering. As I pointed out in my post, it also happens for newer profiles, i.e. using buffers and shaders. I just used immediate rendering for brevity of the code snippet. - I doubt that it's the driver, since GLCanvas is fine and I see it across platforms. |
Administrator
|
https://jogamp.org/bugzilla/show_bug.cgi?id=842
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |