oculus1

annotate src/sdr.h @ 16:f3672317e5c2

made teapots many sizes and more colorful, added phong shader
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 21 Sep 2013 05:22:48 +0300
parents
children
rev   line source
nuclear@16 1 /*
nuclear@16 2 Printblobs - halftoning display hack
nuclear@16 3 Copyright (C) 2013 John Tsiombikas <nuclear@member.fsf.org>
nuclear@16 4
nuclear@16 5 This program is free software: you can redistribute it and/or modify
nuclear@16 6 it under the terms of the GNU General Public License as published by
nuclear@16 7 the Free Software Foundation, either version 3 of the License, or
nuclear@16 8 (at your option) any later version.
nuclear@16 9
nuclear@16 10 This program is distributed in the hope that it will be useful,
nuclear@16 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
nuclear@16 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
nuclear@16 13 GNU General Public License for more details.
nuclear@16 14
nuclear@16 15 You should have received a copy of the GNU General Public License
nuclear@16 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
nuclear@16 17 */
nuclear@16 18 #ifndef SDR_H_
nuclear@16 19 #define SDR_H_
nuclear@16 20
nuclear@16 21 #ifdef __cplusplus
nuclear@16 22 extern "C" {
nuclear@16 23 #endif /* __cplusplus */
nuclear@16 24
nuclear@16 25 /* ---- shaders ---- */
nuclear@16 26 unsigned int create_vertex_shader(const char *src);
nuclear@16 27 unsigned int create_pixel_shader(const char *src);
nuclear@16 28 unsigned int create_tessctl_shader(const char *src);
nuclear@16 29 unsigned int create_tesseval_shader(const char *src);
nuclear@16 30 unsigned int create_geometry_shader(const char *src);
nuclear@16 31 unsigned int create_shader(const char *src, unsigned int sdr_type);
nuclear@16 32 void free_shader(unsigned int sdr);
nuclear@16 33
nuclear@16 34 unsigned int load_vertex_shader(const char *fname);
nuclear@16 35 unsigned int load_pixel_shader(const char *fname);
nuclear@16 36 unsigned int load_tessctl_shader(const char *fname);
nuclear@16 37 unsigned int load_tesseval_shader(const char *fname);
nuclear@16 38 unsigned int load_geometry_shader(const char *fname);
nuclear@16 39 unsigned int load_shader(const char *src, unsigned int sdr_type);
nuclear@16 40
nuclear@16 41 unsigned int get_vertex_shader(const char *fname);
nuclear@16 42 unsigned int get_pixel_shader(const char *fname);
nuclear@16 43 unsigned int get_tessctl_shader(const char *fname);
nuclear@16 44 unsigned int get_tesseval_shader(const char *fname);
nuclear@16 45 unsigned int get_geometry_shader(const char *fname);
nuclear@16 46 unsigned int get_shader(const char *fname, unsigned int sdr_type);
nuclear@16 47
nuclear@16 48 int add_shader(const char *fname, unsigned int sdr);
nuclear@16 49 int remove_shader(const char *fname);
nuclear@16 50
nuclear@16 51 /* ---- gpu programs ---- */
nuclear@16 52 unsigned int create_program(void);
nuclear@16 53 unsigned int create_program_link(unsigned int sdr0, ...);
nuclear@16 54 unsigned int create_program_load(const char *vfile, const char *pfile);
nuclear@16 55 void free_program(unsigned int sdr);
nuclear@16 56
nuclear@16 57 void attach_shader(unsigned int prog, unsigned int sdr);
nuclear@16 58 int link_program(unsigned int prog);
nuclear@16 59 int bind_program(unsigned int prog);
nuclear@16 60
nuclear@16 61 int set_uniform_int(unsigned int prog, const char *name, int val);
nuclear@16 62 int set_uniform_float(unsigned int prog, const char *name, float val);
nuclear@16 63 int set_uniform_float2(unsigned int prog, const char *name, float x, float y);
nuclear@16 64 int set_uniform_float3(unsigned int prog, const char *name, float x, float y, float z);
nuclear@16 65 int set_uniform_float4(unsigned int prog, const char *name, float x, float y, float z, float w);
nuclear@16 66 int set_uniform_matrix4(unsigned int prog, const char *name, float *mat);
nuclear@16 67 int set_uniform_matrix4_transposed(unsigned int prog, const char *name, float *mat);
nuclear@16 68
nuclear@16 69 int get_attrib_loc(unsigned int prog, const char *name);
nuclear@16 70 void set_attrib_float3(int attr_loc, float x, float y, float z);
nuclear@16 71
nuclear@16 72 #ifdef __cplusplus
nuclear@16 73 }
nuclear@16 74 #endif /* __cplusplus */
nuclear@16 75
nuclear@16 76 #endif /* SDR_H_ */