Well okay. Lets go into the details a little bit more. A triangle has 3 vertices in a triangle. Each vertex itself contains usually 4 coordinates x,y,z,w. Since you just want to draw a 2d ring, you don’t need the z component and you should not care about w either as a beginner. A VBO is just a reserved block of memory, where you put your vertex data. The VAO actually is some kind of manual for the GPU how to interpret the data in your VBO. Please go through the tutorials I have posted earlier to understand how they need to be set up.
So lets say you set up your VBO that the vertex data is arranged in a row. For example [v1x, v1y, v2x, v2y, v3x, v3y]. Your Vertex Shader (OpenGL 3.3+ [might be wrong about the version number]) should look like this:
#version 430
layout(location=0) in vec2 in_Position;
void main(void)
{
gl_Position = vec4(in_Position,0,1);
}
If you now make draw call for a single triangle, the following happens:
The vertex Shader is executed 3 times, cause you have 3 vertices. If you have setup the VAO correctly, the in_Position Variable of the first vertex shader run gets the values v1x and v1y. Then v2x and v2y and so on. The shown vertex shader itself just writes the x and y values to the internal gl_Position variable and adds the 2 missing values z and w. Writing to gl_Position sets the final position of your vertex. So try to create a triangle with this information and the tutorials. If you get that going, add a second triangle to your VBO by adding another 3 vertices to the VBO so that you have 12 entries. By copying two vertex coordinates (x,y) from the first triangle to the vertex coordinates of the second triangle you get a quad cause both triangles share two points. Also adjust your draw call, that it draws more than one triangle. The doubling of the entries is actually not best practice but lets keep it simple. Also watch out wich points they share, so that the triangles are not overlapping.
So if you are able to create a quad, then you can create a ring by connecting multiple quads by expanding your VBO and adding triangles to the draw call. You just need to set the coordinates of each triangle right.
If you want to draw a circle with a certain radius, your coordinate must fulfill the formula xx + yy = R*R. A ring is limited by a outer circle and a inner circle. I am sure you will figure out a routine to generate those vertex coordinates automatically.
If you finally got it, you can move the circle by adding the same x or y value to each vertex of your VBO. You can also scale it by multiplying every value in your VBO by a certain scaling value. But be aware. The circle should have x=0 and y=0 as its center and if you want to scale it, do that before moving it, otherwise you will also scale the movement.
Is it possible to convert numbers like 1.2345661 to a value between -1 and 1?
Probably, but first I need to know what the number is supposed to tell me. The rings diameter? its x-coordinate?