Forcing a screen update (for debug)

Im working on an algorithm that I know has some bugs in it. To try to get to the bottom of it i’m adding assorted debug shapes etc to the scene. However, it would be useful to be able to watch the algorithm make its changes within a single update loop.

So what I would want would be:

simpleUpdate begins
BREAKPOINT - start stepping through the code
algorithm makes some changes puts in some debug shapes
FORCE SCREEN UPDATE
algorithm makes some more changes, takes out old debug shapes, puts in some more debug shapes
FORCE SCREEN UPDATE
etc etc etc
simpleUpdate ends

Is this possible?

Obviously this would be extremely bad practice for anything except debug

Not really possible, sorry. There’s a lot going on after each frame. It is used for frame synchronization, handling signals from OS, etc.

2 Likes

Just split your simple updates up into different methods and call one each frame.

i.e.
[java]
int framecounter = 0;

void simpleUpdate(float tpd) {
switch (frameCounter++ %3) {
case 0:
// Do stuff 1
break;
case 1:
// Do stuff 2
break;
case 2:
// Do stuff 3
break;
}
}
[/java]

Just change the number after the % and add new case statements as needed.

Breakpoint at the start of a case statement and you will then always stop the program after the previous step has completed and been rendered.

I had a feeling it might not be possible, just checking. Thanks for confirming

Zarch’s solution is simlar to my current work around, I make sure the calculation is the same each frame then render a different part of the process each frame