0
Hello, I’m venturing into Opengl and so far I know the basics of creating figures. I need to create a bar number that goes from 1 to 64, the problem is I need to do this with a FOR. When the first account of the for starts, it creates the first bar and when changing the counter it creates another bar and the first one disappears. From what I understand so far, it’s not like he’s creating another bar, it’s changing the position of the first.
Have some sort of do this as if it were a vector, type glBegin[jk] so I can create a set number of bars?
So friend, is that the word "indefinite" does not enter the dictionary of vectors haha you always have to define a pro vector size, no matter if it is dynamically or statically.
– Dev
Let’s say my vector is 64 elements, as I do to generate these 64 bars?
– Mateus Nícolas
Exactly, you understood in a correct way, he is not creating but just changing the position of the same
– Dev
Yes, but to create the other 63 I would have to repeat the code? There is no way to make a loop?
– Mateus Nícolas
Create a method, where you will pass the position to draw, type Gl,Drawsquare(position,...) then each time you will call this method inside your for, to be more precise, strip from glBegin to the end, and just do not put the while and put inside a method, then you call this method inside that goes and feeding its function... understand ?
– Dev
Or, you create a class with a constructor that are the position parameters that will be passed to the squares, then Voce creates a method that will feed through these parameters, creating the class, you can create a Vector of this class, then just instantiating it and feeding with different values.
– Dev
actually no, I just learned using glvertex2f
– Mateus Nícolas
You aidna will continue using glvertex2f
– Dev
When Voce speaks in method, he speaks in function?
– Mateus Nícolas
I was able to adapt some parameters
– Mateus Nícolas
Good guy, now order in your code haha
– Dev