1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

Apply shaders to GUI elements

Discussion in 'Programming' started by Aaeena, Dec 3, 2019.

  1. Aaeena

    Aaeena Member

    Joined:
    Nov 7, 2019
    Posts:
    7
    Hi! Im using the free CTR shader from the marketplace, and got it working, but the problem is it doesn't seem to affect gui elements. The shader utilizes surfaces, more specifically application_surface, but from what i learnt, the gui elements aren't the part of application_surface, so they got ignored by shader. Is there any way I can apply shader to GUI elemets OR to the WHOLE game, master surface?
     

    Attached Files:

  2. obscene

    obscene Member

    Joined:
    Jun 21, 2016
    Posts:
    2,469
    Anything between shader_set and shader_reset will be affected, so draw your GUI stuff there. You can set the shader multiple times if you need to do it in different objects but that wouldn't be as efficient too. You can also use event_perform to call the draw events from other instances when you need them.
     
  3. Aaeena

    Aaeena Member

    Joined:
    Nov 7, 2019
    Posts:
    7
    After playing a bit with it i came to conclusion that the shader itself is too complex to solve this problem with event_perform, or stuff you mentioned earlier. However, I did notice that if i put what i have in Draw GUI event in just simple Draw event, the shader applies to the elements normally, just the positioning and scaling of these elements are weird. So... any idea on how i could make Draw event behave like Draw GUI, like positioning elements relative to current view rather than relative to room, and scaling it accordingly?
     
  4. obscene

    obscene Member

    Joined:
    Jun 21, 2016
    Posts:
    2,469
    Subtract...

    camera_get_view_x(view_camera[0]);
    camera_get_view_y(view_camera[0]);

    Also, should have mentioned but if you were using event_perform() to draw stuff, make sure they are not visible so they don't run their default draw event too.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice