Lens Distortion

Started by
-1 comments, last by bene81 16 years, 6 months ago
Hello, the projection of opengl is that of a pinhole camera, so I want to simulate the behaviour of a planeconvex lens. I want to do the following: Render scene to a texture (bound to fbo). Then I want to transform this texture in a fragment shader. What is the common way to do this in a shader program ? (Having a great texture (e.g. 2048²), I want a destination image of size 1024² with the filtered texture image) So how would I retrieve the destination image? Would I bind the texture, draw a quad filling the whole screen? The for each fragment the fragment shader would fetch the right texels and put it on the framebuffer? Then I will read it back? For doing some sort of interpolation or decimation, like having a 1024x1024 texture/image and wanting a destination 8x1 image. Can I do for-looping in a shader ? Or how would I handle different sizes ? Thanks!

This topic is closed to new replies.

Advertisement