Samsung / GearVRf

The GearVR framework(GearVRf) is an Open Source VR rendering library for application development on VR-supported Android devices.
http://www.gearvrf.org
Apache License 2.0
407 stars 217 forks source link

GVRConsole::writeLine() doesn't print text on screen #150

Closed dknaan closed 8 years ago

dknaan commented 9 years ago

GVRConsole::writeLine() used to print text for debugging purpose. Recently it doesn't print anything. I didn't check yet which commit broke it.

chenchao1407 commented 9 years ago

No. I think GVRConsole still works. As you may see in the solar system or gvrcollision, the stats messages are actually from a built-in GVRConsole.

Can you just tell me how you use the writeLine()?

dknaan commented 9 years ago

In SampleViewManager: I initialize: console = new GVRConsole(mGVRContext, EyeMode.LEFT_EYE); And then in onStep() I write: console.writeLine("test");

It used to work for me in the past and this is also what Jon used to write.

I don't see that writeLine() is called from the ViewManager of solar system or gvrcollision. Is it called from somewhere else?

thomasflynn commented 9 years ago

The Stats code uses GVRConsole and calls writeLine(). The solar-system sample uses stats.

From: dknaan [mailto:notifications@github.com] Sent: Wednesday, July 08, 2015 3:32 PM To: Samsung/GearVRf Subject: Re: [GearVRf] GVRConsole::writeLine() doesn't print text on screen (#150)

In SampleViewManager: I initialize: console = new GVRConsole(mGVRContext, EyeMode.LEFT_EYE); And then in onStep() I write: console.writeLine("test");

It used to work for me in the past and this is also what Jon used to write.

I don't see that writeLine() is called from the ViewManager of solar system or gvrcollision. Is it called from somewhere else?

— Reply to this email directly or view it on GitHubhttps://github.com/Samsung/GearVRf/issues/150#issuecomment-119750050.

dknaan commented 9 years ago

When I add stats to simple-sample the data is displayed on the screen, but when I call writeLine() from onStep() with similar code it doesn't. The main difference I see is that updateStats() is called from GVRViewManager::afterDrawEyes() instead of from onStep().

chenchao1407 commented 9 years ago

Did you attach the stats to any scene?

dknaan commented 9 years ago

The problem is the color of the background. The text is not really printed on the front (it has a depth), so it can be hidden behind the objects and also behind the background... As a result, a green text is not seen on a white background but it is visible on a black or a gray one.

This should be fixed if we want to continue to use it.

lassehe commented 8 years ago

I had issues with GVRConsole too. I suspect it was broken in some point because I remember using it earlier.

If GVRConsole writeLine is called during init the text quickly appears on screen but then disappears. Previous comment about text being behind objects does not seem correct to me, as the console is implemented as a post effect.

Like stated the status console in GVRScene works, though it looks very blocky and ugly. I didn't have much time to look at this now, but I suspect GVRConsole works there because it is constantly calling setEyeMode which in turn removes and adds post effects to cameras. Is it supposed to be like this? Anyway, at least my own GVRConsole started showing text when I added mConsole.setEyeMode(BOTH_EYES); to my onStep().

thomasflynn commented 8 years ago

@Liahim, could you check this out?

liaxim commented 8 years ago

@lassehe Please try this pull request: https://github.com/Samsung/GearVRf/pull/900. Does it do anything for you?

I checked out the GVRConsole and didn't find major problems with it. I did tweak how the final color is produced by the console's fragment shader. Also adjusted the default text size (if you use the current default nothing gets printed out since it is 1). But I didn't see any need to call setEyeMode from onStep.

The blocky text issue - the text kind of looks ok to me. Since it is a debugging facility I don't know how much prettier it should be. In any case, let us know if you have any suggestions.

lassehe commented 8 years ago

@liaxim Thanks, this looks like an improvement to me.

You are correct about GVRConsole, no major issues there. My apologies for false alarm. I just found (my) bug causing the GVRConsole to disappear. GVRConsole was created in onInit(), but I was using the constructor without GVRScene parameter, so the console disappeared as soon as the splash screen was gone. I hadn't even realized there was two different constructors. That is why adding a setEyeMode() call to onStep was keeping the console visible.

I find the GVRConsole constructor without GVRScene parameter to be slightly deceptive and unnecessary, but at least it looks to be documented well (only for the method with GVRScene parameter though).

I commented looks of GVRConsole mostly because I was remembering it looked significantly better in some point earlier, having a nice sharp normal text. Perhaps I'm remembering wrong. With this patch the text is definitely big enough if not too big (screenshots from gvr-solarsystem): After: solar_new Before: solar_old

liaxim commented 8 years ago

@lassehe I will update the demo apps to reflect the different default text size. Will see whether I can do something simple to improve a bit the text appearance.

liaxim commented 8 years ago

@dknaan Fyi, white or close to white would mess up the console output since the console used to add the colors (the actual rendered fragment color and the overlay color). I changed the calculation in the shader and the console output is more of an overlay now.

liaxim commented 8 years ago

@lassehe Enabled anti aliasing. Text looks much better.

liaxim commented 8 years ago

@lassehe The text size should be back to normal in gvr-solarsystem. Thanks for pointing out the problems.