I’m trying to put some blur around a sun, to give it a glow effect.
I’m using the method here:
http://nehe.gamedev.net/tutorial/radial_blur__rendering_to_a_texture/18004/
Basically, I draw a sphere, it takes the current buffer and grabs it as a texture and redraws it a number of times, stretching it each time.
This works great when the object is in the centre of the screen. However, I want to have it offset to say, the top right.
This is the main part I believe that needs adjusting:
glColor4f(1.0f, 1.0f, 1.0f, alpha); // Set The Alpha Value (Starts At 0.2)
glTexCoord2f(0+spost,1-spost); // Texture Coordinate ( 0, 1 )
glVertex2f(0,0); // First Vertex ( 0, 0 )
glTexCoord2f(0+spost,0+spost); // Texture Coordinate ( 0, 0 )
glVertex2f(0,480); // Second Vertex ( 0, 480 )
glTexCoord2f(1-spost,0+spost); // Texture Coordinate ( 1, 0 )
glVertex2f(640,480); // Third Vertex ( 640, 480 )
glTexCoord2f(1-spost,1-spost); // Texture Coordinate ( 1, 1 )
glVertex2f(640,0);
For the life of me though, I can’t work out how to offset it each time so that the blurred images are not offset to the right. I understand that the whole screen is being captured, but there must be a way to offset this when the texture is drawn…..
How?
This maybe isn’t a direct answer, to your question, but you shouldn’t focus too much on effects via the fixed pipeline. NeHE tutorials are good, but a bit outdated. I recommend you just skim through the basics and incorporate shaders in your code. They’re much faster and will allow you for creating much more complex effects easier.