quick question: why do shaders 💩💩💩💩 up my room view

D

Distorted

Guest
whenever I use shaders my view gets really up close and the character doesn't allign to the middle of the screen, even if I don't have views enabled. when I'm not using the shader everything works just fine. has anyone had this problem before and know a solution? tell me if more info is needed.
 
M

maratae

Guest
whenever I use shaders my view gets really up close and the character doesn't allign to the middle of the screen, even if I don't have views enabled. when I'm not using the shader everything works just fine. has anyone had this problem before and know a solution? tell me if more info is needed.
How are you using the shader?
How are you drawing your application surface?
 
D

Distorted

Guest
How are you using the shader?
How are you drawing your application surface?

here's the code of the object I activate it with.


create:
Code:
application_surface_draw_enable(false);

bloomIntensity = shader_get_uniform(shdr_bloom, 'intensity');
bloomblurSize = shader_get_uniform(shdr_bloom, 'blurSize');
draw GUI end:
Code:
shader_set(shdr_bloom);
shader_set_uniform_f(bloomIntensity, 0.25); //0 = off, 1 = a bit, 80 = extremely intense
shader_set_uniform_f(bloomblurSize, 0.001); // usually something like 1/512 (0.001)
shader_set_uniform_f(bloomblurSize, 0.001);
draw_surface(application_surface, 0, 0);
shader_reset();

and the shader itself:

Code:
//
// Simple passthrough vertex shader
//
attribute vec3 in_Position;                  // (x,y,z)
//attribute vec3 in_Normal;                  // (x,y,z)     unused in this shader.
attribute vec4 in_Colour;                    // (r,g,b,a)
attribute vec2 in_TextureCoord;              // (u,v)

varying vec2 v_vTexcoord;
varying vec4 v_vColour;

void main()
{
    vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
    gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
    
    v_vColour = in_Colour;
    v_vTexcoord = in_TextureCoord;
}
 
The fragment shader code is missing, but I'm guessing you copied that - so it should work anyways. My guess then is the application surface is too large or the gui layer too small.
Edit: The application surface and probably the gui layer are automatically set to the size of the first room in your game. But you can set it by code as seen below.

Try something like this in game start event or on creation of your game controller:

Code:
surface_resize(whatever_width_you_want, whatever_height_you_want);
display_set_size(same_width_as_application_surface, same_height_as_application_surface);
 
D

Distorted

Guest
The fragment shader code is missing, but I'm guessing you copied that - so it should work anyways. My guess then is the application surface is too large or the gui layer too small.
Edit: The application surface and probably the gui layer are automatically set to the size of the first room in your game. But you can set it by code as seen below.

Try something like this in game start event or on creation of your game controller:

Code:
surface_resize(whatever_width_you_want, whatever_height_you_want);
display_set_size(same_width_as_application_surface, same_height_as_application_surface);
thank you!
this did the trick
 
I

icuurd12b42

Guest
you are supposed to use application_get_position and draw_surface_ext to draw the surface at the right position and the right size
 
Top