Moving particles that form a cloth in OpenGL..?

Started by
2 comments, last by cgrant 3 years, 8 months ago

I am a bit stuck. I am trying to follow the following tutorial: https://viscomp.alexandra.dk/?p=147

The biggest difference is how I am using Opengl 3.0 and beyond, whereas the tutorial uses begin and end. Now, I never actually learned begin and end because I am new to OpenGL, but I was hopefully that my method of doing it was sufficient to see something happening.

I want to verify the deal with the array (or in my case vector) which contains the positions/textures/colours and so on. What I decided to do is to update that vector with the current position I think the particle will be at. If I output that vector with the simulation running, I can see that my values for the position are different, inside of that vector every frame, yet my actual simulation is completely still, as if nothing was happening.

Am I correct in thinking that I can simply alter the values inside my ‘vertices array’, which should then alter where it is showing on the simulation?

Advertisement

Can you post the code on GitHub?

I know a bit about OpenGL 4.x

If you know how to add vertex data to a vector, and use something like glDrawArrays, then the glBegin/glEnd code should be trivial to understand. The only difference is that you set the data using glVertex3f/glColor3f/glNormal3f, rather than glBufferData.

When you specify your vertex data to OpenGL, the data is referenced, it is copied. This mean altering the data in source pointer provided to OpenGL will have ZERO impact on the data OpenGL has in its buffer. The previous code that from the tutorial you are using is using immediate mode rendering which uses the data provided at that specific instance. This means if you alter the data and then use it in another immediate mode OpenGL call, OpenGL will use the new value. If you are not using immediate mode OpenGL, then you have to respecify the buffer contents so that GL will use the modified data. Its also hard to say as you have not posted any snippets indicating how you are specifying your vertex and or index data to the API.

This topic is closed to new replies.

Advertisement