- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试学习如何使用 JoGL,由于某种原因,尽管导入了所有这些内容,我还是收到了此错误:
import javax.media.opengl.*;import javax.media.opengl.glu.*;import com.sun.opengl.util.*;import com.sun.opengl.util.j2d.*;
public void display(javax.media.opengl.GLDrawable gLDrawable) { final GL gl = gLDrawable.getGL(); }
nor
public void display(GLDrawable gLDrawable) { final GL gl = gLDrawable.getGL(); }
work.
How do I fix this?
(edit: moved the next question up to here... you can edit your question or make a new question if things change with the answers you get)
Okay, that worked for getGL(), but now I'm still having problems with "cannot find symbol method getGLU()"
public void reshape(GLAutoDrawable gLDrawable, int x, int y, int width, int height)
{
final GL gl = gLDrawable.getGL();
final GLU glu = gLDrawable.getGLU();
}
最佳答案
这是因为 GLDrawable 实际上没有有这样的方法 - 请参阅 here .
这是一个由 GLCanvas 和 GLJPanel 实现的接口(interface),两者都有这样的方法。
我认为你需要做的是传入一个 GLAutoDrawable 并使用它的 getGL 方法。请参阅here .
This wikipedia article有一些示例源代码展示了它是如何完成的。
在回答您进一步询问为什么 final GLU glu = gLDrawable.getGLU();
不起作用时,您可能正在使用最新的 JSR-231 版本的 API,但是基于较旧的源代码示例构建您自己的代码。
在该规范之前,您通常从以下位置获取 GLU:
final GLU glu = glAutoDrawable.getGLU();
有了它,您现在只需使用:
final GLU glu = new GLU();
参见here有关该特定对象的详细信息。
关于java - "cannot find symbol method getGL()"(现在也是 getGLU()),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/617429/
我正在尝试学习如何使用 JoGL,由于某种原因,尽管导入了所有这些内容,我还是收到了此错误: import javax.media.opengl.*;import javax.media.opengl
我是一名优秀的程序员,十分优秀!