Reputation: 4165
Until today, when I wanted to create reflections (a mirror) in opengl
, I rendered a view into a texture and displayed that texture on the mirroring surface.
What i want to know is, are there any other methods to create a mirror in opengl?
And 2. can this be done lonely in shaders (e.g. geometry shader) ?
Upvotes: 3
Views: 3851
Reputation: 717
There are no universal way to do that, in any 3D API i know of. Depending on your case there are several possible techniques with different downsides.
They are probably many other ways to render mirrors but these are the tree main one (at least for what i know) ways of doing reflections.
Upvotes: 5
Reputation: 3420
Ray-tracing. You can write a ray-tracer in the fragment shader (every fragment follows a ray). Ray-tracers can perfectly deal with reflection (mirroring) on all kinds of surfaces.
You can find an OpenGL example here and a WebGL example including mirroring here.
Upvotes: 6