Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Weird effect after Draw_Texture  (Read 713 times)
lanso
Community Member
*
Posts: 62


« on: October 13, 2007, 02:45:00 PM »

Hi all!
I have some textures and texts showing fine, but when i draw a texture or a filled box, all texts after it appears with as filled box and i can't find the error, i've already changed the image file and the error persists, any ideias?

Here is the image before:


and after the command
Draw_Texture(_insidetexture, 200, 200, 300, 250, _backcolor.getRGBA());
or
Draw_FilledBox(200, 200, 300, 250, _backcolor.getRGBA());

i get:


All other textures are loaded with the same parameters and function, only changing it's position, and the same with all texts. I first draw all textures and then all the texts.

Any help will be welcome.
Thanks,
Lanso
« Last Edit: October 13, 2007, 02:50:02 PM by lanso » Logged
SylvainTV
Administrator
Community Member
*****
Posts: 4479


WWW
« Reply #1 on: October 13, 2007, 02:48:15 PM »

Looks like the alpha blending is not applied.

In what order do you call things (DrawText, Begin2d , End2d , DrawTexture) ?

Do you use any Setting changes ?
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
lanso
Community Member
*
Posts: 62


« Reply #2 on: October 13, 2007, 02:52:37 PM »

Hello!
Action_Begin2D()
draw all graphics
Action_End2D()
Action_BeginText()
draw all texts
Action_EndText()

The strange thing is that only some of the texts and filled, some are normal...
If i comment out the draw_texture/filledbox line, all is rendering fine.
Logged
lanso
Community Member
*
Posts: 62


« Reply #3 on: October 13, 2007, 03:03:29 PM »

Hi!
I managed to put it to work, but i still don't understand why it was happening.
I'm developping a GUI for my game and i have some elements (button, label, window, progressbar, so on).
So when i render the gui system, i first cycle through all created elements and draw all graphic part and then all text, so i draw first the button texture, and after all graphics of other elements, i draw its text (along with text of all others).
In the progressbar i forgot an 'if' do draw the inside texture or the filled_box for progressing and it was being rendering twice (one time for the graphics loop, and second for text loop).
I fixed it and it's fine now, but why when i draw the texture/filledbox twice the following texts were filled? (i have a window, buttons, some text for the first window, the progression bar, the second window, some radio buttons and other label, in that render order).

Thanks again,
Lanso
Logged
EagleEye
Customers
Community Member
*****
Posts: 321


WWW
« Reply #4 on: October 21, 2007, 07:13:15 PM »

In my own experience, you have to wrap each and every draw function with a begin/end, or you will get unpredictable results.  Things drawn first will be drawn over the top of things drawn later, etc...

People have told me this is not necessary, and slows down rendering, but I'd rather have slower predictable results, than fast unpredictable results.
Logged

Vermund - A Matter of Life and Death MMORPG
My TV Projects - EEGUI (A GUI for TV6.5 with .NET 2005+), Material Editor, tutorials, and more!
SylvainTV
Administrator
Community Member
*****
Posts: 4479


WWW
« Reply #5 on: October 22, 2007, 05:53:49 AM »

Basically :

Every 2D call that is between Begin2d and End2D is rendered only when End2d is executed.
And this doesn't include the text ! Text is independant from Screen2DImmediate, unless you use BeginText(True) for the text rendering, then it will use Screen2Dimmediate to render it.
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
EagleEye
Customers
Community Member
*****
Posts: 321


WWW
« Reply #6 on: October 22, 2007, 09:44:54 AM »

Yup, as I said... so in a GUI situation, where you may have a bunch of 2D render calls, then a bunch of text render calls, in any order, in a row, you'd better wrap each call with a begin/end, or you'd get unpredictable results... unless you were to keep a global flag of "last thing rendered was text" and say "if lastthingrenderedwastext then begin/end"... but then you have overhead in your if/thens instead of just doing the begin/end overhead in the first place.
Logged

Vermund - A Matter of Life and Death MMORPG
My TV Projects - EEGUI (A GUI for TV6.5 with .NET 2005+), Material Editor, tutorials, and more!
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks