so i want to render a 2D Curve. The data for this is provided through Blender as an .obj File. I also have an object loader which retrieves succesfully the vertices of the file.
Here is my window/display limits:
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(600, 600);
glutInitWindowPosition(0,0);
glutCreateWindow("examplke");
gluOrtho2D(0.0, 600.0, 0.0, 600.0) // Params: Left, right, bottom, top
glutDisplayFunc(renderDisplay);
And my display function:
void renderDisplay() {
glClearColor(1.0, 1.0, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 0.0, 1.0);
glBegin(GL_LINE_STRIP);
for (int i = 0; i < vertices.size(); i += 3) {
glVertex2f(vertices[i], vertices[i+2]);
}
glEnd();
glFlush();
And my .obj file Data:
v -6.010289 0.000000 0.980260
v -5.443917 0.000000 0.413888
v -4.899328 0.000000 0.000000
v 4.899328 0.000000 0.000000
v 5.487484 0.000000 0.326753
v 5.814237 0.000000 0.740641
l 1 2
l 2 3
l 3 4
l 4 5
l 5 6
So the question here is how exactly do i have to transform the vertex data to render my object correctly in relation to my display limits (Example: 600 x 600 Pixel). Im aware i have to do some GL_PROJECTION and GL_MODELVIEW Transformations. But even after reasearching i dont really understand how this can be done. Or might there be a way doing this via the Blender software?