what type should I best use to pass in a transformation matrix into my vertex shader in opengl and how do i convert my vec3 position to a vec4 with a 1 in the fourth row for the multiplication most efficiently? I want it to be as efficient as possible.
0
votes
1 Answers
0
votes
mat4
is the type to pass a 4x4 floating point matrix to a GLSL shader program. You update it with the glUniformMatrix4fv
call.
See this question: Shader position vec4 or vec3 for a discussion of vec3 vs vec4 position data. It likely does not matter however, the vertex stage in the pipeline is rarely a bottleneck in rendering.