PDA

View Full Version : Fence problem



KRONOS
05-05-2002, 01:20 PM
Hi...
My code looks a little like this:

for each face
{
if deform
apply deformation to vertices

for each pass
{
'apply' pass
glDrawElements
'remove' pass
}

if deform
remove deformation
}

But all my data is stored using VAR, so in order to the changes of the deformations being OK, I apply a fence just before the deformation, and then query it before removing the deformation. I wait until the fence is complete, then, only then, do I remove the deformation... but this doesn't work.

And I don't change the vertex data in the passes, just textures, lightmaps, some rotates to the texture matrix, etc...

Althought I may know why this happens: fences are used to know if a GL command as finished (making it possible to syncronize with the CPU). But what I'm doing is writing to memory, so even applying the fence, how would the GPU know that I finished writing?

I'm a bit confused here... please HELP!!!
Oh and sorry for my porr english http://www.opengl.org/discussion_boards/ubb/smile.gif
Well, thanks anyway...

knackered
05-05-2002, 01:31 PM
Please insert where you set the fence and query the fence into your psuedo code - so we can spot the mistake.

This is what I think you should be doing:-




for each face
{
wait_for_fence_to_finish

if deformed_previously
remove deformation

if deform
apply deformation to vertices

for each pass
{
'apply' pass
glDrawElements
'remove' pass
}

set_fence
}

KRONOS
05-05-2002, 01:44 PM
I don't know how to put the code like you did... http://www.opengl.org/discussion_boards/ubb/frown.gif

for each face
{
if deform
{
set fence
apply deformation to vertices
}

for each pass
{
'apply' pass
glDrawElements
'remove' pass
}

if deform
{
wait for fence
remove deformation
}

}

knackered
05-06-2002, 01:57 AM
To get the code to look like code, just do this:-
{CODE}
Do some code
{/CODE}

...only, change the curly brackets to [ and ]

BTW,
you're not using fences as they're intended to be used.