15 NEX_VEC2, NEX_VEC3, NEX_VEC4,
41 NEX_CUBE_PX, NEX_CUBE_NX,
42 NEX_CUBE_PY, NEX_CUBE_NY,
43 NEX_CUBE_PZ, NEX_CUBE_NZ
46 typedef struct nex_buffer nex_buffer;
47 typedef struct nex_geometry nex_geometry;
48 typedef struct nex_shader nex_shader;
49 typedef struct nex_sdrprog nex_sdrprog;
50 typedef struct nex_texture nex_texture;
53 void nex_clearcolor(float r, float g, float b);
54 void nex_cleardepth(float z);
55 void nex_clearstencil(unsigned int s);
57 void nex_viewport(int x, int y, int w, int h);
59 void nex_enable(enum nex_state_opt opt);
60 void nex_disable(enum nex_state_opt opt);
61 int nex_is_enabled(enum nex_state_opt opt);
63 /* --- buffers and geometry --- */
64 nex_buffer *nex_alloc_buffer(size_t sz, const void *data);
65 void nex_free_buffer(nex_buffer *buf);
66 nex_geometry *nex_alloc_geometry(void);
67 void nex_free_geometry(nex_geometry *geom);
69 void nex_geom_vbuffer(nex_geometry *geom, unsigned int bufid, const nex_buffer *buf,
71 void nex_geom_ibuffer(nex_geometry *geom, const nex_buffer *buf);
72 void nex_geom_vattr(nex_geometry *geom, unsigned int attr,
73 enum nex_vattr_type type, int bufid, unsigned int offs);
75 void nex_draw_geometry(const nex_geometry *geom, enum nex_primitive prim, unsigned int count);
78 nex_shader *nex_alloc_shader(enum nex_sdr_type type);
79 void nex_free_shader(nex_shader *sdr); /* refcounted */
81 nex_sdrprog *nex_alloc_sdrprog(void);
82 void nex_free_sdrprog(nex_sdrprog *prog);
84 void nex_sdrname(nex_shader *sdr, const char *name);
85 void nex_sdrsrc(nex_shader *sdr, const char *src);
86 void nex_sdrbin(nex_shader *sdr, void *bin, size_t sz);
88 void nex_sdrconst_int(nex_shader *sdr, int id, int val);
89 void nex_sdrconst_float(nex_shader *sdr, int id, float val);
90 int nex_build_shader(nex_shader *sdr);
92 void nex_attach_shader(nex_sdrprog *prog, nex_shader *sdr);
93 int nex_build_sdrprog(nex_sdrprog *prog);
94 void nex_bind_sdrprog(nex_sdrprog *prog);
96 int nex_find_uniform(nex_sdrprog *prog, const char *name);
97 void nex_uniform_mat4(nex_sdrprog *prog, int loc, const float *mat);
98 void nex_uniform_mat4_name(nex_sdrprog *prog, const char *name, const float *mat);
100 nex_shader *nex_load_shader(const char *path, enum nex_sdr_type type);
101 nex_sdrprog *nex_load_sdrprog(const char *vpath, const char *ppath);
103 /* --- textures --- */
104 nex_texture *nex_alloc_texture(enum nex_tex_type type);
105 void nex_free_texture(nex_texture *tex);
107 #endif /* NEXUS3D_GFX_H_ */