all opengl includes are now in opengl.h
This commit is contained in:
parent
3ed4b73c05
commit
d06c6d681d
@ -3,7 +3,7 @@
|
||||
|
||||
#include "module.h"
|
||||
#include <cstddef>
|
||||
#include "glew.h"
|
||||
#include "opengl.h"
|
||||
|
||||
class CrappyModule : public Module
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef FORWARDMODULE_H
|
||||
#define FORWARDMODULE_H
|
||||
|
||||
#include "glew.h"
|
||||
#include "opengl.h"
|
||||
#include "module.h"
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef FRAMEBUFFER_H
|
||||
#define FRAMEBUFFER_H
|
||||
|
||||
#include "glew.h"
|
||||
#include "opengl.h"
|
||||
#include <vector>
|
||||
|
||||
class Texture;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef MESH_H
|
||||
#define MESH_H
|
||||
|
||||
#include "glew.h"
|
||||
#include "opengl.h"
|
||||
#include <vector>
|
||||
#include <glm/vec3.hpp>
|
||||
#include <glm/vec2.hpp>
|
||||
|
6
src/opengl.h
Normal file
6
src/opengl.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef OPENGL_INCLUDE_H
|
||||
#define OPENGL_INCLUDE_H
|
||||
|
||||
#include "glew.h"
|
||||
|
||||
#endif // OPENGL_INCLUDE_H
|
@ -1,7 +1,7 @@
|
||||
#ifndef POSTEFFECTMODULE_H
|
||||
#define POSTEFFECTMODULE_H
|
||||
|
||||
#include "glew.h"
|
||||
#include "opengl.h"
|
||||
#include <glm/mat4x4.hpp>
|
||||
#include <glm/vec3.hpp>
|
||||
#include "module.h"
|
||||
|
@ -1,4 +1,3 @@
|
||||
#include "glew.h"
|
||||
#include "shader.h"
|
||||
#include <iostream>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef SHADER_H
|
||||
#define SHADER_H
|
||||
|
||||
#include "glew.h"
|
||||
#include "opengl.h"
|
||||
#include <string>
|
||||
#include <glm/fwd.hpp>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef SKYBOXMODULE_H
|
||||
#define SKYBOXMODULE_H
|
||||
|
||||
#include "glew.h"
|
||||
#include "opengl.h"
|
||||
#include "module.h"
|
||||
#include <string>
|
||||
|
||||
|
@ -1,8 +1,5 @@
|
||||
#include "glew.h"
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#include <cstdio>
|
||||
#include "sparrowrenderer.h"
|
||||
#include <cstdio>
|
||||
|
||||
#include "camera.h"
|
||||
#include "framebuffer.h"
|
||||
@ -14,6 +11,15 @@
|
||||
#include "scene.h"
|
||||
#include "Version.h"
|
||||
|
||||
GLuint SparrowRenderer::m_quadVAO = 0;
|
||||
GLuint SparrowRenderer::m_quadVBO = 0;
|
||||
|
||||
const GLfloat QUAD_VERTICES[] = {
|
||||
-1.0f, -1.0f,
|
||||
3.0f, -1.0f,
|
||||
-1.0f, 3.0f
|
||||
};
|
||||
|
||||
// main methods
|
||||
|
||||
bool SparrowRenderer::modernOpenglAvailable = false;
|
||||
@ -45,10 +51,33 @@ void SparrowRenderer::initGL(int w, int h, bool forceCrappy)
|
||||
glGetString(GL_RENDERER),
|
||||
glGetString(GL_VENDOR));
|
||||
#endif
|
||||
|
||||
|
||||
// allocate quad
|
||||
if(m_quadVAO == 0)
|
||||
{
|
||||
glGenVertexArrays(1, &m_quadVAO);
|
||||
glBindVertexArray(m_quadVAO);
|
||||
glGenBuffers(1, &m_quadVBO);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_quadVBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, 3 * 2 * sizeof(GLfloat), QUAD_VERTICES, GL_STATIC_DRAW);
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*2, NULL);
|
||||
glEnableVertexAttribArray(0);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
// set screen size
|
||||
resizeGL(w, h);
|
||||
}
|
||||
|
||||
SparrowRenderer::~SparrowRenderer()
|
||||
{
|
||||
if(m_quadVAO != 0)
|
||||
{
|
||||
glDeleteVertexArrays(1, &m_quadVAO);
|
||||
glDeleteBuffers(1, &m_quadVBO);
|
||||
}
|
||||
}
|
||||
|
||||
void SparrowRenderer::resizeGL(int w, int h)
|
||||
{
|
||||
width = w;
|
||||
@ -74,6 +103,14 @@ bool SparrowRenderer::isModernOpenGLAvailable()
|
||||
return modernOpenglAvailable;
|
||||
}
|
||||
|
||||
// utils
|
||||
void SparrowRenderer::drawQuad()
|
||||
{
|
||||
glBindVertexArray(m_quadVAO);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
// scene methods
|
||||
|
||||
void SparrowRenderer::setScene(Scene* myScene)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef SPARROWRENDERER_H
|
||||
#define SPARROWRENDERER_H
|
||||
|
||||
#include "glew.h"
|
||||
#include "opengl.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <glm/vec3.hpp>
|
||||
@ -17,6 +17,8 @@ public:
|
||||
SparrowRenderer() :
|
||||
m_scene(NULL)
|
||||
{}
|
||||
|
||||
~SparrowRenderer();
|
||||
|
||||
// main methods
|
||||
void initGL(int w, int h, bool forceCrappy = false);
|
||||
@ -24,6 +26,9 @@ public:
|
||||
void renderGL();
|
||||
|
||||
static bool isModernOpenGLAvailable();
|
||||
|
||||
// utils
|
||||
static void drawQuad();
|
||||
|
||||
// scene methods
|
||||
void setScene(Scene* myScene);
|
||||
@ -32,6 +37,9 @@ protected:
|
||||
int width;
|
||||
int height;
|
||||
|
||||
static GLuint m_quadVAO;
|
||||
static GLuint m_quadVBO;
|
||||
|
||||
Scene* m_scene;
|
||||
|
||||
static bool modernOpenglAvailable;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef TEXTURE_H
|
||||
#define TEXTURE_H
|
||||
|
||||
#include "glew.h"
|
||||
#include "opengl.h"
|
||||
#include <string>
|
||||
|
||||
class Image;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef TEXTUREBLUR_H
|
||||
#define TEXTUREBLUR_H
|
||||
|
||||
#include "glew.h"
|
||||
#include "opengl.h"
|
||||
|
||||
class FrameBuffer;
|
||||
class Shader;
|
||||
|
Loading…
x
Reference in New Issue
Block a user