Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MatthewF

macrumors newbie
Original poster
Jun 27, 2010
21
0
Hey, currently I'm using this code to draw a line:
Code:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	// Enable blending as we want the transparent parts of the image to be transparent
	glEnable(GL_BLEND);
	
	glEnableClientState(GL_VERTEX_ARRAY);
	
	GLfloat* vertices;
	vertices = (float *)malloc(2*2 * sizeof(float));
	vertices[0] = point1.x;
	vertices[1] = 320-point1.y;
	vertices[2] = point2.x;
	vertices[3] = 320-point2.y;

	glVertexPointer(2, GL_FLOAT, 0, vertices); 
	glLineWidth(1.0*width);
	glColor4f(color[0], color[1], color[2], color[3]*0.5);
	glDrawArrays(GL_LINE_STRIP, 0, 2);

	free(vertices);
	
	glDisableClientState(GL_VERTEX_ARRAY);
	
	// Now we are done drawing disable blending
	glDisable(GL_BLEND);

I've tried line smoothing and such but it produces no results. Anyone have any tips on getting a smooth line?


Thanks,
-Matt
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.