Begin/End Problem in Effects

Topics: Developer Forum, User Forum
Jun 13, 2008 at 1:09 PM
Edited Jun 13, 2008 at 1:26 PM
Hi there!

I have a problem with begin and end.
The error is the following:

"Begin cannot be called again until End has been successfully called."

I'm using the converted Animation Component Library for XNA 2.0.

I know why it is happening, but I don't know how I can fix it.

This is the code in ModelAnimator.cs:

currentEffect.Begin();

EffectPassCollection passes = currentEffect.CurrentTechnique.Passes;

int numPasses = passes.Count;

for
(int k = 0; k < numPasses; k++)
{
EffectPass pass = passes[k];
pass.Begin();
device.DrawIndexedPrimitives(
PrimitiveType.TriangleList, currentPart.BaseVertex,
0, currentPart.NumVertices, currentPart.StartIndex, currentPart.PrimitiveCount);
pass.End();
}
currentEffect.End();

In the drawIndexedPrimitives the debugger is jumping to the update event. after the update event the Draw event kicks in again(!) so he never reaches pass.End or currentEffect.End.

Can anyone tell me why this is happening or how I can fix this?

Regards
Enzi

edit: 
If you want to have a look at the project here is the download link:
http://chronos.feldmann-it.com/DwarfTest.zip

It's in Visual Studio 2005 and XNA 2.0.  

 


Jun 13, 2008 at 10:51 PM
Ok, I got the library to work. It was a mixed problem with XNA2 and inapropriate code.

Now I'm stuck with a model that is processed wrong.
Here's an image:
Image

It's a FXB file, when I view it in an external viewer, for example QT Fxb, it's shown the right way.
I guess I just need to rotate each vertex about the y-axis for 90 degrees and still hold the position.
I tried everything I could but didn't figured it out.

Maybe someone knows about this problem and can help me.

Regards
Enzi