2 This file is part of the 3dengfx, realtime visualization system.
4 Copyright (c) 2004, 2005 John Tsiombikas <nuclear@siggraph.org>
6 3dengfx is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 3dengfx is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with 3dengfx; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 /* GPU programs support (shaders)
23 * Author: John Tsiombikas 2005
30 #include "n3dmath2/n3dmath2.hpp"
33 PROG_VERTEX = GL_VERTEX_SHADER_ARB,
34 PROG_PIXEL = GL_FRAGMENT_SHADER_ARB
37 typedef unsigned int Shader;
42 std::list<Shader> sdr_list;
45 void (*update_handler)(GfxProg*);
48 GfxProg(Shader vertex = 0, Shader pixel = 0);
51 void add_shader(Shader sdr);
54 bool is_linked() const;
55 unsigned int get_id() const;
57 bool set_parameter(const char *pname, int val);
58 bool set_parameter(const char *pname, scalar_t val);
59 bool set_parameter(const char *pname, const Vector2 &val);
60 bool set_parameter(const char *pname, const Vector3 &val);
61 bool set_parameter(const char *pname, const Vector4 &val);
62 bool set_parameter(const char *pname, const Matrix4x4 &val);
64 void set_update_handler(void (*func)(GfxProg*));
66 friend void set_gfx_program(GfxProg *prog);
70 #endif // _GFXPROG_HPP_