oglc/src/gfx.h

55 lines
1.1 KiB
C
Raw Normal View History

2021-07-04 02:53:37 +01:00
#pragma once
#define GLEW_STATIC
#include "GL/glew.h"
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#include "io.h"
#include "random.h"
2021-07-04 02:53:37 +01:00
struct Shaders
{
GLuint quad;
GLuint prepass;
GLuint lighting;
};
struct Textures
{
// texture that ultimately gets drawn to the framebuffer
GLuint target;
// TODO: blue noise, pink noise!
// noise texture to help with randomness
GLuint noise;
// additional view space information
//
// x depth
// y -
// z -
// w -
GLuint g0;
};
2021-07-10 16:16:01 +01:00
SDL_Window* gfxInit(int width, int height);
int compileShaders(struct Shaders *shaders);
GLuint compileQuadShaderProgram(const char* vsPath, const char* fsPath);
GLuint compileComputeShaderProgram(const char* csPath);
2021-07-04 02:53:37 +01:00
int createTextures(int width, int height, struct Shaders shaders, struct Textures* textures);
GLuint createNoiseTexture(int width, int height);
GLuint createTexture(int width, int height);
2021-07-10 16:16:01 +01:00
GLuint createWriteOnlyTexture(int width, int height);
GLuint compileShader(const char* path, GLenum type);
2021-07-10 16:16:01 +01:00
void printWorkGroupLimits();
2021-07-05 01:05:37 +01:00
// quad initialisation
2021-07-09 01:00:19 +01:00
void setVertexAttributes();
void initBuffers();