Inconsistent results

When I run this jar with JOGL 1.1.1 in Windows I get:
http://www.gamelizard.com/sho3d_win_jogl.png
When a friend runs this with JOGL 1.1.1 on Windows he gets:
http://www.gamelizard.com/bad.gif
Someone else ran it, I don’t know what system, and got the same bad image
EDIT: 3 people get the bad image, I’m still the only one with the good result :stuck_out_tongue:

Here’s the jar:
http://www.gamelizard.com/osp_manual_JOGL.jar

Any ideas of what could be wrong or how I can fix this?

I tried your app under NT4 and got the bad result. Going for the easiest target, the MS OpenGL implementation might be the culprit? :slight_smile: I’ve had extremely weird results using their software opengl implementation in the past.

You can see the available and chosen pixel formats by specifying -Djogl.debug.GLContext -Djogl.debug.DefaultGLCapabilitiesChooser on the command line. On my machine a hardware-accelerated pixel format is chosen but the artifacts are still there. From moving the camera around it looks like you’re trying to do something with overlaying a wireframe on top of a solid model. Are you trying to achieve an effect like this? If so, are you using glPolygonOffset?

No, I’m not drawing a wireframe overtop, I’m simple doing one render of the polygons. No, I’m not using glPolygonOffset anywhere either.

Using the flags you suggested I get this:


main: GLContext.setRealized(true) for context net.java.games.jogl.impl.windows.WindowsOnscreenGLContext@107077e
AWT-EventQueue-0: Using ChoosePixelFormat because multisampling not requested
...
Available 5: GLCapabilities [DoubleBuffered: true, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 8, Red: 8, Green: 8, Blue: 8, Alpha: 8, Red Accum: 16, Green Accum: 16, Blue Accum: 16, Alpha Accum: 16 ]
...
Choosing window system's recommended choice of 5
GLCapabilities [DoubleBuffered: true, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 8, Red: 8, Green: 8, Blue: 8, Alpha: 8, Red Accum: 16, Green Accum: 16, Blue Accum: 16, Alpha Accum: 16 ]
AWT-EventQueue-0: Chosen pixel format (5):
GLCapabilities [DoubleBuffered: true, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 8, Red: 8, Green: 8, Blue: 8, Alpha: 8, Red Accum: 16, Green Accum: 16, Blue Accum: 16, Alpha Accum: 16 ]
AWT-EventQueue-0: !!! Created OpenGL context 65536 for device context 0x1010056 using pixel format 6
AWT-EventQueue-0: !!! Created GL context for net.java.games.jogl.impl.windows.WindowsOnscreenGLContext
AWT-EventQueue-0: !!! Initializing GLU extension address table
AWT-EventQueue-0: !!! Initializing OpenGL extension address table

Here’s my box render routine just in case it has any incriminating evidence:


//ElementBox
	void draw(GLDrawable drawable) {
		if (!isVisible())
			return;
		
		GL gl = drawable.getGL();
		gl.glPushMatrix();
	    //position so that coords are at its center
		//gl.glTranslated(getX(), getY(), getZ());
		//getRotation().glRotate(gl);
		
		transform(gl);
		gl.glScaled(getSizeX(), getSizeY(), getSizeZ());
			
		if (getStyle().isDrawingFill()) {
			
			GLTools.setColor(gl, getStyle().getFillColor());
			gl.glEnable(GL.GL_LIGHTING);
			gl.glMaterialfv( GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE, 
					getStyle().getFillColor().getRGBComponents(null));
			
			checkData();
			
			gl.glDisable(GL.GL_CULL_FACE);
			
			preFillGL(drawable);
			
			for (int i = 0; i < data.length; i++) {
				gl.glBegin(GL.GL_QUADS);
				gl.glNormal3d(normals[i].x, normals[i].y, normals[i].z);
				for (int j = data[i].length - 1; j >= 0; j--) {
					
					gl.glVertex3dv(data[i][j]);
				}
				gl.glEnd();
			}
			
			//DrawingPanel3D.GLUT.glutSolidCube(gl, 1);
		}
		gl.glPopMatrix();
		setElementChanged(false);
	}

//GLTools
	public static void setColor(GL gl, int c) {
		gl.glColor4ub((byte)(0xff&(c>>16)), (byte)(0xff&(c>>8)), (byte)(0xff&(c)), (byte)(0xff&(c>>>24)));
	}

//GLTools	
	public static void setColor(GL gl, Color c) {
		setColor(gl, c.getRGB());
		
		if (c.getAlpha() < 255) {
			gl.glDisable(GL.GL_DEPTH_TEST);
			gl.glDisable(GL.GL_CULL_FACE);
		}
		else {
			gl.glEnable(GL.GL_DEPTH_TEST);
			gl.glEnable(GL.GL_CULL_FACE);
		}
	}

Your rendering loop basically seems okay, but I would still wonder if maybe your model has duplicated but non-coincident vertices leading to the cracks between adjacent polygons or something similar. Also, on my machine, when the “sphere” out front overlaps the box in the back, there is a distinct black outline around the sphere that isn’t present when it isn’t overlapping. That seems suspicious and I don’t know what could be causing that.

Can you post complete source code somewhere, or boil down your program into a simpler test case?

I’ve just given this a burl on my Inspiron 9200 w/ latest released JOGL, JDK1.5.0_4.
Funnily enough I get a mixture of the good and the bad. I don’t get the wireframe stauff over the base/spring/ball. They’re all nice and solid.
However, I don’t get the text inside the yellow boxes.

One thing I DO get is clipping at the near plane during rotation. You might want to change your near value in your ortho/perspective.