• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Vertex shader help with scaling

W

Wayfarer

Guest
I'm doing a lot of guesswork here as I'm new to shaders.

In the vertex tab, I've noticed if I multiply "in_Position.x * 0.98" I can offset the shader to the left, which is interesting, but not what I need!

Code:
void main()
{
    gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * (
        vec4(in_Position.x * 0.98, in_Position.y, in_Position.z, 1.0)
    );
    v_vColour = in_Colour;
    v_vTexcoord = in_TextureCoord;
}
How would I go about scaling something, say 4x?

The shader is applied to individual sprites like so:
Code:
shader_set(...);
  draw_sprite(...)
shader_reset();

Edit:
Ah, I now see that "gl_Position" is setting the position. Hmm. Is scaling possible?

Edit2:
Do I get the sprite coordinates with sprite_get_uvs() or something?
 
Last edited:
Top