Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Text on top

Author
Message
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 1st Jan 2008 15:46
Hello, this could be an extremely dumb question, but how can I write text on top of the screen? The text is always hidden by some other sprites (in 2D scenario). What I want is to define depth for each object to be drawn, but I can't find out how. I tried the priority value (dbSetSpritePriority), but that doesn't help as I need it for text also.

Thanks.
Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 1st Jan 2008 17:07
Write the text, capture the image and paste the image to a sprite.

Happy Neew Year

Codger

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 1st Jan 2008 18:51
Well, ok, that's a solution, but a crazy one. It is not reasonable to write a text this way, that woul be a performance killer.

Something better, maybe more natural in GDK?
Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 2nd Jan 2008 01:14
On the contrary turning text into a sprite is a very simple process and sprites have almost no performance overhead once they are deployed.



Of course to write multiple blocks of text you would create a function.

Codger

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 2nd Jan 2008 07:50
Here is a function that demonstrates how efficient sprites can be when used for text



Codger

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 2nd Jan 2008 10:02
Quote: "On the contrary turning text into a sprite is a very simple process and sprites have almost no performance overhead once they are deployed."


Yes, once they are deployed. It's actually necessity to draw text as sprites whenever it is possible. However you didn't deploy them each frame, which I have to, because the text is not static. If you move the TextToSprite() call to the LoopGDK loop, you'll get zero FPS.

So, it is a performance killer for dynamic text. That's crazy. There must be some natural way in GDK, or this library is even more crappy than I thought :/

Anyway, thanks for your input.

Some other way?
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 2nd Jan 2008 12:07
Quote: "There should be a dbDrawSpritesFirst() function. Calling that will change the drawing order of sprites."


Yes, but that's not a general solution. What we need is an easy way to properly define the order of drawing all objects on the screen. Not just putting all objects on some heap and hope it ends well. Especially in a 2D game where the pixel write is commonly the bottleneck, it's absolutely necessary to define the z-order of all objects (including text) natively.

Why to draw a background, an object over it, a GUI background over the object, a GUI control object over the GUI background and a text over the GUI control, if the only thing you actually need to draw on those particular pixels is the text? That's a nonsense!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 2nd Jan 2008 14:44
There is Draw Sprites first and perhaps a drawsprites last function?!?

I've seen Green Gandalf demonstrate it nicely - made Objects and stuff appear smoothly in front of sprites... I imagine you can go the other "side" (up front) too.

You're a head of me here... I've been planning on sprite/image based text - and I will need it "in front" as well.

tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 2nd Jan 2008 16:09
Didn't try that, but the documentation says about these functions that it changes the order of sprites agains 3D objects. What I need is define sprite vs. text order.

Anyway, these functions are still a pure evil as I described before. It is important for a good performance the draw order to be well defined and the z-order too! It would be really unwise to force pixel overwrites where I know precisely what should be at the top. Why can not we use the z-buffer directly? It's being implemented on video cards for decades for a good reason! Take this as a pure rant. I should rather direct my questions to GDK devs... can't believe this is a serious product
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 2nd Jan 2008 16:24
Quote: "You have full control over it! Just use dbPasteSprite() instead of letting Dark GDK draw the sprites for you, then you have every possible control over the drawing order."


Thanks for the info! The documentation says nothing about such a behavior, but that's a good news. Will try later.

Quote: "That's not possible. Text is directly drawn to the surface in the moment you call the corresponding command. There's no way to add priority levels here (since text is not an object which can have Z-information). You can only define whether the surface is updated first or the sprites are rendered first."


I'm not calling for priority levels, but a common depth information, which is automatically used by the hardware. So it is possible and it's rather simple. The text is drawn as a simple textured quad AFAIK so there really can be z coordinate (depth) used.
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 2nd Jan 2008 17:11
Quote: " There's no text object created that you could assign depth information to."


Exactly, and that's what I'm criticizing.

Quote: "It's not as simple as you might think."


It's not that difficult as you might think. Actually it's pretty easy to implement. And that's why I'm shocked that GDK doesn't provide such functionality.

Quote: "dbDrawSpritesFirst() is exactly what would solve your problem. Or using dbPasteSprite()"


