Skip to content

Commit

Permalink
added comments to shader .h and .c files
Browse files Browse the repository at this point in the history
  • Loading branch information
humanshell committed Feb 8, 2016
1 parent 12af38e commit 0d0b87a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
25 changes: 25 additions & 0 deletions include/glisy/shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,38 @@
"precision highp float;" \
GLISY_GLSL_SHADER_HEADER \

/**
* Glisy Shader structure type.
*/

typedef struct glisy_shader glisy_shader;
struct glisy_shader {

// Shader GLSL source buffer.
char source[BUFSIZ];

// Shader source type.
GLuint type;

// Shader source ID.
GLuint id;

};

/**
* Glisy Shader initializer.
* @param shader - pointer to a Glisy Shader struct
* @param type - GL vertex or fragment shader type enum
* @param source - pointer to a string buffer containing GLSL source
*
* This function uses glCreateShader(), glShaderSource(), and glShaderCompile()
* to initializes a Glisy Vertex or Fragment Shader that can be attached to a
* Glisy Program. It will return false if glGetShaderiv() reports a failure to
* compile, shader is NULL, or shader->id is 0. Otherwise it will return true.
* if glGetShaderiv() reports a failure glDeleteShader() is called to destroy
* the shader.
*/

GLboolean
glisy_shader_init(glisy_shader *shader, GLuint type, const char *source);

Expand Down
4 changes: 4 additions & 0 deletions src/shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#include <glisy/gl.h>
#include <glisy/shader.h>

/**
* Glisy Shader initializer.
*/

GLboolean
glisy_shader_init(glisy_shader *shader, GLuint type, const char *source) {
GLint isCompiled = 0;
Expand Down

0 comments on commit 0d0b87a

Please sign in to comment.