PDA

View Full Version : Multiple rectangular outlines



codeman_nz
04-04-2016, 04:58 PM
Hi everyone,

In my game menu I have multiple buttons. Each button I am using sfml to draw the text and opengl to draw the rectangular outlines.

What I am thinking of doing is put all vertices and indices into one buffer each and then use glDrawRangeElements and GL_LINE_LOOP in a loop to draw the individual outlines.

Is this the correct approach?

GClements
04-04-2016, 07:14 PM
What I am thinking of doing is put all vertices and indices into one buffer each and then use glDrawRangeElements and GL_LINE_LOOP in a loop to draw the individual outlines.

Is this the correct approach?
A better approach would be to draw all of the outlines with one call, either using GL_LINES or using GL_LINE_LOOP with glEnable(GL_PRIMITIVE_RESTART) or glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX).

codeman_nz
04-04-2016, 07:48 PM
A better approach would be to draw all of the outlines with one call, either using GL_LINES or using GL_LINE_LOOP with glEnable(GL_PRIMITIVE_RESTART) or glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX).

Thank you very much. That's exactly what I was looking for!