opengl – Converting pixel coordinates/size to open gl coordinates’ system?

Is there a formula to draw, for exemple, a (100 * 200) rectangle on (10, 10) (regular 2D ortho coordinate) using opengl ?

I have found no real define answers to this question on internet apart from this post :

https://gamedev.stackexchange.com/questions/17545/how-to-convert-pixel-coordinates-to-gl-coordinates-in-2d-space

But I honestly don’t understand what to do with this. It’s my first time using opengl instead of a library (like monogame for exemple) and I never tought drawing a rectangle to given coordinates would be this hard.

I have my game loop, rgb colors converted to again, this weird open gl stuff, etc.. but this coordinate system threw me off. Also glOrtho, whatever I do, wherever I place it, do not work. So that’s why I would rather find a formula to have my rectangle data (x, y, width, height) suiting opengl’s weird system.

2 days I’m just trying to draw a rectangle at (x, y).. I already regret using opengl.

My current drawing code (rect is just a class containing the rectangle coordinates & size) :

glBegin(GL_QUADS);
glColor(rect);

glVertex2f(0, 0);
glVertex2f(-100, 0);
glVertex2f(-100, 100);
glVertex2f(0, 100);

glEnd();

glFlush();

But what I wish to do is :

glBegin(GL_QUADS);
glColor(rect);

glVertex2f(rect.x, rect.y);
glVertex2f(rect.x1, rect.y);
glVertex2f(rect.x1, rect.y1);
glVertex2f(rect.x, rect.y1);

glEnd();

glFlush();

(don’t pay attention to glColor, this is a function I made that use my custom class Color (which convert hexadecimal color code to opengl colors). Each of my custom class rectangle have one)

where rect.x, rect.x1, etc.. are (x, y) 2D ortho coordinates converted to opengl’s gibrish when I create my rectangle like this :

(...)
{
    color = Color(new_color);

    width = magical_math_formula(new_width);
    height = magical_math_formula(new_height);

    x = magical_math_formula(2D_Ortho_X);
    y = magical_math_formula(2D_Ortho_Y);

    x1 = x + width
    (...)
}

Btw, I do this before any drawing :

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    glViewport(0, 0, screen_width, screen_height);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();