Rendering triangle of course can be done with OpenGL1, 2, 3 or any other minor version. The thing that changes between versions is they way how you use API to submit geometry or anything else you want to do with GL pipeline.
For example, with GL1 you could do glBegin(..); glVertex(..); ..; glEnd();
Then in some minor GL1 version you could use client-side arrays with glVertexPointer. Then later you could use VBO from GPU memory.
With GL3 and up you are supposed to use only glVertexAttribPointer from GPU memory. And no more glBegin/glEnd calls.
Another example - shaders. With GL3 and up you are supposed to use GLSL to perform vertex transformation and fragment shading. If you use it, then your code won't work on anything <GL2 (or without some specific extensions). Although it would be pretty hard nowadays to find system that doesn't support at least GL2 or even GL3.
Of course you can still write code even with GL4.5 context that doesn't use GLSL to render triangle, and submits all geometry with glBegin/glEnd. But at that point you are really not writing GL4.5 code. You are writing GL1 code.