program_object_provider.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2011 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Harry Storbacka
00027 */
00028 
00031 
00032 #pragma once
00033 
00034 #include <vector>
00035 class CL_ProgramAttribute;
00036 class CL_ProgramUniform;
00037 class CL_ShaderObject;
00038 
00042 class CL_ProgramObjectProvider
00043 {
00046 
00047 public:
00048         virtual ~CL_ProgramObjectProvider()
00049         {
00050         }
00051 
00053         virtual void destroy()=0;
00054 
00058 
00059 public:
00061         virtual unsigned int get_handle() const=0;
00062 
00064         virtual bool get_link_status() const=0;
00065 
00067         virtual bool get_validate_status() const=0;
00068 
00070         virtual CL_String get_info_log() const=0;
00071 
00073         virtual int get_attribute_count() const=0;
00074 
00076         virtual std::vector<CL_ShaderObject> get_shaders() const=0;
00077 
00079         virtual std::vector<CL_ProgramAttribute> get_attributes() const=0;
00080 
00082         virtual int get_attribute_location(const CL_StringRef &name) const=0;
00083 
00085         virtual int get_uniform_count() const=0;
00086 
00088         virtual std::vector<CL_ProgramUniform> get_uniforms() const=0;
00089 
00091         virtual int get_uniform_location(const CL_StringRef &name) const=0;
00092 
00096 
00097 public:
00099         virtual void attach(const CL_ShaderObject &obj)=0;
00100 
00102         virtual void detach(const CL_ShaderObject &obj)=0;
00103 
00105 
00106         virtual void bind_attribute_location(int index, const CL_StringRef &name)=0;
00107 
00109 
00110         virtual void bind_frag_data_location(int color_number, const CL_StringRef &name)=0;
00111 
00113 
00115         virtual void link()=0;
00116 
00118 
00120         virtual void validate()=0;
00121 
00123         virtual void set_uniform1i(const CL_StringRef &name, int)=0;
00124 
00129         virtual void set_uniform2i(const CL_StringRef &name, int, int)=0;
00130         virtual void set_uniform3i(const CL_StringRef &name, int, int, int)=0;
00131 
00137         virtual void set_uniform4i(const CL_StringRef &name, int, int, int, int)=0;
00138 
00145         virtual void set_uniformiv(const CL_StringRef &name, int size, int count, int *data)=0;
00146         virtual void set_uniform1f(const CL_StringRef &name, float)=0;
00147 
00152         virtual void set_uniform2f(const CL_StringRef &name, float, float)=0;
00153         virtual void set_uniform3f(const CL_StringRef &name, float, float, float)=0;
00154 
00160         virtual void set_uniform4f(const CL_StringRef &name, float, float, float, float)=0;
00161 
00168         virtual void set_uniformfv(const CL_StringRef &name, int size, int count, float *data)=0;
00169 
00171         virtual void set_uniform_matrix(const CL_StringRef &name, int size, int count, bool transpose, float *data)=0;
00172 
00176 
00177 private:
00178 
00180 };
00181