Can anyone point me to a working application using AWTGLCanvas?
I’ve subclassed it and overriden paintGL() and update(), both of which are getting called, but nothing is happening. I tried some simple OGL as follows:
protected void paintGL() {
System.out.print("paint ");
System.out.println(getWidth()+" "+getHeight());
GL11.glClearColor(1f, 0f, 0f, 0f); // Red
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
}
I though something would happen, but it doesn’t (I tried alpha=1 also);
Incidentally, If I want to initialise the projection matrix where does the initialisation go? Can I call makeCurrent() in the constructor (after explicitly calling underlying constructor to be on safe side), and then do some GL?
Alan
Edit: I added a swapBuffers() at the end of paintGL(), and got a nice red square. I’d still like recommendations on where (and how) to put in the initialisation code.
java.lang.IllegalStateException: Canvas not yet displayable
Initialisation… Ho Hum.
Edit2: Does each context have its own projection and model matrices, or is there a common one. I.e. there is more then one AWTGLCanvas do I need to set up projection on each paint() call?
