I am having problems with placing point sprites in 3D space because of the matrices I am using. The problem is in my vertex shader (I have omitted the unnecessary parts):
#version 330
in vec3 position; // 3d position of the particle
uniform mat4 vp_matrix; // the projection and view matrices from the camera
void main()
{
gl_Position = vp_matrix * vec4(position, 1);
}
Currently I am uploading the view and projection matrices to this matrix uniform. But this leads to the particles to rotate and move around in unexpected ways when the camera moves (i.e. differently from the other objects in my scene).
Does it make sense to apply the projection matrix to a point sprite? Or should I only be applying the view matrix? Should I be applying the entire view matrix, or just the translation and/or rotation?