Я пытаюсь разобраться с opengl и у меня не получается нарисовать цилиндр.
#include <iostream>
#include <glew.h>
#include <GLFW/glfw3.h>
#include <cmath>
#include <glut.h>
#include <freeglut.h>
using namespace std;
int main() {
int result = glfwInit();
if(result == -1){
return 1;
}
GLFWwindow* window = glfwCreateWindow(1280, 720, "001", NULL, NULL);
if(window == NULL){
return 1;
}
glEnable(GL_DEPTH_TEST);
glfwMakeContextCurrent(window);
while(!glfwWindowShouldClose(window)){
GLUquadricObj qua;
qua = gluNewQuadric();
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glRotatef(0.05, 0.2, 0.8, 0);
glBegin( GL_TRIANGLE_FAN );
glColor3f(1.0f,1.0f,0.0f);
glTranslatef(0.0f,0.0f,-1.5f); // Центр цилиндра
gluQuadricDrawStyle(qua, GLU_LINE);
gluCylinder(qua,1.0f,1.0f,3.0f,32,32);
glVertex3d(0.0f, 0.0f, 0.0f );
int angle;
float r = 0.8;
for (angle = 0; angle <= 365; angle += 1){
double x = r cos(angle * 3.14 / 180);
double y = r * sin(angle * 3.14 / 180);
glVertex3d(x + 0.0f,0.0f, y + 0.0f);
}
glEnd();
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0;
}
cmd.exe /C "cd . && D:\jb\CLION2~1.1\bin\mingw\bin\G__~1.EXE -g CMakeFiles/untitled.dir/main.cpp.obj -o untitled.exe -Wl,--out-implib,libuntitled.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -LD:/libs/glfw-3.3.8.bin.WIN64/lib-mingw-w64 -LD:/libs/glut/lib/x64 -LD:/libs/glew-2.1.0/lib/Release/x64 -lglfw3 -lgdi32 -lopengl32 -lglew32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
D:\jb\CLion 2022.2.1\bin\mingw\bin/ld.exe: CMakeFiles/untitled.dir/main.cpp.obj:D:/libs/glut/include/GL/freeglut_std.h:637: undefined reference to `__imp___glutInitWithExit'
D:\jb\CLion 2022.2.1\bin\mingw\bin/ld.exe: CMakeFiles/untitled.dir/main.cpp.obj:D:/libs/glut/include/GL/freeglut_std.h:639: undefined reference to `__imp___glutCreateWindowWithExit'
D:\jb\CLion 2022.2.1\bin\mingw\bin/ld.exe: CMakeFiles/untitled.dir/main.cpp.obj:D:/libs/glut/include/GL/freeglut_std.h:641: undefined reference to `__imp___glutCreateMenuWithExit'
D:\jb\CLion 2022.2.1\bin\mingw\bin/ld.exe: CMakeFiles/untitled.dir/main.cpp.obj:D:/CLionProjects/untitled/main.cpp:24: undefined reference to `gluNewQuadric'
D:\jb\CLion 2022.2.1\bin\mingw\bin/ld.exe: CMakeFiles/untitled.dir/main.cpp.obj: in function `main':
D:/CLionProjects/untitled/main.cpp:31: undefined reference to `gluQuadricDrawStyle'
D:\jb\CLion 2022.2.1\bin\mingw\bin/ld.exe: D:/CLionProjects/untitled/main.cpp:32: undefined reference to `gluCylinder'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.