draw square with 2 vertices given possible?

Is it possible to make a square using triangle strip if I am only given 2 vertices(the diagonal of the square)?

Not directly, you will have to compute the other two vertices.

there is no opengl function doing that.
Of course you can implement a helper method that generates 4 vertices from two two-dimensional ( i assume you are 2d, because in 3d that would not make sense…) points as you described and sends them to the gl to draw a triangle fan.



Fascinating. Never stumbled across it…

Yeah, it was already deprecated when I learned about its existence :smiley:

LOL. I never claimed it was cutting edge! :smiley:

On the other hand, for something a bit more cutting edge, you could construct a vbo holding an “normalized” rectangle ({0,0},{0,1},{1,0},{1,1}), pass your own 2 vertices as uniform data and inside the vertex shader, using some clever math, reconstruct the rectangle… Hey, in this way, you could also batch multiple rectangles and instance-render them :smiley:

…just sayin’…