00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _OPENGL_SHADER_H_
00021 #define _OPENGL_SHADER_H_
00022
00023 #include <string>
00024 #include <GL\glew.h>
00025 #include <boost\utility.hpp>
00026 #include <boost\shared_ptr.hpp>
00027
00028 namespace TestFrameWork
00029 {
00030
00031 enum OpenglShaderStage
00032 {
00033 VertexStage,
00034 FragmentStage
00035 };
00036
00037 struct ShaderFileDesc
00038 {
00039 std::wstring m_fileName;
00040 OpenglShaderStage m_stage;
00041 };
00042
00043
00044 class OpenglShader :
00045 boost::noncopyable
00046 {
00047 public:
00048 OpenglShader(const std::wstring& shaderFile, OpenglShaderStage stage);
00049
00050 ~OpenglShader(void);
00051
00052 GLuint GetOpenglId(void) const;
00053
00054 OpenglShaderStage GetStage(void) const;
00055
00056 private:
00057 GLuint m_id;
00058
00059 OpenglShaderStage m_stage;
00060
00061 GLuint CreateShaderFromFile(const std::wstring& shaderFile, OpenglShaderStage stage);
00062
00063 GLuint CreateShader(const std::string& source, OpenglShaderStage stage);
00064
00065 std::string ReadSourceFile(const std::wstring& shaderFile);
00066 };
00067
00068 typedef boost::shared_ptr<OpenglShader> OpenglShaderPtr;
00069 }
00070
00071 #endif