Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (623)
Games in Android Showcase (176)
games submitted by our members
Games in WIP (676)
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 2406 times)
0 Members and 1 Guest are viewing this topic.
Offline Rejechted

Senior Devvie

Medals: 2
Projects: 2

Just a guy making some indie games :D

« Posted 2011-08-19 20: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?

Silver Goblet Games' first released product:
Offline gouessej
« Reply #1 - Posted 2011-08-19 21:04:31 »


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 Devvie

Medals: 2
Projects: 2

Just a guy making some indie games :D

« Reply #2 - Posted 2011-08-19 21: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.

Silver Goblet Games' first released product:
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

BurntPizza (18 views)
2015-10-07 02:11:23

KaiHH (15 views)
2015-10-06 20:22:20

KaiHH (11 views)
2015-10-06 19:41:59

BurntPizza (24 views)
2015-10-06 19:04:48

basil_ (44 views)
2015-09-30 17:04:40

shadowstryker (22 views)
2015-09-29 15:55:06

TheSpaceHedgehog (28 views)
2015-09-29 01:58:48

GamerC4 (54 views)
2015-09-24 21:10:38

GamerC4 (71 views)
2015-09-24 21:09:48

htuy (28 views)
2015-09-24 04:57:24
Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
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!