michael nesterenko
michael nesterenko

Reputation: 14449

glutInitDisplayMode jogl analogue

I am new to jogl and OpenGl in general, in one tutorial I have encountered glutInitDisplayMode function call, what is it analogue in jogl?

Upvotes: 0

Views: 879

Answers (1)

Jerry Coffin
Jerry Coffin

Reputation: 490378

There is no direct analog. GLUT associates OpenGL more or less directly with a display window.

With JOGL, you create a canvas, then associate the canvas with the window. Creating the canvas looks something like this:

    GLProfile profile = GLProfile.getDefault();
    GLCapabilities capabilities = new GLCapabilities(profile);
    GLCanvas canvas = new GLCanvas(capabilities);

After that, the details vary depending on the window toolkit (AWT, SWT, Swing, etc.) you're going to use. There's not much difference between Swing and AWT: you create a frame, add the canvas to the frame, and add an EventListener for OpenGL events (reshape, draw, etc.) As I recall, SWT changes things a bit more, but it's been long enough that I don't remember the details.

Upvotes: 1

Related Questions