GM:S 1.4 How to not spread view all over the display in 3D

Discussion in 'Programming' started by Vikom, Feb 27, 2019.

  1. Vikom

    Vikom Member

    Joined:
    Jun 21, 2016
    Posts:
    109
    Hi!
    I'm working on a 3d editor for my game. Since it needs toolbars, I think it is a good idea to not draw the view under the toolbars and menus.
    To offset it from [0, 0] was easy using view_xport and view_yport.
    The problem is, I struggle at lowering the width and height of the view. (read: make the view narrower, lower and leave bars of black around its right and bottom side, like on the left side in the image) The view_wport and view_hport do nothing significant.

    I'll be grateful for your help.
    PS: the view settings sould be setted up properly.
     

    Attached Files:

  2. BattleRifle BR55

    BattleRifle BR55 Member

    Joined:
    Jun 24, 2016
    Posts:
    954
    Either use ortho projections after everything "3D" or use the Draw GUI event.
     
  3. Vikom

    Vikom Member

    Joined:
    Jun 21, 2016
    Posts:
    109
    Thank you.
    Ortho? Sounds already like more trouble than benefit. I'll probably leave this idea and simply cover the view by GUI, as originally planned.
     
  4. flyingsaucerinvasion

    flyingsaucerinvasion Member

    Joined:
    Jun 20, 2016
    Posts:
    2,088
    My advice would be to draw your 3d stuff onto a surface and then to draw the surface where your 3d view port should be located. It is much more straightforward than using multiple views. For one, you don't have to worry about what the current view is when drawing. So the idea here would be to set the surface as the target, set the view and projection, and then draw your 3d stuff. Then after resetting the surface target, draw the surface either with an orthographic projection or in the gui event. If you intend for there to be transparent areas in your surface, you will need to use pre-multiplied alpha when drawing to it. However, if you intend to draw partially-transparent things onto a fully opaque surface, then you need to either use pre-multiplied alpha or else you need to turn off writing to the alpha channel.
     

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