void VideoEngine::DrawLine(float x1, float y1, float x2, float y2, float width, const Color& color) { GLfloat vert_coords[] = { x1, y1, x2, y2 }; EnableBlending(); DisableTexture2D(); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal blending glPushAttrib(GL_LINE_WIDTH); glLineWidth(width); EnableVertexArray(); DisableColorArray(); DisableTextureCoordArray(); glColor4fv((GLfloat *)color.GetColors()); glVertexPointer(2, GL_FLOAT, 0, vert_coords); glDrawArrays(GL_LINES, 0, 2); glPopAttrib(); // GL_LINE_WIDTH }
void VideoEngine::DrawLine(float x1, float y1, float x2, float y2, float width, const Color& color) { GLfloat vert_coords[] = { x1, y1, x2, y2 }; glEnable(GL_BLEND); glDisable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal blending glPushAttrib(GL_LINE_WIDTH); float pixel_width, pixel_height; GetPixelSize(pixel_width, pixel_height); glLineWidth(width * pixel_height); glEnableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glColor4fv((GLfloat*)color.GetColors()); glVertexPointer(2, GL_FLOAT, 0, vert_coords); glDrawArrays(GL_LINES, 0, 2); glDisableClientState(GL_VERTEX_ARRAY); glPopAttrib(); }