Issues using GL Vertex Buffers



  • Hello,

    I was not happy with the performance using BaseDraw::LineStripBegin() / BaseDraw::LineStrip() / BaseDraw::LineStripEnd() to draw thousands of strands on the viewport, so I tried using GlProgramFactory and GlVertexBuffer from gl.h, exemplified on the sdk source gl_test_object.cpp. The performance improved was amazing, viewport fps raised up to 3 times.

    But those functions are marked as undocumented, and I hope that's very different from the private, that shall never be commented, because some issues arised that I'm unable to solve.

    First, bd->SetDrawParam( DRAW_PARAMETER_LINEWIDTH, 2 ); does not work when drawing with DrawSubBuffer().
    DRAW_PARAMETER_LINEWIDTH is marked in the docs as (OpenGL only), but actually looks like is the inverse.
    How can I set like width for DrawSubBuffer()?
    What OpenGL does DRAW_PARAMETER_LINEWIDTH refers to?

    And some lines seem broken, with gaps in between, usually on concave surfaces. Looks like some depth precision problem.
    How to control depth read/write using those functions?
    0_1547605445470_Screen Shot 2019-01-16 at 00.17.48.png


  • Global Moderator

    Hello,

    again it's me who has provide the unsatisfactory answer. We currently have nothing more to contribute to this topic besides the examples you have already found. I am terribly sorry.

    Cheers,
    Andreas



  • This post is deleted!


  • Just found my problem, nothing to do with the drawing API...

    bd->SetDrawParam( DRAW_PARAMETER_SETZ, DRAW_Z_ALWAYS );
    

    It was setting the depth fragment on all the strands, occluding itself sometimes!


  • Global Moderator

    Hi Roger,

    I'm glad you were able to identify the issue and made some progress. And thanks for taking the time to share your findings with the forum. Much appreciated!

    Cheers,
    Andreas