Added initGL to AWTGLCanvas

This commit is contained in:
Elias Naur 2005-12-28 22:23:35 +00:00
parent d633986260
commit a8aabe008e
1 changed files with 10 additions and 0 deletions

View File

@ -228,6 +228,14 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener,
}
}
/**
* Override this to do initialising of the context.
* It will be called once from paint(), immediately after
* the context is created.
*/
protected void initGL() {
}
/**
* Override this to do painting
*/
@ -246,6 +254,8 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener,
try {
if (context == null) {
this.context = new Context(peer_info, drawable != null ? drawable.getContext() : null);
context.makeCurrent();
initGL();
}
if (!context.isCurrent())
context.makeCurrent();