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

You need glUniform1iARB to tell the sampler what TMU to access :

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 :

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;

For the Pascal illiterate (untested 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;
	}
}

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