3dphotoshoot

diff src/shader.h @ 20:c14613d27a3a

writing a C++ shader class for this
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 11 Jun 2015 02:53:43 +0300
parents
children 4ca4e3c5a754
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/shader.h	Thu Jun 11 02:53:43 2015 +0300
     1.3 @@ -0,0 +1,36 @@
     1.4 +#ifndef SHADER_H_
     1.5 +#define SHADER_H_
     1.6 +
     1.7 +#include <vector>
     1.8 +
     1.9 +class SdrProg {
    1.10 +private:
    1.11 +	std::vector<unsigned int> priv_sdr;
    1.12 +	unsigned int prog;
    1.13 +	mutable bool valid;
    1.14 +
    1.15 +public:
    1.16 +	SdrProg();
    1.17 +	~SdrProg();
    1.18 +
    1.19 +	void create();
    1.20 +	void destroy();
    1.21 +
    1.22 +	bool attach_shader(unsigned int sdr);
    1.23 +
    1.24 +	bool create(unsigned int vsdr, unsigned int psdr);
    1.25 +	bool create(const char *vsrc, const char *psrc);
    1.26 +	bool load(const char *vfname, const char *pfname);
    1.27 +
    1.28 +	bool link() const;
    1.29 +
    1.30 +	int get_uniform(const char *name) const;
    1.31 +	int get_attrib(const char *name) const;
    1.32 +	bool bind_attrib(const char *name, int loc) const;
    1.33 +
    1.34 +	bool bind() const;
    1.35 +};
    1.36 +
    1.37 +unsigned int get_shader(const char *name, unsigned int type);
    1.38 +
    1.39 +#endif	/* SHADER_H_ */