OpenGL question

Post your questions, suggestions and experiences regarding to Image manipulation, 3d modeling and level editing for the Irrlicht engine here.
Post Reply
Alpha Omega
Posts: 288
Joined: Wed Oct 29, 2008 12:07 pm

OpenGL question

Post by Alpha Omega »

When you create a VBO with OpenGL and buffer vertex data to the graphics card via glBufferData(), is it possible to then buffer the data off the card after applying a shader?

I basically want to use OpenGL shaders to run array processing. Therefore I need input and output. I am aware that you can declare out variables in GLSL but haven't come across any examples where they use GLSL to buffer data to the GPU run a calculation and then buffer it back to use it. I know there is a way but unsure of what functions to use.

Any help on this is appreciated. :D
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: OpenGL question

Post by Mel »

I guess it is posible using transform feedback, though Irrlicht still doesn't support such feature. Using transform feedback you may transform a vertex buffer using a shader, and retrieve it later, already transformed, for further usage, so the shader is applied once, but the transformed vertex buffer can be used many times.

I don't know if this may be of any help to you...
http://www.opengl.org/discussion_boards ... m-feedback
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Alpha Omega
Posts: 288
Joined: Wed Oct 29, 2008 12:07 pm

Re: OpenGL question

Post by Alpha Omega »

Thanks Mel! However before I embark on this path I might also ask if this method would be equally as fast as using OpenCL to do the array processing instead of OpenGL. I have a portion of code I think will run much faster on the gpu than the cpu and its not directly related to graphics.

Would having an OpenCL and an OpenGL context in the same application be smart, or just use OpenGL and hack it to make it do what I want?
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: OpenGL question

Post by Mel »

OpenCL is designed to make use of the GPU to accelerate calculations of all kinds, so i guess it is a good idea to have OpenCL set up instead of hacking OpenGL because i think that OpenCL was made with purpose of retrieving the results of the calculations from the GPU so the whole system could benefit from them
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Post Reply