Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Sort'a starting GLSL

  1. #1
    Advanced Member Frequent Contributor
    Join Date
    Nov 2002
    Location
    Latvia
    Posts
    626

    Sort'a starting GLSL

    I've one shader up and running, but I still can't figure out how to bind samplers to fp. Documentation is still messy & I didn't noticed any PFNGS that included sampler in'em.
    BTW, is there some sort of offline compiler to check is the program valid. Spent 8 hours till I realized that the problem is in my shading code

  2. #2
    Junior Member Regular Contributor
    Join Date
    May 2003
    Location
    Germany
    Posts
    229

    Re: Sort'a starting GLSL

    You need glUniform1iARB to tell the sampler what TMU to access :
    Code :
    glUniform1iARB(glGetUniformLocationARB(ProgramObject, PGLCharARB('mysampler')), 1);
    As for checking the program, this function will give a any error-messages that can happen. How detailed they are is depending on your glSlang-Implementation :
    Code :
    function glSlang_GetInfoLog(glObject : GLHandleARB) : String;
    var
     blen,slen : GLInt;
     InfoLog   : PGLCharARB;
    begin
    glGetObjectParameterivARB(glObject, GL_OBJECT_INFO_LOG_LENGTH_ARB , @blen);
    if blen > 1 then
     begin
     GetMem(InfoLog, blen*SizeOf(GLCharARB));
     glGetInfoLogARB(glObject, blen, slen, InfoLog);
     Result := PChar(InfoLog);
     Dispose(InfoLog);
     end;
    end;

  3. #3
    Member Regular Contributor
    Join Date
    Jan 2003
    Location
    Edmonton, Alberta, Canada
    Posts
    320

    Re: Sort'a starting GLSL

    For the Pascal illiterate (untested code). . .

    Code :
    char* glSlang_GetInfoLog (GLHandleARB glObject)
    {
    	GLint blen, slen;
    	GLcharARB *InfoLog;
     
    	glGetObjectParameterivARB (glObject, GL_OBJECT_INFO_LOG_LENGTH_ARB , &blen);
     
    	if blen > 1 then
    	{
    		InfoLog = (GLcharARB*) malloc (sizeof (GLcharARB) * blen);
     
    		glGetInfoLogARB (glObject, blen, slen, InfoLog);
     
    		return InfoLog;
    	}
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •