Change GLCapabilities

Hey all,

I have a class (without entry point (static main)) that extends the GLCanvas class. Now, I want to change the GLCapabilities the GLCanvas uses. Looking at the API, the only way I can do this is

super(capabilities);

[color=green]
But using this, I can’t change the values of the GLCapabilities, since the super call must be the first statement in the constructor. Also, GLCanvas has no method such as setGLCapabilities, so how can I change the capabilities.

Since it’s for an engine, I want to keep it simple, so passing it as a parameter is not an option, in my opinion.

Thanks,

~Matt

you could use a private static utility method to create the capabilities.

super(createCapabilities());

...
private final static GLCapabilities createCapabilities() {
    return //something...
}

a warning: don’t read/modify local mutable data in this method… your object isn’t yet created at this point.

the cleanest solution is simple not extending GLCanvas/GLJPanel

Thanks, I’ll try that.

I’m extending GLCanvas for simplicity in using the engine. Later, I might change it so that you can add the 3d world to a frame or applet.

~Matt