My first JOGL program ...advice anyone?

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();
}
}
}

“My car is broken, what should i do to get it running?”

Well… how do you know it’s broken, what happens when you start it…

Same for your app, if we don’t know what the problem is, we can’t help you. Any expections thrown? Stacktraces? Anything at all?

Hi bernie.
Your init-method is in the wrong class… it has to be in the SimpleRenderer and not in the Simple class. Also it looks, that you have some typos in there -> drawable.addGLEventListener(new simpleRnderer());

Does it even compile?

To answer your privat question I accidentally ignored ::slight_smile: … You should keep all the Animator and Thread stuff of the Netbeans-Template and just put your code into the provided display method. Since you left out the Animator in your code, it will do nothing, since your display() method is not called by anyone…

Thank you both…I’m working on it…

bernie
:slight_smile: