New glsl need some basic simple help :)

hello

Okay so im already able to do alot with opengl such as alpha blending on texels, texture mapping of different image formats(tga,png,bmp) with sdl data i know the lot :).

What i dont know is how to work with GLSL :frowning:

can you tell me how and why i can’t get this to work ?

char maxlength = 100;
void glGetShaderInfoLog(GLuint shader,GLsizei maxlength, GLsizei length,GLchar *infoLog);


fprintf(stderr,infoLog);

your gonna wonder what and why :smiley: perhaps…

and if so read this!

i’ll explain i need the output of infoLog in a stderr text file now i have never come across anything like this for example the infoLog while using OpenGL so i’m curious to the hows and whys of this

so please do enlighten me on this subject and give me any pointers,tips, and help to solving this

thanks in advance

if you have any good tutorials for GLSL please provide some too i need as much help as i can get for this shader language of sorts :smiley:

im pretty sure my code up there is messed up lol so please do give me any tips nicely

any help? :smiley:


  glGetObjectParameterivARB( handle, GL_OBJECT_INFO_LOG_LENGTH_ARB, & maxlen );

  char *log = new char[ maxlen ];
  glGetInfoLogARB ( handle, maxlen, &length, log ) ;

  if ( length > 0 && log[0] != '\0' )
    fprintf( stderr, "%s
", log ) ;

  delete [] log;

Call this with a shader object after:


  glGetShaderiv( handle, GL_COMPILE_STATUS, &compiled );

if it returns !compiled, and call this with a program object after:


  glGetProgramiv ( handle, GL_LINK_STATUS, & linked );

and:


  glGetProgramiv( handle, GL_VALIDATE_STATUS, & validated );

if they return !linked (or !validated).

thanks very much :smiley:

im getting quite alot of declaration issues and i was just wondering how to declare inside a parameter or rather declare so it works within the code you gave me to learn from any ideas? iv looked at this site http://www.cplusplus.com/doc/tutorial/functions/ and have not found anything that has worked sorry to bug you, i would also like to ask why there is such a lack of information GLSL not to bash them or anything but its been very tuff to find information

Try this:


//////////////////////////////////////////////////////////////////////////////
std::string gl_get_shader_error(GLuint handle)
{
  boost::scoped_array<GLchar> buffer;
  GLint size;

  if (glIsProgram(handle))
  {
    glGetProgramiv(handle, GL_INFO_LOG_LENGTH, &size);
    buffer.reset(new GLchar[size]);
    glGetProgramInfoLog(handle, size, 0, buffer.get());
  }
  else if (glIsShader(handle))
  {
    glGetShaderiv(handle, GL_INFO_LOG_LENGTH, &size);
    buffer.reset(new GLchar[size]);
    glGetShaderInfoLog(handle, size, 0, buffer.get());
  }
  else
  {
    BOOST_VERIFY(!"wrong program or shader handle provided");
  }

  return buffer.get();
}

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.