Passing vectors to shaders

Previous topic - Next topic

neseir

Hi

How can I pass vectors to uniform defined vectors in shares (like "uniform vec3 fvLightPosition") ? Passing simple float values seems ok but I would prefer to pass vectors in one statement. I think Hemlos have asked for this before but I could not find any example or information for this (if it is possible).

//Eirik

Kitty Hello

pass 3 floats, maybe?

Slydog

#2
[Edit]
Oops, just reread the subject line! ha - Missed the word 'Shaders!'
Ignore my answer!
--------
I'm not quite sure what you are asking, as I don't know what a 'uniform defined vector' is.
But, if you are asking how to pass a vector to a function as one data type then create a new Vector type as in:

Code (glbasic) Select
TYPE TVector
x
y
z
ENDTYPE

GLOBAL vDirection AS TVector
GLOBAL magnitude
vDirection.x = 1
vDirection.y = 2
vDirection.z = 3
magnitude = Vector_Magnitude(vDirection)

FUNCTION Vector_Magnitude: v AS TVector
   RETURN SQR( (v.x * v.x) + (v.y * v.y) + (v.z * v.z) )
ENDFUNCTION
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]