📅  最后修改于: 2021-01-05 00:30:11             🧑  作者: Mango
要创建JOGL程序,需要了解以下接口:-
GLEventListener接口存在于javax.media.opengl包中。它提供了执行OpenGL渲染的基于事件的机制。要继承程序中图形的功能,需要实现此接口。
这些是GLEventListner接口的四个重要方法。必须重写所有这些方法。
Method | Description |
---|---|
void display(GLAutoDrawable drawable) | It is called by GLAutoDrawable object to initiate OpenGL rendering by the client. |
void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) | It is called by GLAutoDrawable object when the display mode or device associate with it has changed. |
void init(GLAutoDrawable drawable) | It is called by GLAutoDrawable object immediately after the OpenGL context is initialized. |
void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) | It is called by GLAutoDrawable object during the first repaint. |
GLEventListener接口存在于javax.media.opengl包中。该接口的目的是提供基于事件的机制(GLEventListener)来生成图像。
以下是常用的GLAutoDrawable方法:-
Method | Description |
---|---|
void addGLEventListener(GLEventListener listener) | It adds the object of GLEventListener to the end of drawable queue. |
GLContext getContext() | It returns the context associated with drawable. |
void destroy() | It removes all the resources associated with GLAutoDrawable. |
boolean isThreadCapable() | It specifies whether The current thread is capable of performing OpenGL related work |