hi folks…question: this program doesnt work yet, what’s wrong with it…
this is my first Java program with JOGL (i’ve only been programming for 6months in my life, so I’m new at this. any advice will be appreciated.)
import java.awt.;
import java.awt.event.;
import net.java.games.jogl.;
import javax.;
public class Simple {
public static void main (Strng args []){
Frame simpleFrame = new Frame ("simple"); //awt window
GLCapabilities glc = new GLCapabilities();//config OPen GL
glc.setDoubleBuffered(false);
GLCanvas drawable = GLDrawableFactory.getFactory().createGLCanvas(glc);
drawable.addGLEventListener(new simpleRnderer());
simpleFrame.add(drawable);
simpleFrame.setLocation(100,100);
simpleFrame.setSize(500,500);
simpleFrame.show();}
public void init(GLDrawable drawable){
GL gl = drawable.getGL();
GLU glu = drawable.getGLU();
gl.glClearColor(0f,0f,0f,0f);
glglColor3f(1.0f,1.0f,1.0f,1.0f);
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(-1.0,1.0,-1.0,1.0,1.0);
}
static class SimpleRenderer implements GLEventListener{
public void display(GlDrawable drawable){
GL gl = drawable.getGL();
GLU glu = drawable.getGLU();
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glBegin(GL.GL_POLYGON);
gl.glVertex2f(-0.5f,-0.5f);
gl.glVertex2f(-0.5f,0.5f);
gl.glVertex2f(0.5f,0.5f);
gl.glEnd();
gl.glFlush();
}
}
}