erebus

diff src/sdr.h @ 0:4abdce1361b9

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 27 Apr 2014 16:02:47 +0300
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/sdr.h	Sun Apr 27 16:02:47 2014 +0300
     1.3 @@ -0,0 +1,76 @@
     1.4 +/*
     1.5 +Printblobs - halftoning display hack
     1.6 +Copyright (C) 2013  John Tsiombikas <nuclear@member.fsf.org>
     1.7 +
     1.8 +This program is free software: you can redistribute it and/or modify
     1.9 +it under the terms of the GNU General Public License as published by
    1.10 +the Free Software Foundation, either version 3 of the License, or
    1.11 +(at your option) any later version.
    1.12 +
    1.13 +This program is distributed in the hope that it will be useful,
    1.14 +but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.16 +GNU General Public License for more details.
    1.17 +
    1.18 +You should have received a copy of the GNU General Public License
    1.19 +along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1.20 +*/
    1.21 +#ifndef SDR_H_
    1.22 +#define SDR_H_
    1.23 +
    1.24 +#ifdef __cplusplus
    1.25 +extern "C" {
    1.26 +#endif	/* __cplusplus */
    1.27 +
    1.28 +/* ---- shaders ---- */
    1.29 +unsigned int create_vertex_shader(const char *src);
    1.30 +unsigned int create_pixel_shader(const char *src);
    1.31 +unsigned int create_tessctl_shader(const char *src);
    1.32 +unsigned int create_tesseval_shader(const char *src);
    1.33 +unsigned int create_geometry_shader(const char *src);
    1.34 +unsigned int create_shader(const char *src, unsigned int sdr_type);
    1.35 +void free_shader(unsigned int sdr);
    1.36 +
    1.37 +unsigned int load_vertex_shader(const char *fname);
    1.38 +unsigned int load_pixel_shader(const char *fname);
    1.39 +unsigned int load_tessctl_shader(const char *fname);
    1.40 +unsigned int load_tesseval_shader(const char *fname);
    1.41 +unsigned int load_geometry_shader(const char *fname);
    1.42 +unsigned int load_shader(const char *src, unsigned int sdr_type);
    1.43 +
    1.44 +unsigned int get_vertex_shader(const char *fname);
    1.45 +unsigned int get_pixel_shader(const char *fname);
    1.46 +unsigned int get_tessctl_shader(const char *fname);
    1.47 +unsigned int get_tesseval_shader(const char *fname);
    1.48 +unsigned int get_geometry_shader(const char *fname);
    1.49 +unsigned int get_shader(const char *fname, unsigned int sdr_type);
    1.50 +
    1.51 +int add_shader(const char *fname, unsigned int sdr);
    1.52 +int remove_shader(const char *fname);
    1.53 +
    1.54 +/* ---- gpu programs ---- */
    1.55 +unsigned int create_program(void);
    1.56 +unsigned int create_program_link(unsigned int sdr0, ...);
    1.57 +unsigned int create_program_load(const char *vfile, const char *pfile);
    1.58 +void free_program(unsigned int sdr);
    1.59 +
    1.60 +void attach_shader(unsigned int prog, unsigned int sdr);
    1.61 +int link_program(unsigned int prog);
    1.62 +int bind_program(unsigned int prog);
    1.63 +
    1.64 +int set_uniform_int(unsigned int prog, const char *name, int val);
    1.65 +int set_uniform_float(unsigned int prog, const char *name, float val);
    1.66 +int set_uniform_float2(unsigned int prog, const char *name, float x, float y);
    1.67 +int set_uniform_float3(unsigned int prog, const char *name, float x, float y, float z);
    1.68 +int set_uniform_float4(unsigned int prog, const char *name, float x, float y, float z, float w);
    1.69 +int set_uniform_matrix4(unsigned int prog, const char *name, float *mat);
    1.70 +int set_uniform_matrix4_transposed(unsigned int prog, const char *name, float *mat);
    1.71 +
    1.72 +int get_attrib_loc(unsigned int prog, const char *name);
    1.73 +void set_attrib_float3(int attr_loc, float x, float y, float z);
    1.74 +
    1.75 +#ifdef __cplusplus
    1.76 +}
    1.77 +#endif	/* __cplusplus */
    1.78 +
    1.79 +#endif	/* SDR_H_ */