2

我在使用 32 位 MSVC 2010 的 Windows 7(64 位)上。

AFAIK,我已将所有库正确链接在一起:在以下选项中添加:

1. VC++ 目录 -> 添加包含目录 :C:\glfw-3.0.1.bin.WIN32\include

2.VC ++目录->库目录 添加:C:\glfw-3.0.1.bin.WIN32\lib-msvc100

3.链接器->输入->附加依赖 glfw3.lib opengl32.lib user32.lib

我还将库文件夹中的 .dll 文件放入我的 system32 文件夹以进行默认执行。

当我编译测试应用程序时:

#include <GLFW/glfw3.h>
#include <stdlib.h>
#include <stdio.h>
static void error_callback(int error, const char* description)
{
    fputs(description, stderr);
}
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
    if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
        glfwSetWindowShouldClose(window, GL_TRUE);
}
int main(void)
{
    GLFWwindow* window;
    glfwSetErrorCallback(error_callback);
    if (!glfwInit())
        exit(EXIT_FAILURE);
    window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);
    if (!window)
    {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }
    glfwMakeContextCurrent(window);
    glfwSetKeyCallback(window, key_callback);
    while (!glfwWindowShouldClose(window))
    {
        float ratio;
        int width, height;
        glfwGetFramebufferSize(window, &width, &height);
        ratio = width / (float) height;
        glViewport(0, 0, width, height);
        glClear(GL_COLOR_BUFFER_BIT);
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glOrtho(-ratio, ratio, -1.f, 1.f, 1.f, -1.f);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glRotatef((float) glfwGetTime() * 50.f, 0.f, 0.f, 1.f);
        glBegin(GL_TRIANGLES);
        glColor3f(1.f, 0.f, 0.f);
        glVertex3f(-0.6f, -0.4f, 0.f);
        glColor3f(0.f, 1.f, 0.f);
        glVertex3f(0.6f, -0.4f, 0.f);
        glColor3f(0.f, 0.f, 1.f);
        glVertex3f(0.f, 0.6f, 0.f);
        glEnd();
        glfwSwapBuffers(window);
        glfwPollEvents();
    }
    glfwDestroyWindow(window);
    glfwTerminate();
    exit(EXIT_SUCCESS);
}

执行后,控制台中会出现一条消息,说明:“WGL:找不到合适的像素格式”。

当我调试应用程序时,消息在执行“window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);" 行后显示

我不确定如何解决这个问题,有什么想法吗?

编辑:试图包含我能想到的尽可能多的细节......抱歉更新晚了

编辑编辑:需要的制造商驱动程序,而不是 Windows 自动安装的 Windows 驱动程序(尽管 Windows 显然仍在为正确的“x1350 和 x1500 系列”驱动程序安装驱动程序。

4

1 回答 1

2

Microsoft 提供的图形驱动程序要么不支持 OpenGL,要么仅提供非常过时或有限的支持,这种情况并不少见。他们最感兴趣的是让桌面正常工作,这在今天也意味着让 Direct3D 启动并运行,但肯定不是 OpenGL。

于 2013-10-28T21:38:14.040 回答