You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.0 KiB
53 lines
1.0 KiB
|
|
#pragma once |
|
|
|
#include <GL/glew.h> |
|
|
|
|
|
struct default_shader_program |
|
{ |
|
GLuint program_id; |
|
|
|
GLuint model_matrix_id; |
|
GLuint view_matrix_id; |
|
GLuint projection_matrix_id; |
|
GLuint normal_matrix_id; |
|
|
|
GLuint vertex_array_id; |
|
GLuint sampler_id; |
|
GLuint num_lights_id; |
|
}; |
|
|
|
struct simple_shader_program |
|
{ |
|
GLuint program_id; |
|
GLuint MVP_id; |
|
GLuint vertex_array_id; |
|
}; |
|
|
|
enum shader_type |
|
{ |
|
SIMPLE_SHADER = 0, |
|
DEFAULT_SHADER = 1 |
|
}; |
|
|
|
struct shader_wrapper |
|
{ |
|
shader_type type; |
|
default_shader_program* default_shader; |
|
simple_shader_program* simple_shader; |
|
}; |
|
|
|
|
|
// TODO: find a way to initialize different shaders with different |
|
// uniform layouts with a single function |
|
// look at using uniform blocks and retrieving locations with |
|
// glGetUniformBlockIndex() and their size with glGetActiveUniformBlockiv() |
|
// see chapter 2 in the red book |
|
simple_shader_program* |
|
shaderInitSimple(const char* vertex_code, const char* frag_code); |
|
|
|
default_shader_program* |
|
shaderInitDefault(const char* vertex_code, const char* frag_code); |
|
|
|
void shaderFree(uint program_id);
|
|
|