ld33_umonster
diff src/sdr.h @ 0:4a6683050e29
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 22 Aug 2015 07:15:00 +0300 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/sdr.h Sat Aug 22 07:15:00 2015 +0300 1.3 @@ -0,0 +1,52 @@ 1.4 +#ifndef SDR_H_ 1.5 +#define SDR_H_ 1.6 + 1.7 +#ifdef __cplusplus 1.8 +extern "C" { 1.9 +#endif /* __cplusplus */ 1.10 + 1.11 +/* ---- shaders ---- */ 1.12 +unsigned int create_vertex_shader(const char *src); 1.13 +unsigned int create_pixel_shader(const char *src); 1.14 +unsigned int create_tessctl_shader(const char *src); 1.15 +unsigned int create_tesseval_shader(const char *src); 1.16 +unsigned int create_geometry_shader(const char *src); 1.17 +unsigned int create_shader(const char *src, unsigned int sdr_type); 1.18 +void free_shader(unsigned int sdr); 1.19 + 1.20 +unsigned int load_vertex_shader(const char *fname); 1.21 +unsigned int load_pixel_shader(const char *fname); 1.22 +unsigned int load_tessctl_shader(const char *fname); 1.23 +unsigned int load_tesseval_shader(const char *fname); 1.24 +unsigned int load_geometry_shader(const char *fname); 1.25 +unsigned int load_shader(const char *src, unsigned int sdr_type); 1.26 + 1.27 +int add_shader(const char *fname, unsigned int sdr); 1.28 +int remove_shader(const char *fname); 1.29 + 1.30 +/* ---- gpu programs ---- */ 1.31 +unsigned int create_program(void); 1.32 +unsigned int create_program_link(unsigned int sdr0, ...); 1.33 +unsigned int create_program_load(const char *vfile, const char *pfile); 1.34 +void free_program(unsigned int sdr); 1.35 + 1.36 +void attach_shader(unsigned int prog, unsigned int sdr); 1.37 +int link_program(unsigned int prog); 1.38 +int bind_program(unsigned int prog); 1.39 + 1.40 +int set_uniform_int(unsigned int prog, const char *name, int val); 1.41 +int set_uniform_float(unsigned int prog, const char *name, float val); 1.42 +int set_uniform_float2(unsigned int prog, const char *name, float x, float y); 1.43 +int set_uniform_float3(unsigned int prog, const char *name, float x, float y, float z); 1.44 +int set_uniform_float4(unsigned int prog, const char *name, float x, float y, float z, float w); 1.45 +int set_uniform_matrix4(unsigned int prog, const char *name, float *mat); 1.46 +int set_uniform_matrix4_transposed(unsigned int prog, const char *name, float *mat); 1.47 + 1.48 +int get_attrib_loc(unsigned int prog, const char *name); 1.49 +void set_attrib_float3(int attr_loc, float x, float y, float z); 1.50 + 1.51 +#ifdef __cplusplus 1.52 +} 1.53 +#endif /* __cplusplus */ 1.54 + 1.55 +#endif /* SDR_H_ */