0
Я только что начал с freeGLUT сегодня, и я получил все, что было прекрасно. Я могу создать базовое окно, но всякий раз, когда я вызываю почти каждый метод рендеринга, компиляция терпит неудачу. Я использую следующий код:OpenGL: Не удается выполнить рендеринг с помощью freeGLUT? C++
#include "math_lib.h"
#include <stdlib.h>
#include <GL/freeglut.h>
void render(void);
int main(int argc, char** argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(100, 100);
glutInitWindowSize(640, 480);
glutCreateWindow("Simple GLUT Application");
glutDisplayFunc(render);
glutMainLoop();
}
void render(void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(1, 0, 0);
glVertex2f(-0.5, -0.5);
glColor3f(0, 1, 0);
glVertex2f(0.5, -0.5);
glColor3f(0, 0, 1);
glVertex2f(0.0, 0.5);
glEnd();
glutSwapBuffers();
}
И ошибка я получаю:
C:\Users\User\Dropbox\NetBeans Workspace\OpenGL_Testing/main.cpp:29: undefined reference to `[email protected]'
C:\Users\User\Dropbox\NetBeans Workspace\OpenGL_Testing/main.cpp:31: undefined reference to `[email protected]'
C:\Users\User\Dropbox\NetBeans Workspace\OpenGL_Testing/main.cpp:32: undefined reference to `[email protected]'
C:\Users\User\Dropbox\NetBeans Workspace\OpenGL_Testing/main.cpp:33: undefined reference to `[email protected]'
C:\Users\User\Dropbox\NetBeans Workspace\OpenGL_Testing/main.cpp:34: undefined reference to `[email protected]'
C:\Users\User\Dropbox\NetBeans Workspace\OpenGL_Testing/main.cpp:35: undefined reference to `[email protected]'
C:\Users\User\Dropbox\NetBeans Workspace\OpenGL_Testing/main.cpp:36: undefined reference to `[email protected]'
C:\Users\User\Dropbox\NetBeans Workspace\OpenGL_Testing/main.cpp:37: undefined reference to `[email protected]'
C:\Users\User\Dropbox\NetBeans Workspace\OpenGL_Testing/main.cpp:38: undefined reference to `[email protected]'
Так что я делаю что-то неправильно, или я просто отсутствует импорт?
Я не делаю этого файла нигде на моем компьютере? Он поставляется с файлом freeglut zip? – CoderTheTyler
Подожди, неважно ... Я нашел его! Просто я снова глуп. Спасибо, хотя! Я буду защищать, когда смогу – CoderTheTyler