Hi,
I’m trying to make multiple viewports in a test app to see how much work it’s going to take to make my real app do this. I’n this example, I’ve just split the screen in two and trying to get the background to draw a different color so I know what the viewports look like but it’s not working. My entire screen always ends up one color. Am I not doing something right, I was trying to follow the nehe tutorial?
This is an update entry, I can get each view to draw, but only if it’s the last view in my loop that get’s drawn. So I’d comment out each view and just work on one to make sure that that view shows properly, then when I run them all together, it’s just the last one that draws.
public void display(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
this.glDrawable = drawable;
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
for (int i = 0; i < 2; i++) {
if (i == 0) {
gl.glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
gl.glViewport(0, 0, (int) winWidth / 2, (int) winHeight);
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity ();
//gl.glOrtho(0, winWidth / 2, winHeight / 2, winHeight / 2, 100, -100);
}
else if (i == 1) {
gl.glClearColor(0.0f, 1.0f, 0.0f, 0.0f);
gl.glViewport((int) winWidth / 2, 0, (int) winWidth / 2, (int) winHeight);
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity ();
//gl.glOrtho(0, winWidth / 2, winHeight / 2, winHeight / 2, 100, -100);
}
gl.glMatrixMode (GL.GL_MODELVIEW);
gl.glLoadIdentity ();
gl.glClear(GL.GL_DEPTH_BUFFER_BIT);
}
}