Add cglm library and add uniform setters for shader programs

This commit is contained in:
2020-06-27 20:10:33 +02:00
parent 8837de9e2a
commit 97d11cf2b0
6 changed files with 191 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
/*
* This file is part of Shimatta OpenGL.
*
* Foobar is free software: you can redistribute it and/or modify
* Shimatta OpenGL is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
@@ -16,6 +16,7 @@
#include <glib.h>
#include <glib-object.h>
#include <cglm/cglm.h>
G_BEGIN_DECLS
@@ -72,4 +73,36 @@ int shimatta_opengl_program_use(ShimattaOpenglProgram *program);
*/
gboolean shimatta_opengl_program_is_compiled(ShimattaOpenglProgram *program);
/**
* @brief Get the location of a uniform of a given shader program
* @param program Shader program
* @param uniform_name Name of the uniform parameter
* @return Location. -1 if error.
*/
int shimatta_opengl_program_get_uniform_location(ShimattaOpenglProgram *program, const char *uniform_name);
/**
* @brief Get the location of an Attribute of a given shader program
* @param program Shader program
* @param attrib_name Name of the attribute
* @return Location of attribute. -1 if error.
*/
int shimatta_opengl_program_get_attrib_location(ShimattaOpenglProgram *program, const char *attrib_name);
void shimatta_opengl_program_set_uniform_float(ShimattaOpenglProgram *program, const char *uniform, float value);
void shimatta_opengl_program_set_uniform_int(ShimattaOpenglProgram *program, const char *uniform, int value);
void shimatta_opengl_program_set_uniform_vec2(ShimattaOpenglProgram *program, const char *uniform, vec2 value);
void shimatta_opengl_program_set_uniform_vec3(ShimattaOpenglProgram *program, const char *uniform, vec3 value);
void shimatta_opengl_program_set_uniform_vec4(ShimattaOpenglProgram *program, const char *uniform, vec4 value);
void shimatta_opengl_program_set_uniform_mat2(ShimattaOpenglProgram *program, const char *uniform, mat2 value);
void shimatta_opengl_program_set_uniform_mat3(ShimattaOpenglProgram *program, const char *uniform, mat3 value);
void shimatta_opengl_program_set_uniform_mat4(ShimattaOpenglProgram *program, const char *uniform, mat4 value);
G_END_DECLS