Multi instancing support in OpenGL-ES

This topic contains 1 reply, has 2 voices, and was last updated by  Xmas 8 years, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #29820

    Hi,

    I’m new to OpenGL-ES development.
    As I understand from the GL-ES manual and specs document, for rendering a particular primitive we need to call few functions to set the parameter for the primitive and then call the glDrawArrays() to render the primitive.

    e.g. to draw a line, the application code should look like

                /* Line width is by default 1 pixel. */
                glLineWidthx(nThickness);

                /* Set the current vertices to use from aVertices array. */
                glVertexPointer(2, GL_SHORT, 0, aVertices);

                /* Set the current vertices to use color from colors array. */
                glColorPointer(4, GL_BYTE, 0, aColors);
               
                /* Draw the primitive using elements from vertices array. */
                glDrawArrays(GL_LINES, 0, 1);

    where glLineWidthx() should set the value of a global variable (because we don’t have any structures in GL-ES to pass the data to implementation layer) to nThickness and which will be used by the line drawing function.

    Now my query is if we use global variables in the implementation, how can we support the multi instancing capability.

    Please help me in clearing this doubt and let me know if I’m wrong in my understanding of the GL-ES application/implementation code.

    Thanking You in Advance,
    Himanshu

    #33118

    Xmas
    Member

    If you’re asking whether it’s possible to draw multiple lines with different widths in a single draw call, the answer is no. If you need to draw lots of lines with varying width and you are draw call limited, it might be worth tessellating the lines to pairs of triangles and draw them with a single call to glDrawElements(GL_TRIANGLES, …).

Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.