DGL
https://delphigl.com/forum/

TextSuite problem - sometimes I see backgrou quads of text
https://delphigl.com/forum/viewtopic.php?f=19&t=11555
Seite 1 von 1

Autor:  SpaM [ Mo Feb 13, 2017 18:59 ]
Betreff des Beitrags:  TextSuite problem - sometimes I see backgrou quads of text

Hello,

I have another problem with TextSuite. I tryed to find a problem in my OpenGL code but without luck. Description of the problem: Sometimes when I start application I see background quads instead of text. Quads have color of text. When it happens, I must restart application to repair. So I do not think it is a problem in my code but maybe in TextSuite. Picture is attached.

What bothers me the most is that it only happens sometimes.

Any ideas?

Thanks!
SpaM

Dateianhänge:
Dateikommentar: Wrong and correct text display
example.png
example.png [ 2.5 KiB | 3372-mal betrachtet ]

Autor:  i0n0s [ Mo Feb 13, 2017 21:44 ]
Betreff des Beitrags:  Re: TextSuite problem - sometimes I see backgrou quads of te

Doesn't look like a problem of the text suite.
Please make sure that if you switch a state in OpenGL, you switch back once done with it.
It looks like you're disabling texturing. Can you add some debug control or so which will reenable texturing if the problem occures?

Autor:  SpaM [ Fr Feb 17, 2017 14:08 ]
Betreff des Beitrags:  Re: TextSuite problem - sometimes I see backgrou quads of te

Thank you for tip. I am disabling textures after TextSuite because than I not see other objects. I will take alook on it!

Autor:  SpaM [ Mo Feb 20, 2017 07:52 ]
Betreff des Beitrags:  Re: TextSuite problem - sometimes I see backgrou quads of te

Hello,

I take a deep look into TextSuite and all drawings are between glEnable(GL_TEXTURE_2D) and glDisable(GL_TEXTURE_2D). There is no reason why problem happens only sometimes.

Important note: I have several forms and each of them have own drawing code using OpenGL. This problem occur only on one of them. I compared them but no difference at all.

It is weird :(

Autor:  Lord Horazont [ Mo Feb 20, 2017 15:32 ]
Betreff des Beitrags:  Re: TextSuite problem - sometimes I see backgrou quads of te

I’m afraid, in this case you’ll need to provide more code, as minimal as possible.

regards,
Horazont

Autor:  Bergmann89 [ Fr Feb 24, 2017 19:23 ]
Betreff des Beitrags:  Re: TextSuite problem - sometimes I see backgrou quads of te

Hey,

did you enabled blending? You need Additiv Alpha Blending or Normal Alpha Blending:

Code:
  1. glEnable(GL_BLEND);
  2. glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // normal
  3. glBlendFunc(GL_SRC_ALPHA, GL_ONE); // additiv


Greetings Bergmann89

Autor:  SpaM [ Do Jun 29, 2017 07:15 ]
Betreff des Beitrags:  Re: TextSuite problem - sometimes I see backgrou quads of te

Hello all,

I am back. I thought that I solved this problem but it still appears "sometimes". I hate "sometimes" errors :(
I tryed all the advices posted here on this forum but without luck.

I know how to simulate the problem with about 50% success:

I have three forms. Each have its own OpenGL drawing (I have my own class). First form have never problem with drawing texts. Never! ... Second not have texts but third forum "sometimes" show filled quads instead of texts. When it happens, I must restart the Application. When I start the App, first form is visible. Than I jump to third form and text is ok too! But when I open / close second form and open back third form, I see quads instead of texts.... as I sad "sometimes".

I think it is bug of OpenGL. All drawings go through one code.... but maybe I am wrong.

Any idea what to do?
Thanks!

Autor:  berens [ Mo Jun 04, 2018 14:03 ]
Betreff des Beitrags:  Re: TextSuite problem - sometimes I see backgrou quads of te

Any updates concening this issue? I've got the very same problem.

I may refer to:

Another description of this issue:
https://delphigl.com/forum/viewtopic.php?f=2&t=11545&hilit=textsuite+context#p100785

Discussion about DC/RC issue with TextSuite:
https://delphigl.com/forum/viewtopic.php?f=2&t=9458

Earlier Thread about DC/RC issues:
https://delphigl.com/forum/viewtopic.php?f=10&t=11648

The DC/RC issues may not contribute to the problem, since I'm able to reproduce the problem without multiple DCs/RCs; I wanted to refer to them "pro forma" since the linked topics with this issue metionened above were (kind of) related to DC/RC issues.

I'm using Bergmann89's object oriented version of LossyX's Textsuite.

As far as I can see, the problem occurs after creating a lot (about > 20) of different fonts. Most interesstingly, i experienced that "Lorem Impsum" was rendered as "___I___" (_ means "Black Box" in this example). As you can see, the "I" (requireing only a very small Texture) can still be renderer, whereas TextSuite failed to create the texture for all other (bigger) Letters.

I can reproduce situations, where working and failed fonts are displayed.

Since the dimensions of each letter seem to to be correct, the problem might be in the TextSuit while reseting the AlphaValue for the Texture for each letter (since the entire "letterbox" is black --> 100% opaque) while the font texture is being created.

After freeing a few fonts and recreating a new one, text can be displayed as usual.

I insist that it's an error while creating the texture for the current font with TextSuite.

So how to solve this? There are multiple threads in this forum, mentioning this issue.

Unfortunately, afaik, there is no way to tell if the font has been created correctly or messed up. glGetError doesn't give any Error, nor do I get an exception from TextSuite.

A possible workaround would be an ErrorDetection-Function, which renders a single ("big") Letter like "X" to a texture. Then copy it to a Bitmap, and if ALL pixels are black, we've got the error, otherwise everything seems fine.

Somebody else got news or other ideas concerning this issue?

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/