Вопрос: Как сделать куб в OpenGL?

 

OpenGL в C++. Часть 1. Создание лабиринта используя OpenGL.

Видео взято с канала: Invizor GameAndCode


 

OpenGL Tutorial 6 | Rotation and Hidden Surface Removal | OpenGL in C++ with the GLUT library

Видео взято с канала: The Pentamollis Project


 

Примитивы OpenGL: точка, треугольник, квадрат, полигон и их виды

Видео взято с канала: Captain Jack


 

OpenGL. 16 Добавляем текстуру на куб (Windows+Linux)

Видео взято с канала: mxhpns: Программирование на Си от эксперта


 

КАК СОЗДАТЬ КУБ

Видео взято с канала: MrHuempolbu


 

OpenGL Tutorial 23 Drawing A Cube

Видео взято с канала: Sonar Systems


 

Урок 30. C++ Вращающийся куб

Видео взято с канала: Anton Te


11 комментариев

  • Great video mate, i was wondering apart from your videos as my learning reference if you could recommend me some text to visit and understand. I already read official and superbible books. Even they weren’t enough. So please if you recommend a book. Thanks.

  • Это, безусловно, абсолютно не мое дело, но может взять современный API, с шейдерами? Просто glBegin/end устарели примерно 15 лет назад…
    Ну и исходный код можно на github/bitbucket выкладывать, чтобы проще было скачивать на свою машину

  • я его себе на весь экран растянул =) так у меня сразу в глазах глючить начало (прикольно иногда к космосу подключится)

    а можно как-нибудь его стороны закрасить разными цветами, но так что-бы они были полу прозрачными?

  • Помоги мне пожалуйста.
    Компилятор прям в свмом начале выдает ошибку:

    2 21 C:\Users\Echochrome\Desktop\Íîâàÿ ïàïêà (5)\Áåçûìÿííûé1.cpp [Error] GL/glut.h: No such file or directory

    Для справки компилятор dev cpp, очень важно скомпилировать именно на нем

  • перепечатал в visual express 2012, одни ошибки Ошибка 1 error C1083: Не удается открыть файл включение: GL/glut.h: No such file or directory c:\users\atariki\documents\visual studio 2012\projects\rotation cube\rotation cube\cube.cpp 3 1 rotation cube

  • #include

    void display() {
    glClearColor(0.0, 0.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    //-
    glBegin(GL_POLYGON);
    glColor3f(0.3, 0.1, 1);
    glVertex2f(-0.5, 0.4);

    glColor3f(0.7, 0.3, 0.1);
    glVertex2f(-0.2, 0.4);

    glColor3f(0.7, 0.6, 0.6);
    glVertex2f(0.5, -0.4);

    glColor3f(0.1, 0.2, 0.1);
    glVertex2f(-0.2, -0.4);

    glColor3f(0.4, 0.4, 0.4);
    glVertex2f(0.1, -0.7);

    glColor3f(0.7, 0.1, 0.1);
    glVertex2f(-0.9, -0.1);

    glEnd();

    glutSwapBuffers();
    }

    int main(int argc, char **argv) {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
    glutInitWindowPosition(100, 100);
    glutInitWindowSize(1200, 800);
    glutCreateWindow(«0310»);

    glutDisplayFunc(display);
    glutMainLoop();

    return 0;
    }

  • Hey Sonar systems love this video but really want to know how centerposx halfsidelength, centerposy and so on builds the cube. Very curious I know this is a late comment I am pretty new to OpenGL and would appreciate a response from anyone watching this video in 2020.

  • #include
    #include

    int a = 0;
    float b = 0;

    void display()
    {
    glClear(GL_COLOR_BUFFER_BIT);
    glPushMatrix();
    glTranslatef(0, 0, -300);
    glRotatef(a, sin(b / 100) + 1, cos(b / 200) + 1, sin(b / 300) + 1);
    glBegin(GL_LINE_STRIP);
    glVertex3f(-50, -50, -50);
    glVertex3f(50, -50, -50);
    glVertex3f(50, 50, -50);
    glVertex3f(-50, 50, -50);
    glVertex3f(-50, -50, -50);
    glEnd();
    glBegin(GL_LINE_STRIP);
    glVertex3f(-50, -50, 50);
    glVertex3f(50, -50, 50);
    glVertex3f(50, 50, 50);
    glVertex3f(-50, 50, 50);
    glVertex3f(-50, -50, 50);
    glEnd();
    glBegin(GL_LINES);
    glVertex3f(-50, -50, 50);
    glVertex3f(-50, -50, -50);
    glVertex3f(50, -50, 50);
    glVertex3f(50, -50, -50);
    glVertex3f(50, 50, 50);
    glVertex3f(50, 50, -50);
    glVertex3f(-50, 50, 50);
    glVertex3f(-50, 50, -50);
    glEnd();
    glPopMatrix();
    glutSwapBuffers();
    }

    void timer(int = 0)
    {
    ++a;
    ++b;
    display();
    glutTimerFunc(10, timer, 0);
    }

    int main(int argc, char **argv)
    {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
    glutInitWindowSize(200, 200);
    glutInitWindowPosition(20, 810);
    glutCreateWindow(«Cube»);
    glClearColor(0, 0, 0, 1.0);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    //glOrtho (-100, 100, -100, 100, -100, 100);
    gluPerspective(45, 1, 0, 100);
    glutDisplayFunc(display);
    timer();
    glutMainLoop();
    }

  • Здравствуйте, у меня возникла проблема, когда я пытался скомпилировать эту программу у меня выдало ошибку, о том что функция gluPerspective не описана, хотя все примеры до этого у меня компилировались и запускались, может вы поможете или расскажите как установить библиотеки, если я работаю в Ubuntu?

  • Thank you so much for this series. Its a week to exams & i had erroneously assumed a unit called «computer graphics» would be a bunch of theories like multimedia systems was the previous semester. It didn’t help that the teacher never issued any quizzes tests or assignments. It didn’t help that i didn’t attend their classes. Yesterday i opened their notes for the first time and i was shocked. This series has helped me catch up in just a day, I’ve never worked with graphics before save for a few java swing and awt apps. Keep up the good work Sir.