volray

diff src/sdr.h @ 0:b050ce167ff1

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 31 Mar 2012 02:08:42 +0300
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/sdr.h	Sat Mar 31 02:08:42 2012 +0300
     1.3 @@ -0,0 +1,49 @@
     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_shader(const char *src, unsigned int sdr_type);
    1.15 +void free_shader(unsigned int sdr);
    1.16 +
    1.17 +unsigned int load_vertex_shader(const char *fname);
    1.18 +unsigned int load_pixel_shader(const char *fname);
    1.19 +unsigned int load_shader(const char *src, unsigned int sdr_type);
    1.20 +
    1.21 +unsigned int get_vertex_shader(const char *fname);
    1.22 +unsigned int get_pixel_shader(const char *fname);
    1.23 +unsigned int get_shader(const char *fname, unsigned int sdr_type);
    1.24 +
    1.25 +int add_shader(const char *fname, unsigned int sdr);
    1.26 +int remove_shader(const char *fname);
    1.27 +
    1.28 +/* ---- gpu programs ---- */
    1.29 +unsigned int create_program(void);
    1.30 +unsigned int create_program_link(unsigned int vs, unsigned int ps);
    1.31 +unsigned int create_program_load(const char *vfile, const char *pfile);
    1.32 +void free_program(unsigned int sdr);
    1.33 +
    1.34 +void attach_shader(unsigned int prog, unsigned int sdr);
    1.35 +int link_program(unsigned int prog);
    1.36 +int bind_program(unsigned int prog);
    1.37 +
    1.38 +int set_uniform_int(unsigned int prog, const char *name, int val);
    1.39 +int set_uniform_float(unsigned int prog, const char *name, float val);
    1.40 +int set_uniform_float3(unsigned int prog, const char *name, float x, float y, float z);
    1.41 +int set_uniform_float4(unsigned int prog, const char *name, float x, float y, float z, float w);
    1.42 +int set_uniform_matrix4(unsigned int prog, const char *name, float *mat);
    1.43 +int set_uniform_matrix4_transposed(unsigned int prog, const char *name, float *mat);
    1.44 +
    1.45 +int get_attrib_loc(unsigned int prog, const char *name);
    1.46 +void set_attrib_float3(int attr_loc, float x, float y, float z);
    1.47 +
    1.48 +#ifdef __cplusplus
    1.49 +}
    1.50 +#endif	/* __cplusplus */
    1.51 +
    1.52 +#endif	/* SDR_H_ */