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 "module.h"
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include "glew.h"
|
#include "opengl.h"
|
||||||
|
|
||||||
class CrappyModule : public Module
|
class CrappyModule : public Module
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FORWARDMODULE_H
|
#ifndef FORWARDMODULE_H
|
||||||
#define FORWARDMODULE_H
|
#define FORWARDMODULE_H
|
||||||
|
|
||||||
#include "glew.h"
|
#include "opengl.h"
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FRAMEBUFFER_H
|
#ifndef FRAMEBUFFER_H
|
||||||
#define FRAMEBUFFER_H
|
#define FRAMEBUFFER_H
|
||||||
|
|
||||||
#include "glew.h"
|
#include "opengl.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class Texture;
|
class Texture;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef MESH_H
|
#ifndef MESH_H
|
||||||
#define MESH_H
|
#define MESH_H
|
||||||
|
|
||||||
#include "glew.h"
|
#include "opengl.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <glm/vec3.hpp>
|
#include <glm/vec3.hpp>
|
||||||
#include <glm/vec2.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
|
#ifndef POSTEFFECTMODULE_H
|
||||||
#define POSTEFFECTMODULE_H
|
#define POSTEFFECTMODULE_H
|
||||||
|
|
||||||
#include "glew.h"
|
#include "opengl.h"
|
||||||
#include <glm/mat4x4.hpp>
|
#include <glm/mat4x4.hpp>
|
||||||
#include <glm/vec3.hpp>
|
#include <glm/vec3.hpp>
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#include "glew.h"
|
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef SHADER_H
|
#ifndef SHADER_H
|
||||||
#define SHADER_H
|
#define SHADER_H
|
||||||
|
|
||||||
#include "glew.h"
|
#include "opengl.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <glm/fwd.hpp>
|
#include <glm/fwd.hpp>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef SKYBOXMODULE_H
|
#ifndef SKYBOXMODULE_H
|
||||||
#define SKYBOXMODULE_H
|
#define SKYBOXMODULE_H
|
||||||
|
|
||||||
#include "glew.h"
|
#include "opengl.h"
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#include "glew.h"
|
|
||||||
#include <GL/gl.h>
|
|
||||||
#include <GL/glext.h>
|
|
||||||
#include <cstdio>
|
|
||||||
#include "sparrowrenderer.h"
|
#include "sparrowrenderer.h"
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
#include "framebuffer.h"
|
#include "framebuffer.h"
|
||||||
@ -14,6 +11,15 @@
|
|||||||
#include "scene.h"
|
#include "scene.h"
|
||||||
#include "Version.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
|
// main methods
|
||||||
|
|
||||||
bool SparrowRenderer::modernOpenglAvailable = false;
|
bool SparrowRenderer::modernOpenglAvailable = false;
|
||||||
@ -45,10 +51,33 @@ void SparrowRenderer::initGL(int w, int h, bool forceCrappy)
|
|||||||
glGetString(GL_RENDERER),
|
glGetString(GL_RENDERER),
|
||||||
glGetString(GL_VENDOR));
|
glGetString(GL_VENDOR));
|
||||||
#endif
|
#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);
|
resizeGL(w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SparrowRenderer::~SparrowRenderer()
|
||||||
|
{
|
||||||
|
if(m_quadVAO != 0)
|
||||||
|
{
|
||||||
|
glDeleteVertexArrays(1, &m_quadVAO);
|
||||||
|
glDeleteBuffers(1, &m_quadVBO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SparrowRenderer::resizeGL(int w, int h)
|
void SparrowRenderer::resizeGL(int w, int h)
|
||||||
{
|
{
|
||||||
width = w;
|
width = w;
|
||||||
@ -74,6 +103,14 @@ bool SparrowRenderer::isModernOpenGLAvailable()
|
|||||||
return modernOpenglAvailable;
|
return modernOpenglAvailable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// utils
|
||||||
|
void SparrowRenderer::drawQuad()
|
||||||
|
{
|
||||||
|
glBindVertexArray(m_quadVAO);
|
||||||
|
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||||
|
glBindVertexArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
// scene methods
|
// scene methods
|
||||||
|
|
||||||
void SparrowRenderer::setScene(Scene* myScene)
|
void SparrowRenderer::setScene(Scene* myScene)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef SPARROWRENDERER_H
|
#ifndef SPARROWRENDERER_H
|
||||||
#define SPARROWRENDERER_H
|
#define SPARROWRENDERER_H
|
||||||
|
|
||||||
#include "glew.h"
|
#include "opengl.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <glm/vec3.hpp>
|
#include <glm/vec3.hpp>
|
||||||
@ -17,6 +17,8 @@ public:
|
|||||||
SparrowRenderer() :
|
SparrowRenderer() :
|
||||||
m_scene(NULL)
|
m_scene(NULL)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
~SparrowRenderer();
|
||||||
|
|
||||||
// main methods
|
// main methods
|
||||||
void initGL(int w, int h, bool forceCrappy = false);
|
void initGL(int w, int h, bool forceCrappy = false);
|
||||||
@ -24,6 +26,9 @@ public:
|
|||||||
void renderGL();
|
void renderGL();
|
||||||
|
|
||||||
static bool isModernOpenGLAvailable();
|
static bool isModernOpenGLAvailable();
|
||||||
|
|
||||||
|
// utils
|
||||||
|
static void drawQuad();
|
||||||
|
|
||||||
// scene methods
|
// scene methods
|
||||||
void setScene(Scene* myScene);
|
void setScene(Scene* myScene);
|
||||||
@ -32,6 +37,9 @@ protected:
|
|||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
|
|
||||||
|
static GLuint m_quadVAO;
|
||||||
|
static GLuint m_quadVBO;
|
||||||
|
|
||||||
Scene* m_scene;
|
Scene* m_scene;
|
||||||
|
|
||||||
static bool modernOpenglAvailable;
|
static bool modernOpenglAvailable;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef TEXTURE_H
|
#ifndef TEXTURE_H
|
||||||
#define TEXTURE_H
|
#define TEXTURE_H
|
||||||
|
|
||||||
#include "glew.h"
|
#include "opengl.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class Image;
|
class Image;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef TEXTUREBLUR_H
|
#ifndef TEXTUREBLUR_H
|
||||||
#define TEXTUREBLUR_H
|
#define TEXTUREBLUR_H
|
||||||
|
|
||||||
#include "glew.h"
|
#include "opengl.h"
|
||||||
|
|
||||||
class FrameBuffer;
|
class FrameBuffer;
|
||||||
class Shader;
|
class Shader;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user