PDA

View Full Version : TBO and Transform feedback project problem



DarkRaven
03-28-2011, 09:24 AM
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:
http://cid-9660544f409b48ef.office.live.com/self.aspx/.Public/Solution.zip

About code:
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).

Notes:
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.

Why asking:
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.

McLeary
03-28-2011, 10:12 AM
Are you sure you can use the image format GL_R32F in glTexBuffer()? The Image Formats session of http://www.opengl.org/wiki/Buffer_Texture does not mention float format.

This is just a guess, I never use Texture Buffers before.

Alfonse Reinheart
03-28-2011, 10:59 AM
The Image Formats session of http://www.opengl.org/wiki/Buffer_Texture does not mention float format.

Are you sure?


The format can be any of the various types, like unsigned normalized, floating-point, signed integral, etc.

Emphasis added.

McLeary
03-28-2011, 11:18 AM
Oops, my mistake

DarkRaven
04-01-2011, 11:48 AM
Well maybe it's quite big task to analyze whole solution and find something, but let's start whit reproducing problem first.. could anyone please tell me what console output he gets when he runs this? It might be the most important thing, because searching for bug in code while it's hardware related would be waste of time. The only thing you need is GLSL 1.40 or better 1.50..
Thanks

DarkRaven
04-01-2011, 04:58 PM
Ok I think I got it it was just some linkings and libraries.. can be closed/deleted...