• 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!

[SOLVED] Shader Surface Problems

F

Frozen Stick

Guest
Hi people.So I'm using a Shader to make the color invert in my project.So if the game isn't in full screen mode it shows the shader correctly:



But When I enter Fullscreen mode it shows the sahder like this:


The Code I'm using for the shader object:
draw_set_color(c_white);
uni_time = shader_get_uniform(shd_invert,"time");
var_time_var = 0;
uni_mouse_pos = shader_get_uniform(shd_invert,"mouse_pos");
var_mouse_pos_x = mouse_x - view_xview;
var_mouse_pos_y = mouse_y - view_yview;
uni_resolution = shader_get_uniform(shd_invert,"resolution");
var_resolution_x = view_wview;
var_resolution_y = view_hview;
shader_enabled = true;
full_screen_effect = true;

var_time_var+=0.04;
var_mouse_pos_x = mouse_x - view_xview;
var_mouse_pos_y = mouse_y - view_yview ;
if shader_enabled shader_set(shd_invert);
shader_set_uniform_f(uni_time, var_time_var);
shader_set_uniform_f(uni_mouse_pos, var_mouse_pos_x, var_mouse_pos_y);
shader_set_uniform_f(uni_resolution, var_resolution_x, var_resolution_y);
if full_screen_effect draw_surface(application_surface,0,0);
shader_reset();

And btw this is not my code I'm using a shader from the market.
Do you know how to fix this? I am using views one the level but I dont think that really effects it.
 
Last edited by a moderator:
I

icuurd12b42

Guest
use application_get_position to figure out the coords and the width and height (see example in help code) to draw the surface on the gui screen using draw_surface_stretched

looks to me like the app surface is smaller than the gui and the default behavior is to scale the app surface up... while your code to draw it is not scaled to the screen doing the final render... these 2 functions will emulate what the system does for the app surface rendering.

also use application_surface_draw_enable to disable the system from drawing the surface, since you are basically doing that yourself. no sense having the system drawing it, then you drawing over it....
 
P

pieterator

Guest
Example of what your code would like after implementing what @icuurd12b42 suggested.
Code:
if full_screen_effect draw_surface_stretched(application_surface,0,0,display_get_gui_width()/var_resolution_x,display_get_height()/var_resolution_y);
 
I

icuurd12b42

Guest
similar result but not identical in behaviour, especially if you change the game settings to not do "full screen"
 
Top