glVertexAttrib4f - glGetAttribLocation
BlitzMax Forums/OpenGL Module/glVertexAttrib4f - glGetAttribLocation| 
 | ||
| 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, | 
| 
 | ||
| Is your shader successfully compiling and linking? | 
| 
 | ||
| Yes... other shaders work fine (that don't require any static or dynamic variables).. but the glGetAttribLocation is failing for some reason.. | 
| 
 | ||
| Does your uniform data type match what's in the shader? | 
| 
 | ||
| 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, | 
| 
 | ||
| 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 :) | 
| 
 | ||
| Thanks All, I was being a moron!! I got it working now.. |