Trying to understand how opengl draws/renders

So basically i am trying to understand what is happening when OpenGL draws

according to the theory i have read , the fragments that are generated by rasterization are then used to colour in etc with fragment shader

if i created a screen that is of size lets say 256 * 256 pixels and draw an image that is also 256*256 size in pixels, it makes sense that i get a 1:1 picture because each pixel has it set place

however then if i drawn a image of some size that is drawn over a rectangle which might be smaller than the window size lets say i raw the same 256256 image to a space that is 5050 pixels, how does the drawing process work?

as far as i have understood the fragment is not possible to be smaller then one pixel , and even if it is , it will only colour the pixel within which it falls on the screen

so what exactly is happening here?

Since drawing coordinates are in [-1,1] range, you can’t create a 256*256 image.
I may be wrong, but I think rasterize gives as many fragments as there are pixels ont the viewport.

OpenGL doesn’t draw “images”. It draws, points, lines or triangles (quads and polygons are essentially just multiple triangles). Each of these has its own rasterisation algorithm, which is described in detail in the specification.

If the vertices have texture coordinates, these are interpolated for each fragment generated by rasterisation. If fixed-function texturing is enabled, each fragment’s interpolated texture coordinates are used to sample the texture. The details depend upon the texture’s minification and magnification filters (glTexParameter() with GL_TEXTURE_MIN_FILTER or GL_TEXTURE_MAG_FILTER) and repeat mode (glTexParameter() with GL_TEXTURE_WRAP_S etc). The process is described in detail in the specification.

It’s also completely incorrect to say that OpenGL “draws” at all, because it doesn’t. Your graphics card draws; OpenGL just provides a means for your program to tell it what to draw.

Section 1.2.2 of the spec (I’m using 4.4 here) makes this explicit:

To the implementor, OpenGL is a set of commands that control the operation of the GPU.