Java崩溃?使用OpenGL

时间:2014-08-22 22:04:49

标签: java opengl lwjgl

最近每当我运行OpenGL游戏时,我都会遇到这个奇怪的错误:

我在OS X上。

这个错误是什么意思?

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00000001276eff9f, pid=461, tid=5379
#
# JRE version: Java(TM) SE Runtime Environment (8.0_11-b12) (build 1.8.0_11-b12)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.11-b03 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [GLEngine+0x15bf9f]  gleRunVertexSubmitImmediate+0x27ef
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/amit/workspace/Evox Voxel Engine GL 2.1/hs_err_pid461.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

每当我绘制时都会生成此错误:

            GL11.glDrawElements(GL11.GL_TRIANGLES, indicesCount,
                    GL11.GL_UNSIGNED_INT, 0);

1 个答案:

答案 0 :(得分:0)

这是我的问题:

我正在使用全局指数VBO用于所有块,因为我认为如果我绘制的指数比我实际拥有的多一些并不重要。事实证明这导致某种缓冲区溢出或读/写无效地址导致整个游戏崩溃。

因此,本课程总是完全计算您对EACH对象的索引数量,然后将其提供给draw方法,否则可能会导致奇怪的行为。

另一个可能的问题是你的索引VBO受其类型的限制,例如byte / short / int。如果索引超过byte / short / int可以容纳的数量,这可能会导致游戏崩溃。

快乐的节目。