15 NEX_VEC2, NEX_VEC3, NEX_VEC4,
33 typedef struct nex_buffer nex_buffer;
34 typedef struct nex_geometry nex_geometry;
35 typedef struct nex_shader nex_shader;
36 typedef struct nex_sdrprog nex_sdrprog;
39 void nex_clearcolor(float r, float g, float b);
40 void nex_cleardepth(float z);
41 void nex_clearstencil(unsigned int s);
43 void nex_viewport(int x, int y, int w, int h);
45 void nex_enable(enum nex_state_opt opt);
46 void nex_disable(enum nex_state_opt opt);
47 int nex_is_enabled(enum nex_state_opt opt);
49 /* --- buffers and geometry --- */
50 nex_buffer *nex_alloc_buffer(size_t sz, const void *data);
51 void nex_free_buffer(nex_buffer *buf);
52 nex_geometry *nex_alloc_geometry(void);
53 void nex_free_geometry(nex_geometry *geom);
55 void nex_geom_vbuffer(nex_geometry *geom, unsigned int bufid, const nex_buffer *buf,
57 void nex_geom_ibuffer(nex_geometry *geom, const nex_buffer *buf);
58 void nex_geom_vattr(nex_geometry *geom, unsigned int attr,
59 enum nex_vattr_type type, int bufid, unsigned int offs);
61 void nex_draw_geometry(const nex_geometry *geom, enum nex_primitive prim, unsigned int count);
64 nex_shader *nex_alloc_shader(enum nex_sdr_type type);
65 void nex_free_shader(nex_shader *sdr); /* refcounted */
67 nex_sdrprog *nex_alloc_sdrprog(void);
68 void nex_free_sdrprog(nex_sdrprog *prog);
70 void nex_sdrname(nex_shader *sdr, const char *name);
71 void nex_sdrsrc(nex_shader *sdr, const char *src);
72 void nex_sdrbin(nex_shader *sdr, void *bin, size_t sz);
74 void nex_sdrconst_int(nex_shader *sdr, int id, int val);
75 void nex_sdrconst_float(nex_shader *sdr, int id, float val);
76 int nex_build_shader(nex_shader *sdr);
78 void nex_attach_shader(nex_sdrprog *prog, nex_shader *sdr);
79 int nex_build_sdrprog(nex_sdrprog *prog);
80 void nex_bind_sdrprog(nex_sdrprog *prog);
82 int nex_find_uniform(nex_sdrprog *prog, const char *name);
83 void nex_uniform_mat4(nex_sdrprog *prog, int loc, const float *mat);
84 void nex_uniform_mat4_name(nex_sdrprog *prog, const char *name, const float *mat);
86 nex_shader *nex_load_shader(const char *path, enum nex_sdr_type type);
87 nex_sdrprog *nex_load_sdrprog(const char *vpath, const char *ppath);
89 #endif /* NEXUS3D_GFX_H_ */