FPS Camera w Modern OpenGL

closed account (N36fSL3A)
Hi,

I'm still new to shaders... how can I make an FPS camera with them?

In the FF-Pipeline it was easy enough, but shaders are entirely different...
Last edited on
*points to arcsynthesis tutorial*

http://www.arcsynthesis.org/gltut/Positioning/Tutorial%2008.html


It's the exact same idea as older version of OpenGL. You set up a model view matrix and you multiply all your vertex positions by it. The only difference is instead of setting up the matrix with OpenGL function calls, you do it in the shader code.
closed account (N36fSL3A)
Well I searched that website and didn't see it :|

Thanks.
closed account (o1vk4iN6)
Click the link he posted, there's only one example. The thing it doesn't show is the shader but it's basically just this:

1
2
3
4
5
6
7
8
9
10
11
// vertex
uniform mat4 cam;
in vec3 pos;

void main()
{
    gl_Position = cam * vec4(pos, 1.0);    
}

// then w/e fragment shader
closed account (N36fSL3A)
// then w/e fragment shader
???
xerzi just meant the fragment shader is irrelevant to your goal here. The vertex shader is the only thing you need to involve in order to perform this transformation.
closed account (N36fSL3A)
Sorry, newb question here. If I call this Shader program will it effect other shader programs when I disable it?
Topic archived. No new replies allowed.