updated makefile for supporting different target architectures

use "ARCH=arch_name make"

restructured project folder, implementations and headers together under sources/
This commit is contained in:
beno
2026-03-16 00:10:52 +01:00
parent 6c125fb35e
commit bbede61723
73 changed files with 786 additions and 379 deletions

View File

@@ -0,0 +1,54 @@
/*
#include <GL/glew.h>
*/
#include <GLES2/gl2.h>
#include "ReelManager.h"
#include <vector>
/* equals stdlib.h from C */
#include <cstdlib>
ReelManager::ReelManager(unsigned int textureNumber, unsigned int width, unsigned int height) {
TEXTURE_NUM = textureNumber;
textures = (GLuint*) malloc(TEXTURE_NUM * sizeof(GLuint));
glGenFramebuffers(1, &FBO);
glGenTextures(TEXTURE_NUM, textures);
for (int i = 0; i < TEXTURE_NUM; i++) {
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textures[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
}
glBindTexture(GL_TEXTURE_2D, 0);
}
void ReelManager::nextTexture() {
currentIndex = ++currentIndex % TEXTURE_NUM;
glBindFramebuffer(GL_FRAMEBUFFER, FBO);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textures[currentIndex], 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
void ReelManager::clearTexture() {
glBindFramebuffer(GL_FRAMEBUFFER, FBO);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textures[currentIndex], 0);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
GLuint ReelManager::getFBO() {
return FBO;
}
std::vector<GLuint> ReelManager::getTextures() {
std::vector<GLuint> vec = std::vector<GLuint>();
for (int i = currentIndex + 1 ; i < TEXTURE_NUM; i++) {
vec.push_back(textures[i]);
}
for (int i = 0; i <= currentIndex; i++) {
vec.push_back(textures[i]);
}
return vec;
}