Updated API documentation for sf::Shader

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1260 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2009-11-03 14:09:58 +00:00
parent 683f82b118
commit 9db63151e1
3 changed files with 238 additions and 44 deletions

View file

@ -319,10 +319,11 @@ bool Shader::IsAvailable()
////////////////////////////////////////////////////////////
bool Shader::CompileProgram()
{
// First make sure that we can use shaders!
// First make sure that we can use shaders
if (!IsAvailable())
{
std::cerr << "Failed to create a shader: your system doesn't support shaders" << std::endl;
std::cerr << "Failed to create a shader: your system doesn't support shaders "
<< "(you should test Shader::IsAvailable() before trying to use the Shader class)" << std::endl;
return false;
}
@ -331,7 +332,7 @@ bool Shader::CompileProgram()
GLCheck(glDeleteObjectARB(myShaderProgram));
// Define the vertex shader source (we provide it directly as it doesn't have to change)
static const std::string vertexShaderSrc =
static const char* vertexSrc =
"void main()"
"{"
" gl_TexCoord[0] = gl_MultiTexCoord0;"
@ -347,7 +348,6 @@ bool Shader::CompileProgram()
GLhandleARB fragmentShader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
// Compile them
const char* vertexSrc = vertexShaderSrc.c_str();
const char* fragmentSrc = myFragmentShader.c_str();
GLCheck(glShaderSourceARB(vertexShader, 1, &vertexSrc, NULL));
GLCheck(glShaderSourceARB(fragmentShader, 1, &fragmentSrc, NULL));