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:
56
sources/GL_STUFF/EFFECTS/Scene.cpp
Executable file
56
sources/GL_STUFF/EFFECTS/Scene.cpp
Executable file
@@ -0,0 +1,56 @@
|
||||
#include "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;
|
||||
}
|
||||
Reference in New Issue
Block a user