Page 1 of 1

Sending data to OpenGL glBufferData

Posted: Sat Dec 22, 2018 6:06 pm
by Cronus99

I'm storing some vertex data in:

boost::circular_buffer<int> bufferData(200);

My class has a function to return a pointer to the address of bufferData.front():

int *getBufferData() {return &bufferData.front();}

Then i send this pointer to glBufferData:

glBufferData(GL_ARRAY_BUFFER, 200*sizeof(int), MyClass.getBufferData(), GL_STATIC_DRAW);

The screen renders, however i don't get the right coordinates to show almost looks as if openGL is plotting the addresses instead of the actual data in my circular buffer.

Can anyone confirm if this is the right way to send the data?

Re: Sending data to OpenGL glBufferData

Posted: Mon Dec 24, 2018 1:58 pm
by Cronus99
Okay, can confirm that this works.

What I was seeing was garbage values rather than addresses, was just doing it wrong.

Issue now is, how do I do it fast enough for real-time audio applications?

I am looking into openMP. Do you think openMP can help parellelize it while my graphics app is plotting it?

I ideally want a thread running that just aquires the audio samples and store it in a global vector. My graphics app will use this global vector for plotting glBufferData or glSubBufferData.