|
Hi, I have a problem with OpenGL 4 tessellation. I draw 4 vertices in GL_PATCHES mode, with GL_PATCH_VERTICES set to 4 and all the default levels set to 64. I expect OpenGL to recognize the vertices as a quad, and subdivide it into 64 by 64 quads. For some reason, all that appears on screen is 4 points. Below is a small test case:
import java.awt.*;
import java.awt.event.*;
import javax.media.opengl.*;
import javax.media.opengl.awt.*;
public class TessellatorTest implements GLEventListener {
public TessellatorTest()
{
GLProfile profile = GLProfile.get(GLProfile.GL4bc);
GLCapabilities caps = new GLCapabilities(profile);
GLCanvas canvas = new GLCanvas(caps);
canvas.addGLEventListener(this);
Frame frame = new Frame("Hello world!");
frame.add(canvas);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) { System.exit(0); }
});
frame.setSize(500, 500);
frame.setResizable(false);
frame.setVisible(true);
}
public static void main(String[] args) {
new TessellatorTest();
}
public void display(GLAutoDrawable drawable) {
GL4bc gl = drawable.getGL().getGL4bc();
gl.glPolygonMode(GL4bc.GL_FRONT, GL4bc.GL_LINE);
gl.glPatchParameteri(GL4bc.GL_PATCH_VERTICES, 4);
gl.glPatchParameterfv(GL4bc.GL_PATCH_DEFAULT_OUTER_LEVEL, new float[]{ 64, 64, 64, 64 }, 0);
gl.glPatchParameterfv(GL4bc.GL_PATCH_DEFAULT_INNER_LEVEL, new float[]{ 64, 64 }, 0);
gl.glBegin(GL4bc.GL_PATCHES);
gl.glVertex3f(-0.8f, -0.8f, 0);
gl.glVertex3f( 0.8f, -0.8f, 0);
gl.glVertex3f( 0.8f, 0.8f, 0);
gl.glVertex3f(-0.8f, 0.8f, 0);
gl.glEnd();
}
public void init(GLAutoDrawable a){}
public void reshape(GLAutoDrawable a, int b, int c, int d, int e){}
public void dispose(GLAutoDrawable a){}
}
|