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

Hey guys, so I'm working on a game engine type thing right now and 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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  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);
}
Line 10 looks mighty suspicious after line 9. Do you really mean to take the cosine and sine of i and not angle?
oh whoops sorry, i should have specified i tried taking the sine and cosine of both angle and i but both of them return a similar result, the difference is cosine and sine of i make a full circle with a line but sine and cosine of angle make more of the shape of a baseball bat
Topic archived. No new replies allowed.