Простой пример OpenGL вылетает

Я только что скопировал & вставил мой первый проект OpenGL из tutroial (ууу!).
Код очень прост:

#include "freeglut.h"

void displayMe(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}

int main(int argc, char** argv)
{
glutInit(&argc, argv);

glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(300, 300);
glutInitWindowPosition(500, 500);
glutCreateWindow("Test");          /// CRASHES HERE!
glutDisplayFunc(displayMe);
glutMainLoop();

return 0;
}

Я использую последние версии:

  • Visual Studio (2017)
  • Freeglut x86 (3.0.0)
  • GLEW x86 (2.0.0)
  • Драйвер NVIDIA для моего Geforce 1070

Но мое приложение (построенное как x86) сразу падает, за исключением следующего:

Исключение, выброшенное в 0x6907EE5F (nvoglv32.dll) в MyTest.exe:
0xC0000005: Место чтения нарушения доступа 0x00000250.

РЕДАКТИРОВАТЬ:
Сбой происходит в этой строке:

glutCreateWindow ( «Тест»);

РЕДАКТИРОВАТЬ 2
Я просто попробовал другую структуру. Теперь я использую GLFW вместо freeGLUT.
Приложение тоже вылетает при создании окна 🙁

#include <glfw3.h>

int main(void)
{
GLFWwindow* window;

/* Initialize the library */
if (!glfwInit())
return -1;

/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL); // CRASH HERE
if (!window)
{
glfwTerminate();
return -1;
}

/* Make the window's context current */
glfwMakeContextCurrent(window);

/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);

/* Swap front and back buffers */
glfwSwapBuffers(window);

/* Poll for and process events */
glfwPollEvents();
}

glfwTerminate();
return 0;
}

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector