小编dcu*_*bix的帖子

LWJGL不会在NetBeans之外工作

我无法弄清楚为什么我的LWJGL3应用程序不能在NetBeans之外运行.我将所有本地人复制到同一个目录.作为Jar,如果我直接从Jar运行,我会收到错误:

[LWJGL] GLFW_API_UNAVAILABLE error
    Description : WGL: The driver does not appear to support OpenGL
    Stacktrace  :
            org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:1146)
            org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1227)
            com.alpha.core.Window.Init(Window.java:101)
            com.alpha.core.Game.GameLoop(Game.java:33)
            com.alpha.core.Game.Start(Game.java:23)
            com.alpha.tests.Main.main(Main.java:11)
Exception in thread "main" java.lang.RuntimeException: Failed to create the GLFW window
    at com.alpha.core.Window.Init(Window.java:103)
    at com.alpha.core.Game.GameLoop(Game.java:33)
    at com.alpha.core.Game.Start(Game.java:23)
    at com.alpha.tests.Main.main(Main.java:11)
Run Code Online (Sandbox Code Playgroud)

图形驱动程序更新,如果我从IDE运行应用程序,所有的DLL都在那里,我不知道是什么导致这个.

任何帮助将不胜感激,提前感谢!

java opengl netbeans lwjgl

7
推荐指数
1
解决办法
356
查看次数

C++无法增加变量

我正在为一个小型游戏引擎开发一个动画类,由于某种原因,帧计数器不想增加,它会一直停留在0或1.

这是Animation :: Step代码(这里应该发生增量):

void Animation::Step()
{
    ...

    time += (float)glfwGetTime();
    if (time >= Speed)
    {
        time = 0;
        if (f++ >= count - 1)
        {
            ...
        }
    }

    // Here I do some math to get a clip rectangle...

    ...
}
Run Code Online (Sandbox Code Playgroud)

现在这是调用Animation :: Step的部分:

inline void DrawAnimation(Animation ani, Vec2 pos, BlendMode mode, DrawTextureAttributes attr)
{
    ani.Step();

    ...
    // draw texture
}
Run Code Online (Sandbox Code Playgroud)

并在游戏主循环中:

void on_render(Renderer r)
{
    DrawTextureAttributes attr;
    attr.Scale = Vec2(1.5);

    r.DrawAnimation(ani, Vec2(320, 240), BlendMode::Normal, attr);
}
Run Code Online (Sandbox Code Playgroud)

编辑:类定义:

class …
Run Code Online (Sandbox Code Playgroud)

c++

3
推荐指数
1
解决办法
985
查看次数

标签 统计

c++ ×1

java ×1

lwjgl ×1

netbeans ×1

opengl ×1