Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Drawing using large Arrays

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2004
    Posts
    8

    Drawing using large Arrays

    I am working on a simple CAD graphics engine currently limited to Opengl 1.1 functionality. The documents consist of 1000's of tiny arcs or lines. To optimize rendering I batch the lines and arcs together and render then using

    glVertexPointer
    glLockArrays
    glDrawRangeElements
    glUnlockArrays

    This yields really good performance if I try to maximize the size of the arrays to a value the graphics card can handle. Rendering each line with individual calls to Opengl is too slow.

    I am also performing the same algorithm for surfaces. The problem I face with both methods is that the color of all geometry currently has to be the same. To change the color (say for selectio) I have to move all the geometry for a given object (a line, a surface) into a different buffer.

    This operation becomes costly depending on what is selected and how. Does anybody know a way I can render geometry in an array and render parts of it using different materials/colors? Solutions do not have to be limited to Opengl 1.1

  2. #2
    Intern Newbie
    Join Date
    Jan 2010
    Location
    Romania
    Posts
    46

    Re: Drawing using large Arrays

    Solutions do not have to be limited to Opengl 1.1
    then sure, just render everything with a custom shader, pass the selected/normal color as uniforms, tag the selected/unselected geometry with some vertex attrib and , taking that into consideration in the vertex shader, draw either one or the other .

    Now, onto more OpenGL 1.1 methods, just either update by hand, in place, the color per each selected vertex in the buffer when the selection changes OR draw the selection as a second pass with a different color. When you are selecting it, you have the primitives either way so you can copy only what needed...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •