Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Using JOGL's TextRenderer - Issues with multi-color text.  (Read 1434 times)
0 Members and 2 Guests are viewing this topic.
Offline Rejechted

Senior Member


Medals: 1
Projects: 1


Just a guy making some indie games :D


« Posted 2011-08-19 22:39:43 »

Hello, all.  We've come a long way since my last post about brightening entities, and are now working on implementing damage numbers via the TextRenderer feature of JOGL.  We're using a custom render delegate in order to provide a fancy looking outline, but I'm afraid that this is resulting in some bad things happening.



In this image you can see the enemies on the right taking four damage per tick from a "bleed" effect that draws its damage with a red color.  At the same time, I'm taking 34 "white" bullet damage, however, the '4' in "34" is being colored red as well.  I suspect that this is due to the Renderer using the same glyph vector for the entire font and not per text wrapper (a class that we built to hold information about text to be drawn).

The Render Delegate accesses the font color to draw the glyph vector in via a public static Color instance in our Text class that is updated each render call to be equal to the Color of that text.  I couldn't think of any other way to pass that color through to the Render Delegate; perhaps I'm finding out why.  Any suggestions?

Blog for our project (Codenamed Lead Crystal): http://silvergoblet.tumblr.com
Offline gouessej

JGO Ninja


Medals: 33
Projects: 1


TUER


« Reply #1 - Posted 2011-08-19 23:04:31 »

Hi

Rather use a different text renderer per color. The bug you have has been caused by one of my fixes. The memory consumption constantly increases without my fixes, I cannot remove them. You could almost use the new experimental text rendering API which is really faster.

Offline Rejechted

Senior Member


Medals: 1
Projects: 1


Just a guy making some indie games :D


« Reply #2 - Posted 2011-08-19 23:34:50 »

Can you go into detail on this new API?  We actually got unlucky and ended up with a legacy version of JOGL and are just now in the process of converting to GL2 (no shaders for now, so if the new API involves that, I'm out of luck for now.)

EDIT: Another unrelated yet equally frustrating bug:



Each of our "Text Data" wrappers has a color field as well as several others (scale, rotation, x, y) that we can adjust in our "dynamictext" via "velocities" that adjust the values of these fields over time.

When we use this to adjust the alpha of the color that is used to draw the image, weird stuff like the image above happens, almost as though calls to GL statements are being made under the hood that apply the changes to our text color to the rest of the rendering engine.   Huh

EDIT2: Seems like this bug actually isn't unrelated at all and that there's some quirk with the text renderer that prevents it from dynamically rendering multiple text objects with different colors in the same rendering cycle.  Instead of having each text object manually modify its own alpha over time, we had one global color that the renderer would look at for each text, and we slowly changed this color instead and were successful.

Seems like we need multiple renderers or this new API!

EDIT 3...

It seems like they were unrelated after all.  I now use Color.white for the first draw step in my render delegate that draws the glyph vector.  apparently this was what was causing the color bug.  

The alpha bug persists, however.

EDIT 4 (AKA I'm dumb.):

For anyone using a Color class implementation like Slick's or awt... Never use the static color object if you ever plan to alter it in any way.  For the base case of "white damage" I was passing the actual reference to the static object in Color and then altering its alpha.... thus spelling doom for every other image in our game.

Blog for our project (Codenamed Lead Crystal): http://silvergoblet.tumblr.com
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (76 views)
2013-05-17 21:29:12

alaslipknot (88 views)
2013-05-16 21:24:48

gouessej (117 views)
2013-05-16 00:53:38

gouessej (113 views)
2013-05-16 00:17:58

theagentd (125 views)
2013-05-15 15:01:13

theagentd (112 views)
2013-05-15 15:00:54

StreetDoggy (156 views)
2013-05-14 15:56:26

kutucuk (178 views)
2013-05-12 17:10:36

kutucuk (178 views)
2013-05-12 15:36:09

UnluckyDevil (186 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.078 seconds with 21 queries.