2017-03-16 47 views
0

所以我正在按照ThinMatrix關於LWJGL的youtube教程。 我檢查了幾次,如果我的代碼與他的任何不同,並沒有發現任何不同。我試圖尋找答案,但是 - 什麼都沒有。LWJGL - 遵循教程,但我得到一個關於本機代碼的錯誤

我收到的錯誤是這樣的:

# 
# A fatal error has been detected by the Java Runtime Environment: 
# 
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000052a0ab79, pid=7072, tid=0x0000000000001a9c 
# 
# JRE version: Java(TM) SE Runtime Environment (8.0_101-b13) (build 1.8.0_101-b13) 
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.101-b13 mixed mode windows-amd64 compressed oops) 
# Problematic frame: 
# C [nvoglv64.DLL+0x142ab79] 
# 
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows 
# 
# An error report file with more information is saved as: 
# C:\MY Games\Games\ThinMatrixTutorial-To Be Game Engine\hs_err_pid7072.log 
# 
# If you would like to submit a bug report, please visit: 
# http://bugreport.java.com/bugreport/crash.jsp 
# The crash happened outside the Java Virtual Machine in native code. 
# See problematic frame for where to report the bug. 
# 

我試圖修復它,並發現我在我的渲染,我怎麼過沒有預編譯錯誤,也沒有運行時錯誤的問題。

package renderEngine; 

import org.lwjgl.opengl.GL11; 
import org.lwjgl.opengl.GL20; 
import org.lwjgl.opengl.GL30; 

public class Renderer { 

    public void prepare() { 
     GL11.glClearColor(1, 0, 0, 1); 
     GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); 
    } 

    public void render(RawModel model) { 
     GL30.glBindVertexArray(model.getVertexCount()); 
     GL20.glEnableVertexAttribArray(0); 
     GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, model.getVertexCount()); 
     GL20.glDisableVertexAttribArray(0); 
     GL30.glBindVertexArray(0); 
    } 
} 

在此先感謝!

+0

我在這裏嘗試了一些解決方案,但都沒有工作。所以我試圖改變我的主要方法中的一些代碼和調用的順序,並且我修復了它。感謝那些試圖幫助! – TalSoy

回答

0

不知道發生了什麼報道hs_err_pid7072.log最有可能的罪魁禍首是:

  • 缺少你的顯卡OpenGL驅動程序。
  • 較舊的視頻驅動程序。
  • 使用帶有64位JVM的32位LWJGL /驅動程序或反之亦然
  • 使用您的視頻卡不支持的圖形功能。
1

我敢肯定

GL30.glBindVertexArray(model.getVertexCount()); 

不應該採取一個頂點數,而是一個頂點數組,這是通過創建法早些時候返回的ID。

相關問題