K
kmeeth
Guest
I am having problems with the main menu, or, rather, the fancy effect I wanted to implement.
I made a shader that inverts the color of a pixel. I think the shader itself is legit.
My goal is to, at the start of the game, enable this shader so that it inverts EVERYTHING. My background is white, and my text black, which was inverted just fine. But, the option in the menu that is selected normally turns red. And it works fine without the shader, but when I try to invert everything, the red option doesn't turn turquoise, but it becomes white, as the rest of the inverted text, therefore I am unable to make a difference between selected and unselected options in the menu. Here is the draw event of the object that renders the text (selected variable is handled in step event and works well without the shader)
Also, the sprite at the end is not inverted.
I'm new to shaders, so I'm sorry if i missed something obvious. Seeing how the menu works well without the shader, i'm sure that the problem is connected to it.
I made a shader that inverts the color of a pixel. I think the shader itself is legit.
Code:
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
void main()
{
vec4 oc = texture2D( gm_BaseTexture, v_vTexcoord );
float Red=1.0-oc.r;
float Green=1.0-oc.g;
float Blue=1.0-oc.b;
vec4 c = vec4(Red, Green, Blue, oc.a);
gl_FragColor = c;
}
Code:
shader_set(sh_invert);
draw_set_font(font_menusmall);
draw_set_color(c_black);
draw_text(1660,1030,"Made by Kmeeth")
if(selected!=10){
draw_set_font(font_menu);
if(selected==0){draw_set_color(c_red)} else {draw_set_color(c_black);}
draw_text(5,0,"Play");
if(selected==1){draw_set_color(c_red)} else {draw_set_color(c_black);}
draw_text(5,50,"Help");
if(selected==2){draw_set_color(c_red)} else {draw_set_color(c_black);}
draw_text(5,100,"Settings");
if(selected==3){draw_set_color(c_red)} else {draw_set_color(c_black);}
draw_text(5,150,"Stats");
if(selected==4){draw_set_color(c_red)} else {draw_set_color(c_black);}
draw_text(5,200,"Quit");
draw_set_font(font_menusmall);
draw_set_color(c_black);
draw_text(5,280,"Press Enter to choose an option");
}
else
{
draw_set_font(font_menu);
draw_set_color(c_gray);
draw_text(5,0,"Play");
draw_text(5,50,"Help");
draw_text(5,100,"Settings");
draw_text(5,150,"Stats");
draw_text(5,200,"Quit");
}
draw_sprite(spr_logo,-1,0,1080)
I'm new to shaders, so I'm sorry if i missed something obvious. Seeing how the menu works well without the shader, i'm sure that the problem is connected to it.
Last edited by a moderator: