Hello all, I am working with OpenGL in C++ as a beginner to opengl, but not C++ so I apologize if my question is simple.

I need to write a mouseMove function that registers the (x,y) coordinate of the mouse when left clicked forming the vertices of a polygon with each successive left click. When you right click, the last made vertice connects to the original forming your polygon. I need to do this multiple times in the same canvas. So far my program draws the shape with each new vertice, but does not terminate via right click, rather an arbitrary bound I set. On top of this, I am not able to do multiple polygons in a single canvas. I think using the glInterleavedArrays function will do this, but the implementation for me is confusing. I have:

My tests with glInterleavedArrays have all broken my program. If you can help me understand how to use it, I could finish it within my code. Please direct your explanation to something I could accomplish for my particular program.

BionicBytes

02-13-2012, 11:17 AM

Use either glinterleavedArrays or glVertexPointer but not both.
Remove the glEnableClientState and glVertexPointer and see what happens.