25#ifndef SFML_SHADER_HPP
26#define SFML_SHADER_HPP
138 bool loadFromFile(
const std::string& vertexShaderFilename,
const std::string& fragmentShaderFilename);
179 bool loadFromMemory(
const std::string& vertexShader,
const std::string& fragmentShader);
310 void setParameter(
const std::string& name,
float x,
float y,
float z,
float w);
523 bool compile(
const char* vertexShaderCode,
const char* fragmentShaderCode);
532 void bindTextures()
const;
542 int getParamLocation(
const std::string& name);
547 typedef std::map<int, const Texture*> TextureTable;
548 typedef std::map<std::string, int> ParamTable;
553 unsigned int m_shaderProgram;
554 int m_currentTexture;
555 TextureTable m_textures;
#define SFML_GRAPHICS_API
Utility class for manipulating RGBA colors.
GlResource()
Default constructor.
NonCopyable()
Default constructor.
bool loadFromFile(const std::string &filename, Type type)
Load either the vertex or fragment shader from a file.
static void bind(const Shader *shader)
Bind a shader for rendering.
Shader()
Default constructor.
bool loadFromStream(InputStream &stream, Type type)
Load either the vertex or fragment shader from a custom stream.
void setParameter(const std::string &name, const Vector2f &vector)
Change a 2-components vector parameter of the shader.
bool loadFromStream(InputStream &vertexShaderStream, InputStream &fragmentShaderStream)
Load both the vertex and fragment shaders from custom streams.
void setParameter(const std::string &name, float x)
Change a float parameter of the shader.
void setParameter(const std::string &name, float x, float y, float z)
Change a 3-components vector parameter of the shader.
void setParameter(const std::string &name, const Texture &texture)
Change a texture parameter of the shader.
void setParameter(const std::string &name, const Transform &transform)
Change a matrix parameter of the shader.
void setParameter(const std::string &name, const Vector3f &vector)
Change a 3-components vector parameter of the shader.
void setParameter(const std::string &name, const Color &color)
Change a color parameter of the shader.
void setParameter(const std::string &name, float x, float y)
Change a 2-components vector parameter of the shader.
unsigned int getNativeHandle() const
Get the underlying OpenGL handle of the shader.
static CurrentTextureType CurrentTexture
Represents the texture of the object being drawn.
bool loadFromMemory(const std::string &shader, Type type)
Load either the vertex or fragment shader from a source code in memory.
bool loadFromFile(const std::string &vertexShaderFilename, const std::string &fragmentShaderFilename)
Load both the vertex and fragment shaders from files.
static bool isAvailable()
Tell whether or not the system supports shaders.
bool loadFromMemory(const std::string &vertexShader, const std::string &fragmentShader)
Load both the vertex and fragment shaders from source codes in memory.
void setParameter(const std::string &name, float x, float y, float z, float w)
Change a 4-components vector parameter of the shader.
void setParameter(const std::string &name, CurrentTextureType)
Change a texture parameter of the shader.
@ Fragment
Fragment (pixel) shader.
Image living on the graphics card that can be used for drawing.
Vector2< float > Vector2f
Vector3< float > Vector3f
Special type that can be passed to setParameter, and that represents the texture of the object being ...