Shocker's picture

TransformFeedback problem

Now I am trying for TransformFeedback .
I made a simple TF sample .
But this program causes an error at GL.LinkProgram probably because of "TransformFeedbackVaryings".

...
GL.TransformFeedbackVaryings(program, 1, new string[] { "feedback" }, TransformFeedbackMode.SeparateAttribs);
 
GL.LinkProgram(program);
GL.GetProgramInfoLog(program, out info);
GL.GetProgram(program, ProgramParameter.LinkStatus, out status_code);
if (status_code != 1)
{
    //Error
    /*
    Link info
    ---------
    error: Varying (named edback) specified but not present in the program object.
    */
    throw new ApplicationException(info);
}
GL.UseProgram(program);
...

Try changing 2nd argument of TransformFeedback to '0', the error disappers .
But, in rendering step , result of queries was zero .
This means the program couldn't write vertices into buffer object .

Could anyone tell me what is wrong in my code or show me a correct sample ?
Thanks .

I write down my PC's environments below . This may lead the problem to solving early .
OS : Windows Vista Home Premium SP2
CPU : Core 2 Duo T7500 2.2GHz
Mem : PC2-5300 2GB
GPU : Geforce 8600M GT (GDDR3 256MB)
ForceWare 186.81 (supports OpenGL 3.0)

Everytime, sorry for my english .

AttachmentSize
Form1.cs7.74 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Thanks for the code, I will test it as soon as I have access to a computer that supports transform feedback (probably around Monday or so).

If you would be so kind as to run one last test for me?

// Replace IntPtr varyings from the previous code with IntPtr[] varyings
// and pass an array, i.e. "new IntPtr[] { varying }"
delegate void glTransformFeedbackVaryings(int program, int count, IntPtr[] varyings, TransformFeedbackMode bufferMode);

The error "stemBrushesKey" indicates an out-of-bounds memory access (my previous code was invalid, as OpenGL expects a pointer-to-pointer-to-string, not a pointer-to-string).

Shocker's picture

Sure : ) I've tested .
the crash that I always get disappeared .
But I still get no result from TF . QueryResult are zero from "TransformFeedbackPrimitivesWritten"
and "PrimitivesGenerated" .

AttachmentSize
TFTest_GLControl.cs8.31 KB
the Fiddler's picture

Thanks. I'm out of ideas now. :/

The issue is that transform feedback works for at least some I don't know where the difference lies - at least not yet. My gut instinct says this could be an encoding issue (a mismatch between the encoding of the shader vs the encoding of the varyings, maybe?) but I have no way to test right now. I'll try running with mesa/soft to see if I can come up with anything.

zahirtezcan's picture

I am using OpenTK 1.0-beta-2 in Debug mode and got an InvalidOperation from ErrorHandler. Then I investigated the problem and 3.2 spec Table 2.11 answered the question. If you render with Triangles, TriangleStrip or TriangleFan then you should use Triangles as BeginFeedbackMode. After i have done that I got the attached messagebox

AttachmentSize
PrimitivesWritten.JPG12.04 KB
Shocker's picture

Oops : (
I'm sorry for my simple miss .
I should have read OpenGL Spec more carefully and have used GL.GetError .
Thank you very much for your advise : )
I'm sorry for the unnecessary problem the Fiddler .

Thank you .

Shocker's picture

The file is appended.

AttachmentSize
Form1.cs13 KB