active rendering, tessellation, and coloring problem

I have been struggling with a problem for the last few days to no avail. I have a concave polygon that I am trying to color. The polygon displays ok, but it is not being colored. I am using active rendering for this program. (When I use non-active rendering, things display correctly.) Below is the code with the complex polygon replaced with a simply one (which is not colored correctly either) to make the code block smaller. I have also attached the 2 java files I am using if anyone wants to see the complete code.

	private void initRender()
	{
		makeContentCurrent();
		
		gl = context.getGL();
		glu = new GLU();
		glut = new GLUT();
		
		resizeView();
		
		gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
		
		// z- (depth) buffer initialization for hidden surface removal
		gl.glEnable(GL.GL_DEPTH_TEST);
		
		gl.glShadeModel(GL.GL_SMOOTH);
		
		loadTextures();
		addLight();
		
		tess = glu.gluNewTess();
		graphList = gl.glGenLists(1);
		doTess();
		
		context.release();
	}

	private void renderLoop()
	{
		isRunning = true;
		
		while (isRunning)
		{
			makeContentCurrent();
			renderScene();
			drawable.swapBuffers();
			context.release();
		}
	}

	private void renderScene()
	{
		if (context.getCurrent() == null)
		{
			System.exit(0);
		}
		
		if (isResized)
		{
			resizeView();
			isResized = false;
		}
		
		// clear color and depth buffers
		gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
		
		gl.glColor3f(1.0f, 1.0f, 1.0f);

		gl.glMatrixMode(GL.GL_MODELVIEW);
		gl.glLoadIdentity();
		
		glu.gluLookAt(xCamPos, yCamPos, zCamPos, xLookAt, yLookAt, zLookAt, 0, 1, 0);
		
		gl.glCallList(graphList);
		gl.glFlush();
	}

	private void doTess()
	{
		double points[][] = new double[][]
		{
			{ 50.0, 50.0, 0.0, 1.0, 0.0, 0.0 },
			{ 200.0, 50.0, 0.0, 1.0, 0.0, 0.0  },
			{ 200.0, 200.0, 0.0, 1.0, 0.0, 0.0  },
			{ 50.0, 200.0, 0.0, 1.0, 0.0, 0.0  } };
		};

		gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

		TessCallback tessCallback = new TessCallback(gl, glu);
		
		glu.gluTessCallback(tess, GLU.GLU_TESS_VERTEX, tessCallback);
		glu.gluTessCallback(tess, GLU.GLU_TESS_BEGIN, tessCallback);
		glu.gluTessCallback(tess, GLU.GLU_TESS_END, tessCallback);
		glu.gluTessCallback(tess, GLU.GLU_TESS_ERROR, tessCallback);
		
		gl.glNewList(graphList, GL.GL_COMPILE);
		gl.glShadeModel(GL.GL_SMOOTH);
		gl.glPolygonMode(GL.GL_FRONT, GL.GL_FILL);
		gl.glPolygonMode(GL.GL_BACK, GL.GL_LINE);
		gl.glRotated(180.0, 0.0, 0.0, 1.0);
		gl.glRotated(180.0, 0.0, 1.0, 0.0);
		gl.glScaled(0.1, 0.1, 0.0);
		glu.gluTessBeginPolygon(tess, null);
		glu.gluTessBeginContour(tess);
		for (int i = 0; i < 34; i++)
		{
			glu.gluTessVertex(tess, points[i], 0, points[i]);
		}
		glu.gluTessEndContour(tess);
		glu.gluTessEndPolygon(tess);
		gl.glEndList();
	}

you may check for a synch between the renderloop and the texture rendering. That means wait for the renderLoop to finish one tick and notify the textures to render again, so on.
I only work with Java2D but the scheme should be similar. Clearly I had to impl. 2 main Threads in my RenderingScene, say one for the canvas rendering from an offscreen Image, then a second one for rendering the offscreen. The second one always waits for the first to achieve one tick before to render.
:wink:

I would try that but unfortunately there are no textures being rendered. Unless of course OpenGL considers color as a texture as far rendering goes. I’m still just a jogl and OpenGL newbie so there are plenty of things I’m still finding out. :slight_smile: