Sign in to follow this  
DigiMan Shart

Scaling in GLSL

Recommended Posts

Assumption:
You are rendering an image to the screen by rendering a full-screen quad?


You can scale the image by scaling the texture-coordinates which are being used to sample the texture.
However, texture coordinates are in the range 0-1, so simply multiplying them by a scale value will scale the image out from one corner.
If you want to scale from the center you could do:[code]texCoords = (texCoords - 0.5) * scale + (0.5 * scale);[code]

Share this post


Link to post
Share on other sites
Ok, scaling a 3d model, not an image then.

The outline-scaling effect is usually achieved by adding the (scaled) normal to the position. Also, when rendering the black version, you probably want to reverse the culling operation (so front-faces are culled and back-faces are visible).

In your vertex shader:
vec3 outputPosition = inputPosition + inputNormal * 42.0;

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this