Would be, if I had the text in sprite. Unfortunatelly I don't and using dbGetImage is a performance killer.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 2nd Jan 2008 19:01
tempicek - I made a Class called simply "Pixel" Grid. It basically makes a memblock - for pixels. But the first 12 bytes are three dwords: width, height, depth (32 is all I use... I didn't write anything to handle any other format).

I'm using this with my "Shaderless Shader" (cheap Terrain Splatting via supertexture tiled imageS - procedural terrain rendering one might say).

Works fine. My point is I'm hoping this works faster...as there is a Make Iamge From Memblock Command that I can use from this PIXELGRID Class (with aforemention Memblock associated with it)

Maybe something like this will help squeeze some speed... (Plus it allows copying from one PIXELGRID to another at the pixel level. I figure its probably faster than getimage. Maybe not... but I figure do all the rendering out of VIDEO LAND... then when Ready - convert to image and display it.

Dunno... I do find some things hosed here and there like you - especially as I learn more about the newer gfx tech etc... but I wouldn't of got as far as I did as quickly if it wasn't for DarkBasic and DarkGDK (Which I paid for... so I had a jump on this) and now - I am more aware of what should be available... and frankly - I have a lot of fun - I'm not trying to run a business on it.... and if I was - I'd say be creative - find a different way... Because many things it does I like - kinda think "Quirck For Quirk" they are having a better run than alot of software vendors... Especially for the price.

There was this one engine I looked at while hunting for stuff to use... $1000 and I looked at what it did and how it did it... the more I saw how it worked - the demos etc... I was NOT Impressed - and the scary thing was they report being used often for educational environments for sErious 3d Developers.... BAH!!!

DarkGDK is Fun! .... 99% of the time, and 85% of all statistics are made on fly in conversation!

Happy New YEAR BTW

P.S. Along these lines - I'm thinking I want GUI in FullScreen OR NOT... and thought this image technique might be the WAY to do it. Render Everything... Like a OldSchool TEletype - except its a "PIXELGRID" versus ASCII... and then only convert to a image after making changes outside the pipe line... like my own private little "DISPLAY CANVAS" overlay.

I don't know ...many say this sux or that ... but... Then I see some of these guys code and go... WELL NO WONDER its slow... but then there are definately numerous GREAT CODERS on here who report stuff too... like yourself - I try to take it all in and get by as smoothly as I can etc. I'm sure you do too.

tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 2nd Jan 2008 22:15
Quote: "Works fine. My point is I'm hoping this works faster...as there is a Make Iamge From Memblock Command that I can use from this PIXELGRID Class (with aforemention Memblock associated with it)"


Not sure how you implement this, but there's a rule these days -(almost) whatever you want to do, it's faster to do it on GPU. So if you are doing this on CPU, it's still probably a bit slow (although it must be faster than the crazy dbGetImage call). However if you make this on GPU (all data stored on local graphics memory), that's definitely a performance winner. These memories are bloody fast these days (though not fast enough ).

Basically, I could do this. I can write a text to a texture, keep the texture as long as possible (until the content changes) and redraw it then. With some optimizations like grouping repetitive blocks of letters, words or even phrases I can make a fast text renderer out of it (actually I already did it in previous projects). Or when it comes to some API, hell, I can even use the DXUT library for text drawing. But why would I use the GDK then? Isn't it supposed to do such things? What is it for then if not preventing me from writing the same boring code for different project again and again?


OT:
Actually, seeing what GDK can do, I have to say, that most of the functionality is provided by the DX extension itslef (or DXUT), which you have to install to the target platform anyway, because GDK uses it. This leads me to the same question - what is it for then?

Quote: " they are having a better run than alot of software vendors... Especially for the price."


your experience differs a lot from mine then. But that's very likely because of the fact that I was looking for some serious dev tool, which GDK is not, so I will have to find another one and stay with the XNA untill I find some.
Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 3rd Jan 2008 07:22
tempicek
What is it you want. You thread requested help with text on top. All you do is complain that nothing meets your needs.

The world is full of critics and if

Quote: "But that's very likely because of the fact that I was looking for some serious dev tool, which GDK is not"
you are far too elite for this group..... or more likely just another poser

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
Pixel Perfect
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 3rd Jan 2008 09:32
@tempicek

If you want a serious development tool then spend some serious money, otherwise you are going to have to compromise a bit, as the majority of us have to, with something that is less than perfect.

GDK is not and has never been aimed at professional games development houses but at amateurs and small indi game developers.

I understand your frustrations but it's no good venting them at people who are genuinely trying to help!

No matter how good your code is, someone will improve on it
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 3rd Jan 2008 11:14
OT:
Quote: "You thread requested help with text on top. All you do is complain that nothing meets your needs."


Sorry for that. That was a reflection of my momentary disappointment.

Quote: "I understand your frustrations but it's no good venting them at people who are genuinely trying to help!"


Sorry again.

</rant>

Login to post a reply

Server time is: 2024-09-29 09:18:45
Your offset time is: 2024-09-29 09:18:45