FPS Camera w Modern OpenGL

Dec 16, 2013 at 12:20am
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 Dec 16, 2013 at 12:21am
Dec 16, 2013 at 1:39am
*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.
Dec 16, 2013 at 1:40am
closed account (N36fSL3A)
Well I searched that website and didn't see it :|

Thanks.
Dec 16, 2013 at 2:08am
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
Dec 20, 2013 at 10:26pm
closed account (N36fSL3A)
// then w/e fragment shader
???
Dec 20, 2013 at 10:36pm
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.
Dec 21, 2013 at 2:30am
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.