ported the University CGI demo from WINDOWS + GLUT + GLEW + GLU + OpenGL 4 to LINUX WAYLAND + EGL + GLES 2 with minimal cuts

This commit is contained in:
beno
2025-07-03 01:26:25 +02:00
commit 6c125fb35e
85 changed files with 91688 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
#include "../../HEADERS/EFFECTS/Scene.h"
extern "C" {
#include "../../GLES_3_1_compatibility.h"
}
/* REPLACED
#include <GL/freeglut.h>
*/
#include <glut.h>
#include <glm/gtc/matrix_transform.hpp>
#include <string>
#include <iostream>
using namespace glm;
Scene::Scene(int left, int top, int width, int height)
: PseudoContext { left, top, width, height }
{
glGenFramebuffers(1, &FBO);
glGenRenderbuffers(1, &depthRBO);
glBindRenderbuffer(GL_RENDERBUFFER, depthRBO);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
}
void Scene::draw() {
glBindFramebuffer(GL_FRAMEBUFFER, FBO);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, outputTexture, 0);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, depthRBO);
GLenum DrawBuffers[2] = { GL_COLOR_ATTACHMENT0, GL_DEPTH_STENCIL_ATTACHMENT };
glDrawBuffers(2, DrawBuffers);
}
void Scene::setOutTexture(GLuint outTexture) {
outputTexture = outTexture;
}
void Scene::keyPress(unsigned char key, int x, int y) {
switch (key)
{
case 27:
exit(0);
break;
default:
break;
}
}
GLuint Scene::getFrameBuffer() {
return this->FBO;
}