Draw a circle in opengl but a line is going from the circle nice to the origin point

Hey guys, i have a sprite class that will be handling initializing and drawing shapes to the screen but i have a problem with it right now since when i try to draw a circle it scaled properly and it in the right position but it always has a line going to the 0,0 point I’m not sure what exactly is causing this and my only guess would be because i have glOrtho setup as such glOrtho(0, _width, _height, 0, 0, 1). also here’s the init function for the circle.

void Sprite::init(int x, int y, int vertNum, float r, Shape shape) {
	_vertNum = vertNum;
	if (_vboID == 0) {
		glGenBuffers(1, &_vboID);
	std::vector<Vertex> vertexData(_vertNum);
	if (shape == Shape::CIRCLE) {
		for (int i = 0; i < _vertNum; i++) {
			float angle = 2.0 * M_PI * i / _vertNum;
			vertexData[i].setPosition(r*cos(i) + x, r*sin(i) + y);
	glBindBuffer(GL_ARRAY_BUFFER, _vboID);
	glBufferData(GL_ARRAY_BUFFER, sizeof(float) *vertexData.size(), vertexData.data(), GL_STATIC_DRAW);
	glBindBuffer(GL_ARRAY_BUFFER, 0);

by the way i tried taking the sine and cosine of both i and angle but neither of them work i just ended up using i since it made a full circle with a line but taking the sine and cosine of angle gave me more of a baseball shape.

That will generate something more like a star than a circle, because you’re passing [var]i[/var] to sin/cos instead of [var]angle[/var].

Like i already said sine i tried taking the sine and cosine of both i and of angle but i get a line in both cases i just went with i because it looked closer to a circle.
For example(sorry for using links by the way i just can’t get the images inserted for some reason.) this is the result of the sine and cosine of i:

and this is the sine and cosine of angle:

I missed this the first time:

sizeof(float) should be sizeof(Vertex). As it is, you’re only copying a subset of the array to the buffer.

Ah ok i see thank you so much!