Can I access the debug values in the bottom left?

Yea, is it possible to access the debug values shown in the bottom left? And how to do that?

Did you look at the code that displays them?

Sometimes a trip through the engine source code is both faster and will answer a few other questions along the way.

1 Like

I couldn’t find it

How did you look? Did you open the SimpleApplication.java source?

1 Like

No, I couldn’t find it because I don’t know what I am exactly looking for

I have found the StatsAppState but don’t know where the values come from

Okay the Statistics Class is propably what I am looking for but I don’t know how to get the object

How did you look? To be a better developer, you are going to have to read source code.

If you look at SimpleApplication.java you can see that StatsAppState.java is used (which you already know) because it’s what is touched when setDisplayStats() is calling.

From there, you can see how it’s displayed with something called StatsView… which is created:

Look at what’s passed to that constructor?

1 Like

I have found this line of code in SimpleApplication, can I just use that?
stateManager.getState(StatsAppState.class).getStatsView().getTriangleCount())

Did you look at that?

Or that?

Or that line up there?

You have everything you need to get the Statistics object and interrogate it. You just have to work around your own cobwebs to figure it out.

Here is the class:

You can look at StatsView.java to see how it’s used.

1 Like

Okay, thank you, I think i got it now.
Except this isn’t the correct way:

int[] data = new int[13];
app.getRenderer().getStatistics().getData(data);
LOGGER.log(Level.SEVERE, String.valueOf(data[1])); // triangle count

String.valueOf() is being called on an int primitive but expects a String object
try instead:

LOGGER.log(Level.SEVERE, data[1]); // triangle count

Not the correct way, why?

That is incorrect. String.valueOf() is precisely the way to convert an int to a string.
https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#valueOf(int)

2 Likes

My apologies to OP, I was under the mistaken assumption that a wrapper’s toString() method was the conventional way to convert a number to a String, and that valueOf() returned a numerical value (if there is one) from a String.

Thank you @pspeed for setting me straight.

1 Like

Is it the correct way or is there a better way to get the data?