Skip to main content
Bumped by Community user
edited tags
Link
Felix
  • 123
  • 8
Source Link
Felix
  • 123
  • 8

Camera and multiple shaders

What is the best way to handle a moving camera inside many shader programs?

I believe most games need to have one common projection matrix inside all shader programs to use a moving camera. Currently my approach will be to make one global camera object, with which I update every shader program.

I would imagine this gets a bit tedious and possibly heavy once I actually have many programs which to update every movement. So I'd like to construct the program well right away and avoid problems down the road.

What have you done about this, if anything? Do you try to share shader programs between objects?