- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 JOGL 和 SWT/AWT 桥编写一个 SWT 应用程序,并且尝试在 Composite
内创建多个 GLCanvas
对象,我'然后我尝试将其放入选项卡中。当它工作时,它看起来像这样:
但大多数时候(大约 75% 可能是随机的)它会崩溃并显示以下错误消息:
A fatal error has been detected by the Java Runtime Environment:
SIGSEGV (0xb) at pc=0x0024843a, pid=8618, tid=2345560944JRE version: 6.0_22-b22
Java VM: OpenJDK Server VM (20.0-b11 mixed mode linux-x86 )
Derivative: IcedTea6 1.10.2
Distribution: Ubuntu 11.04, package 6b22-1.10.2-0ubuntu1~11.04.1
Problematic frame: C
[libpthread.so.0+0x843a] __pthread_mutex_lock+0x11a
我也尝试过只使用一张 Canvas 而不是两张,但仍然遇到相同的随机崩溃。有时,我会收到以下错误消息:
java: tpp.c:63: __pthread_tpp_change_priority: Assertion `new_prio == -1 || (new_prio >= __sched_fifo_min_prio && new_prio <= __sched_fifo_max_prio)' failed.
大概存在线程问题,也许是竞争条件?奇怪的是,如果我尝试将复合 Material 直接放在外壳上而不是放在选项卡上,它工作正常(或者至少我没有看到它崩溃)。
相关代码如下所示:
tabFolder = new CTabFolder(shell, SWT.BORDER);
tabFolder.setSimple(false);
final Composite composite = new Composite(tabFolder, SWT.NONE);
composite.setLayout(new FillLayout());
new VisualizerCanvas(composite, MeshFactory.loadObj("meshes/teapot_sealed.obj"));
new VisualizerCanvas(composite, MeshFactory.loadObj("meshes/duck.obj"));
final CTabItem item = new CTabItem(tabFolder, SWT.CLOSE);
item.setText("Test");
item.setImage(new Image(display, "img/test.jpg"));
item.setControl(composite);
VisualizerCanvas
构造函数如下所示:
public VisualizerCanvas(Composite parent, Mesh mesh)
{
// Set up the canvas
GLProfile glProfile = GLProfile.getDefault();
GLCapabilities glCapabilities = new GLCapabilities(glProfile);
glCapabilities.setDoubleBuffered(true);
glCapabilities.setHardwareAccelerated(true);
glCanvas = new GLCanvas(glCapabilities);
glCanvas.addGLEventListener(this);
// Create the embedded AWT frame using the SWT/AWT bridge
Composite composite = new Composite(parent, SWT.EMBEDDED | SWT.BORDER | SWT.NO_BACKGROUND);
composite.setLayout(new FillLayout());
Frame frame = SWT_AWT.new_Frame(composite);
frame.add(glCanvas);
// Add an animator to automatically update the canvas at 30fps
animator = new FPSAnimator(glCanvas, 30);
animator.add(glCanvas);
animator.start();
this.mesh = MeshFactory.normalizeMesh(mesh);
}
我是否使用 SWT 小部件/复合 Material 做了一些不应该做的事情?
最佳答案
终于自己解决了这个问题。事实证明这确实是一个竞争条件 - 我正在 Linux 上的 Eclipse 中进行开发,我需要以下代码来防止 Linux 窗口事件丢失:
static {
GLProfile.initSingleton(false);
}
我已经将其放入我的 VisualizerCanvas
类中,但未放入我的 Visualizer
类中(第一段代码)。据推测,GLProfile
和 VisualizerCanvas
正在争夺 JVM 加载的机会,GLProfile
有时会获胜,从而导致崩溃。
关于java - 将 SWT 与 JOGL 结合使用时随机崩溃(竞争条件?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6738017/
我一定是愚蠢之类的,但我在网上查看了几个 JOGL 示例,它们在 JOGL 中使用了 GL 接口(interface)的 color3f 方法,但是编译器提示找不到该方法,当我检查时javadoc我确
我从 here 下载了 jogl 2.0 ,文件 jogl-all.jar ,并运行了一个取自 here 的简单代码示例: import java.awt.event.KeyEvent; import
嗨,大家好 我在 JOGL 项目中添加拾取对象时遇到了麻烦。 我知道这可以通过选择缓冲区来完成..但我找不到例子 任何人? 最佳答案 一般来说,正如您可能知道的那样,JOGL 代码直接从您可能在网络上
我找不到有关在 JOGL 中呈现交错顶点数组(不是 VBO)的正确方法的任何信息。具体来说,使用 glVertexAttribPointer() 似乎不允许指定交错数据(FloatBuffer)内的偏
鉴于我从 JOGAMP wiki 获得的这个简单示例,为什么鼠标坐标在 y 方向上偏离 40,在 x 方向上偏离 20?单击屏幕右下角会显示坐标 (620, 440),而不是像我期望的那样 (640,
我正在学习使用 JOGL,在学习本教程时遇到了问题: https://sites.google.com/site/justinscsstuff/jogl-tutorial-1 https://site
我目前正在通过使用 JOGL 库(openGL 的 java 包装器)来探索 opengl,我用它来创建 2d/3d 图形。目前,我对通过“glutBitmapString”方法渲染的文本遇到了一些问
我在我的应用程序中使用 JOGL(OpenGL for Java),我需要一次在屏幕上绘制大量字符串,而我当前的解决方案太慢了。现在,我正在使用 Draw3D 方法使用 TextRenderer 绘制
我在使用 JOGL 时遇到问题。我这里有一本书用 C++ 解释了 OpenGL,但我的任务是用 JOGL 来做。我现在正在处理顶点缓冲区对象,这本书告诉我这一点: glGenBuffers(1, &m
我一直在尝试在独立的 Java 应用程序中使用 JOGL。我已经在 Android 上完成了 OpenGLES 的工作,并且刚刚将我的代码从 Android OpenGL 移植到了这个 Java 应用
我正在使用 JOGL 将 OpenGL SuperBible 演示翻译成 Java。第 12 章之前的所有演示都很顺利,但现在我陷入了阴影贴图。这是我的设置: public class ShadowM
我是 OpenGL 的新手,正在尝试使用 jogl。我可以毫无问题地绘制三角形,但是当我尝试绘制四边形(在许多教程中使用)时,Eclipse 一直告诉我 GL.GL_QUADS 无法解析。 gl.gl
我正在 JOGL 中构建一些东西,并且希望通过使用键盘或鼠标来使相机移动,这并不重要,只要相机可以围绕对象平移并可能放大和缩小即可。如果使用键盘/鼠标很困难,那么我也不介意使用应用程序中的某些按钮,例
我的问题是关于jogl的。我在 Canvas 显示中绘制图像。但我在图像上绘制多边形。我画多边形,但多边形是透明的,而不是颜色的。我可以做吗? gl.glBlendFunc(GL.GL_SRC_AL
我一直在尝试加载一个 bmp 图片以在我的程序中将其用作纹理 我使用了一个 IOStream 类来扩展 DataInputStream 以读取像素在照片中,此代码基于 C++ 的纹理加载器代码: //
在我的项目中,我希望为不同的对象使用一些纹理。 目前我有以下代码: private Texture[] textures = new Texture[1]; private int texture1
我已经使用 JOGL 几天了,现在这已成为一个主要障碍。我无法让形状以正确的 z 顺序绘制,而是按照它们提供给 OpenGL 的顺序绘制。 我花了最后几个小时研究这个问题,一般的解决方案(和我的 re
我正在尝试将 C# 应用程序移植到 Java,目前正在翻译 OpenGL 代码。在 C# 应用程序中使用了 OpenTK,在 Java 应用程序中我选择了 JOGL。当我尝试创建纹理时,程序抛出异常。
我最近才开始使用 JOGL,但我的第一个程序失败了,因为我无法获得 GL4 配置文件。 GLProfile test = GLProfile.get(GLProfile.GL4); 此行失败并显示错误
我正在使用 JOGL 渲染一些模型。我可以实现 KeyListener 接口(interface)并相应地接收击键。但问题是,按键后我无法再次刷新或渲染模型。我可以接收输入,但如何在 JOGL 中每次
我是一名优秀的程序员,十分优秀!