• Paladin of the Pegasos
    Paladin of the Pegasos
    Jupp3
    Posts: 1192 from 2003/2/24
    From: Helsinki, Finland
    Quote:

    The vertex and normal count for my landscape is 151686, could that be the problem?

    As long as the max. value can be specified with the used index type (GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT), it should work. If not, I'd say that's a bug in GL implementation (unless there's some other bug elsewhere).

    But another question, how are you drawing your heightmap in general?

    Probably the most efficient way is to specify each point in map in the vertex array once, then have series of GL_TRIANGLE_STRIP arrays (in same VBO), that specify the vertex id's in triangles used in that particular row. Of course you also lose control over "which way quads are split to triangles" (splitting this conditionally is way more complex) - oh, and using GL_QUADS isn't useful either, basically you just pretend that OpenGL wouldn't draw 2 triangles instead (which it does).

    Then just do a simple for loop, and draw the rows you want. This way you can also only draw specific rows, which you probably want later, so you only draw specific range in front of the camera.

    Example:
    Vertex array (number specifies the order points are specified in)
    00 04 08
    01 05 09
    02 06 10
    03 07 11

    Index array:
    00, 04, 01, 05, 02, 06, 03, 07 (first row done),
    04, 08, 05, 09, 06, 10, 07, 11 (second row done)

    -EDIT-

    One generic tip for "I'm not getting the graphics I expected to" cases: Draw as GL_POINTS or GL_LINE_STRIP instead. That way, you will get some (wrong) graphics, even if triangles (should you have drawn as them) were facing backwards (and you've enabled bfc, like you should). Then just compare if you get vertices in locations you don't, when drawing with the "correct" primitive.

    [ Edited by Jupp3 10.01.2017 - 23:30 ]
  • »10.01.17 - 13:08
    Profile Visit Website