fractorb

view src/sdr.h @ 1:436f82447c44

pan/scale and min orbit distance from point drawing
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 19 Nov 2017 00:57:39 +0200
parents
children
line source
1 #ifndef SDR_H_
2 #define SDR_H_
4 #ifdef __cplusplus
5 extern "C" {
6 #endif /* __cplusplus */
8 /* ---- shaders ---- */
9 unsigned int create_vertex_shader(const char *src);
10 unsigned int create_pixel_shader(const char *src);
11 unsigned int create_tessctl_shader(const char *src);
12 unsigned int create_tesseval_shader(const char *src);
13 unsigned int create_geometry_shader(const char *src);
14 unsigned int create_shader(const char *src, unsigned int sdr_type);
15 void free_shader(unsigned int sdr);
17 unsigned int load_vertex_shader(const char *fname);
18 unsigned int load_pixel_shader(const char *fname);
19 unsigned int load_tessctl_shader(const char *fname);
20 unsigned int load_tesseval_shader(const char *fname);
21 unsigned int load_geometry_shader(const char *fname);
22 unsigned int load_shader(const char *src, unsigned int sdr_type);
24 int add_shader(const char *fname, unsigned int sdr);
25 int remove_shader(const char *fname);
27 /* ---- gpu programs ---- */
28 unsigned int create_program(void);
29 unsigned int create_program_link(unsigned int sdr0, ...);
30 unsigned int create_program_load(const char *vfile, const char *pfile);
31 void free_program(unsigned int sdr);
33 void attach_shader(unsigned int prog, unsigned int sdr);
34 int link_program(unsigned int prog);
35 int bind_program(unsigned int prog);
37 int get_uniform_loc(unsigned int prog, const char *name);
39 int set_uniform_int(unsigned int prog, const char *name, int val);
40 int set_uniform_float(unsigned int prog, const char *name, float val);
41 int set_uniform_float2(unsigned int prog, const char *name, float x, float y);
42 int set_uniform_float3(unsigned int prog, const char *name, float x, float y, float z);
43 int set_uniform_float4(unsigned int prog, const char *name, float x, float y, float z, float w);
44 int set_uniform_matrix4(unsigned int prog, const char *name, const float *mat);
45 int set_uniform_matrix4_transposed(unsigned int prog, const char *name, const float *mat);
47 int get_attrib_loc(unsigned int prog, const char *name);
48 void set_attrib_float3(int attr_loc, float x, float y, float z);
50 /* ---- shader composition ---- */
52 /* clear shader header/footer text.
53 * pass the shader type to clear, or 0 to clear all types */
54 void clear_shader_header(unsigned int type);
55 void clear_shader_footer(unsigned int type);
56 /* append text to the header/footer of a specific shader type
57 * or use type 0 to add it to all shade types */
58 void add_shader_header(unsigned int type, const char *s);
59 void add_shader_footer(unsigned int type, const char *s);
60 /* get the current header/footer text for a specific shader type */
61 const char *get_shader_header(unsigned int type);
62 const char *get_shader_footer(unsigned int type);
64 #ifdef __cplusplus
65 }
66 #endif /* __cplusplus */
68 #endif /* SDR_H_ */