Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Open GL Coordinate system



  • Hi,

    Let's say I have two coordinate axis rendered correspondingly:

    @
    ...
    glBegin(GL_LINES);
    //y
    glVertex2f(-1.5, -1.5);
    glVertex2f(-1.5, 1.5);
    //y arrow
    glVertex2f(-1.5, 1.5);
    glVertex2f(-1.4, 1.4);

        glVertex2f(-1.5, 1.5);
        glVertex2f(-1.6, 1.4);
    glEnd();
    

    ...
    @
    @
    ...
    glBegin(GL_LINES);
    //x
    glVertex2f(-1.5, -1.5);
    glVertex2f( 1.5, -1.5);
    //x arrow
    glVertex2f(1.5, -1.5);
    glVertex2f(1.4, -1.4);

        glVertex2f(1.5, -1.5);
        glVertex2f(1.4, -1.6);
    glEnd();
    

    ...
    @

    I also have a .csv file from which read the data and store it in a
    @
    QHash<QString, QVector<float> >
    @.
    Now I need to plot the points that I have read from the .csv file into my "coordinate system".

    Q: How to evaluate my coordinate system in that way (let's say from 0 to 20), that the points read would be plot in the coordinate system w.r.t. that values.

    Example: The points read {2.4, 3.1}, {19.9, 1.7} must be plot w.r.t. to fact that the {0.0} is the crossroad of the axis (in my case {-1.5, -1.5}), and the end points of my axis are correspondingly X - {20, 0} (in my case {1.5, -1.5}) and Y - {0, 20} (in my case {-1.5, 1.5}).

    P.S. : theoretically I know that it some how must be translating my world coordinate system into mine, but that's all that I know, and have no idea how it is done.

    Thanks in advance.


Log in to reply