2023-02-23 19:51:02 +01:00
|
|
|
/*
|
|
|
|
* Gem-graph OpenGL experiments
|
|
|
|
*
|
|
|
|
* Desc: OpenGL utils header
|
|
|
|
*
|
|
|
|
* Copyright (C) 2023 Arthur Menges <arthur.menges@a-lec.org>
|
|
|
|
* Copyright (C) 2023 Adrien Bourmault <neox@a-lec.org>
|
|
|
|
*
|
|
|
|
* This file is part of Gem-graph.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
2023-06-09 15:03:28 +02:00
|
|
|
// v5----- v4
|
2023-02-23 19:51:02 +01:00
|
|
|
// /| /|
|
|
|
|
// v1------v0|
|
|
|
|
// | | | |
|
2023-06-09 15:03:28 +02:00
|
|
|
// | |v6---|-|v7
|
2023-02-23 19:51:02 +01:00
|
|
|
// |/ |/
|
|
|
|
// v2------v3
|
|
|
|
//
|
2023-06-09 15:03:28 +02:00
|
|
|
// static GLfloat vertex_base[] = {
|
|
|
|
// 0.5, 0.5, 0.5, // v0
|
|
|
|
// -0.5, 0.5, 0.5, // v1
|
|
|
|
// -0.5,-0.5, 0.5, // v2
|
|
|
|
// 0.5,-0.5, 0.5, // v3
|
|
|
|
// 0.5, 0.5,-0.5, // v4
|
|
|
|
// -0.5, 0.5,-0.5, // v5
|
|
|
|
// -0.5,-0.5,-0.5, // v6
|
|
|
|
// 0.5,-0.5,-0.5, // v7
|
|
|
|
// };
|
|
|
|
static GLfloat vertex_base_ignore[] = {
|
|
|
|
0.5, .0f, .0f, // v0
|
|
|
|
-0.5, .0f, .0f, // v1
|
|
|
|
-0.5,-0.5, .0f, // v2
|
|
|
|
0.5,-0.5, .0f, // v3
|
|
|
|
0.5, .0f,-.0f, // v4
|
|
|
|
-0.5, .0f,-.0f, // v5
|
|
|
|
-0.5,-0.5,-.0f, // v6
|
|
|
|
0.5,-0.5,-.0f, // v7
|
2023-02-23 19:51:02 +01:00
|
|
|
};
|
|
|
|
|
2023-06-09 15:03:28 +02:00
|
|
|
static GLubyte indices_ignore[] = {
|
2023-02-23 19:51:02 +01:00
|
|
|
0,1,
|
|
|
|
1,2,
|
|
|
|
2,3,
|
|
|
|
3,0,
|
|
|
|
|
|
|
|
4,5,
|
|
|
|
5,6,
|
|
|
|
6,7,
|
|
|
|
7,4,
|
|
|
|
|
|
|
|
0,4,
|
|
|
|
1,5,
|
|
|
|
2,6,
|
|
|
|
3,7,
|
2023-06-09 15:03:28 +02:00
|
|
|
|
|
|
|
// 2,4,
|
|
|
|
// 3,5,
|
|
|
|
// 0,6,
|
|
|
|
// 1,7,
|
|
|
|
|
2023-02-23 19:51:02 +01:00
|
|
|
};
|
2023-06-09 15:03:28 +02:00
|
|
|
// v5------v4
|
|
|
|
// /| /|
|
|
|
|
// v1------v0|
|
|
|
|
// | | | |
|
|
|
|
// | v6----|-v7
|
|
|
|
// |/ |/
|
|
|
|
// v2------v3
|
|
|
|
//
|
2023-02-23 19:51:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
static GLfloat color_base[] = {
|
|
|
|
0.8, 0.8, 0.8, // blanc
|
|
|
|
0.8, 0.8, 0.2, // jaune
|
|
|
|
0.8, 0.2, 0.2, // rouge
|
|
|
|
0.2, 0.2, 0.2, // noir
|
|
|
|
0.2, 0.2, 0.2, // gris
|
|
|
|
0.2, 0.8, 0.8, // cyan
|
|
|
|
0.2, 0.8, 0.2, // vert
|
|
|
|
0.8, 0.2, 0.8, // magenta
|
|
|
|
};
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2023-06-09 15:03:28 +02:00
|
|
|
|