Hi. I’ve had asked while ago about how to get 2 samplerBuffers working in GLSL and this was solved. However I implemented this to a bigger project. Basically what I need is to send down data with textures, compute and return with feedback. Something that GPGPU is for, but my video card is not supporting it. I wrote this first time and it yielded strange results, so I deleted everything and started piece by piece creating testing codes and when working, inserting those into project, but alltogether, it again acts strange and I’m hopeless. As I already was trying to solve it for first time I decided to put here whole solution (Visual Studio 2008), with everything neeeded to run.
Here it is:
As you will read through code I tried to wrote it best I can so everything is named after it’s purpose etc. Not just for you, but to be able check myself after first unsuccess. Everything related is just in scene.h/cpp and update.vert. You can run builded exe from Debug folder, but you’ll need some redistributables. Otherwise you’ll have to build it yourself, not a hard task I think. Shader is for loading interface and error checking, myGlMath is just for vector3f declaration and main just initialize glut and calls 2 functions, scene.init() and scene.update() which are essential.
What should be and isn’t:
Nothing is shown in graphic window, the center for whole app for now is just console which at this moment outputs: 0 0 5 0 0 5 - those are results for 2 calls of scene.update(). However these should be 2 2 5 2 2 5. Why you’ll find in code (just look with what values are initialized vectors).
I noticed that one samplerBuffer is working everytime without even binding texture unit to it with glUniform call. The decision of which one should that be is based upon alphabetical order. The one that is later is the working one.
I also noticed several other things which are commented in code arround activating textures. which is btw area of code causing whole trouble in my opinion, however I couldn’t find anything wrong.
As I wrote after I wasn’t successfull for first time, I deleted whole thing and was connecting pieces of working code. However I’m most probably doing something very wrong, which seems to me as working when it’s tested alone, but connecting it to together yields bad results and corruption.
What I’ve already tested:
To simplify your job, I’ll write about already tested areas, marked by seems alright comment at function definition. I’m sure about using vectors the way I’m using them for transfering data, I checked that with mapping buffers afterwards and printing values. Also I’m sure about getting sizeof whole class returns right size as it would be counting it by members. I’m also sure that Transform Feedback is properly initialized and working, because when you output in vertex shader constants, those are displayed in console without any problem.
No matter what I think, you may find my approach wrong so if you think that those are also wrong, feel free to tell me. As I said whole project seems to me alright, but these are areas I’m sure about.
I’d be glad if someone would find some time and look into this.