Cronus99
Posts: 11
Joined: Wed Aug 15, 2018 9:15 pm
Location: India

Sending data to OpenGL glBufferData

Sat Dec 22, 2018 6:06 pm

Hi,

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 up..it 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?

Cronus99
Posts: 11
Joined: Wed Aug 15, 2018 9:15 pm
Location: India

Re: Sending data to OpenGL glBufferData

Mon Dec 24, 2018 1:58 pm

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.

Return to “OpenGLES”