我刚开始使用LWJGL和OpenGL,我遇到了一个问题。我正在试图弄清楚如何使用我发现的游戏引擎为我正在制作的游戏绘制一条简单的线条。
这是我正在使用的引擎的链接:https://github.com/SilverTiger/SilenceEngine
在渲染器类中,我尝试添加此函数 -
public void drawLine(Point point, Point point2) {
GL11.glColor3f(0.0f, 1.0f, 0.2f);
GL11.glBegin(GL11.GL_LINES);
GL11.glVertex2d(point.x, point.y);
GL11.glVertex2d(point2.x, point2.y);
GL11.glEnd();
}
我得到的错误如下:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007fff32b524cd, pid=3016, tid=0x0000000000002548
#
# JRE version: Java(TM) SE Runtime Environment (8.0_131-b11) (build 1.8.0_131-b11)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.131-b11 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [lwjgl.dll+0x124cd]
#
# 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:\Users\sambu\workspace\NextGen Engine - 0.3.1\hs_err_pid3016.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.
#
[LWJGL] A function that is not available in the current context was called. The JVM will abort execution. Inspect the crash log to find the responsible Java frames.
我对此非常陌生,不知道如何解决这个问题。
答案 0 :(得分:1)
引擎中创建的窗口具有版本3.2的OpenGL上下文。在3.2版中,您无法调用旧的原始绘制调用。所有绘制调用都需要使用顶点数组和缓冲区完成。这是一个关于如何执行此操作的教程(请记住,这是用C ++编写的):Draw Your First Triangle。这是关于入门的引擎论坛(称为新手问题)。 Forum