Line rendering
  • SantalLicanSantalLican April 2012
    Hi Everybody !
    I'm got trouble with Gfx_RenderLine(). I can render but the line isn't smooth.
    There is my code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    //Screen Width is 1024,Screen Height is 768
    bool RenderFunc()
    {hge->Gfx_BeginScene();
    hge->Gfx_Clear(0);
    ////Look !
    hge->Gfx_RenderLine(122,533,833,115);
    ////////////////////////////////////////
    hge->Gfx_EndScene();
    return false;
    }

    Help me : How to render smooth lines with HGE ?
  • kvakvskvakvs April 2012
    HGE cannot render smooth lines.

    One good solution is to create render target of double size, calculate coordinates for ends of line, instead of line render quad of width 2, and then scale down to screen size. This is called supersampling (oversampling).
  • SantalLicanSantalLican April 2012
    Kvakvs,do you have an example snippet code ???
  • kvakvskvakvs April 2012
    Google for "rendering thick line with quad"
    Find this: http://forums.create.msdn.com/forums/t/60941.aspx

    Take note that in that example A, B, C are vectors, HGE has hgeVector type which can do those operations, vector minus, vector dot product (cross in the article), vector set length (hgeVector Normalize and multiply by length).

    Take note that you don't need to draw 2 triangles in HGE, as HGE has hgeQuad class which draws a 4-cornered polygon for you.

    P.S. I assume you can read examples and documentation and figure out how to use hgeVectors and draw a hgeQuad.

    Also write your game without smoothed lines, there are many more problems ahead :) You can't just stop here because HGE doesn't draw smoothed lines.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

In this Discussion

Tagged

Who's Online (1)