📅  最后修改于: 2021-01-05 00:31:08             🧑  作者: Mango
在本节中,我们将学习JOGL提供的类。通过这些类,我们可以在Java代码中添加OpenGL的功能。
以下是JOGL提供的重要课程:-
GLCanvas和GLJPanel类是实现GLAutoDrawable接口的GUI类,并用作Open GL命令的绘图表面。
Constructor | Description |
---|---|
GLCanvas() | It creates a new GLCanvas component with default set of OpenGL capabilities by using the mechanism of default OpenGL capabilities on the default screen device. |
GLCanvas(GLCapabilities cap) | It creates a new GLCanvas component with requested set of OpenGL capabilities by using the mechanism of default OpenGL capabilities on the default screen device. |
Method | Description |
---|---|
void addGLEventListener(GLEventListener listener) | It adds GLEventListener to this drawable. |
void display() | It causes OpenGL rendering for GLAutoDrawable interface. |
void removeGLEventListener(GLEventListener listener) | It removes GLEventListener to this drawable. |
Constructor | Description |
---|---|
GLJPanel() | It creates a new GLJPanel component with default set of OpenGL capabilities by using the mechanism of default OpenGL capabilities on the default screen device. |
GLJPanel (GLCapabilities cap) | It creates a new GLJPanel component with requested set of OpenGL capabilities by using the mechanism of default OpenGL capabilities on the default screen device. |
Method | Description |
---|---|
void addGLEventListener(GLEventListener listener) | It adds GLEventListener to this drawable. |
void display() | It causes OpenGL rendering for GLAutoDrawable interface. |
void removeGLEventListener(GLEventListener listener) | It removes GLEventListener to this drawable. |
GL2,GL3,GL4等OpenGL接口包含特定版本的所有核心方法。 GLProfile类的作用是根据所需版本指定特定的OpenGL接口。
Method | Description |
---|---|
GLProfile get(String profile) | It is used to return an object of GLProfile. |
boolean isGL3() | It is used to indicate whether profile is capable of GL2 or not. |
boolean isGL3() | It is used to indicate whether profile is capable of GL3 or not. |
GLCapibilities类用于指定OpenGL的功能,例如OpenGL配置文件,颜色深度等。GLProfile类的对象作为参数传递给此类。
Method | Description |
---|---|
GLProfilegetGLProfile() | It is used to return the required GLProfile. |
booleanisStereo() | It is used to indicate whether stereo is enabled or disabled |