glVertexAttrib4f - glGetAttribLocation

BlitzMax Forums/OpenGL Module/glVertexAttrib4f - glGetAttribLocation

FBEpyon(Posted 2014) [#1]
Hello,

I can't seem to get the glGetAttribLocation command to work, it always returns a -1, and because of this I can't assign any variables to the shader.. Anyone having problems with this..?

Thanks,


BLaBZ(Posted 2014) [#2]
Is your shader successfully compiling and linking?


FBEpyon(Posted 2014) [#3]
Yes... other shaders work fine (that don't require any static or dynamic variables).. but the glGetAttribLocation is failing for some reason..


BLaBZ(Posted 2014) [#4]
Does your uniform data type match what's in the shader?


FBEpyon(Posted 2014) [#5]
yep and I even changed it twice, and still nothing..



I tried the :


Then I did another command to finalize it..



There is my code sorta..

Thanks,


AdamStrange(Posted 2014) [#6]
here's my code for this sort of thing...
Field ProgramObject:Int

<snip>

ProgramObject = glCreateProgramObjectARB()

<snip>

  Method GetUniformLocation:Int(Name:String)
    Return glGetUniformLocationARB(ProgramObject, Name)
  End Method

  Method setUniformFloat4:Int(name:String, val1:Float, val2:Float, val3:Float, val4:Float)
      Local loc:Int = glGetUniformLocationARB(ProgramObject, name.ToCString())

      If loc < 0 Then
        Error = True
        ErrorShader = SHERROR_VARIABLE
        ErrorMessage = "Problem Setting Uniform Var '"+name+"'"
        Return False
      End If

      glUniform4fARB(loc, val1, val2, val3, val4)
		
    Return True
  End Method



might help or not :)


FBEpyon(Posted 2014) [#7]
Thanks All, I was being a moron!! I got it working now..