Vector in Opengl

Asked

Viewed 110 times

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.
inserir a descrição da imagem aqui

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.

  • Let’s say my vector is 64 elements, as I do to generate these 64 bars?

  • Exactly, you understood in a correct way, he is not creating but just changing the position of the same

  • Yes, but to create the other 63 I would have to repeat the code? There is no way to make a loop?

  • 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 ?

  • 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.

  • actually no, I just learned using glvertex2f

  • You aidna will continue using glvertex2f

  • When Voce speaks in method, he speaks in function?

  • 1

    I was able to adapt some parameters

  • Good guy, now order in your code haha

Show 6 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.