Posted By: DigitalDud | Apr 8th, 2007 @ 7:17 PM
page 1 of 1
Comments: 5 | Views: 5299
Anyone know the reasoning behind why Windows has such strict limits on GDI resources?  For example, I can only create about 300 or so windows because I run out of handles and things start crashing and bugging out.  This is under Vista, in this day and age.  Given that controls (buttons, etc) also get window handles, you can easily hit the limit running a few complex applications like Photoshop, VS, Maya, etc.

Edit: Nevermind,  it's because of the desktop heap: http://blogs.msdn.com/ntdebugging/archive/2007/01/04/desktop-heap-overview.aspx Still it's pretty crappy that these limits apply to Vista today.
DigitalDud wrote:
Anyone know the reasoning behind why Windows has such strict limits on GDI resources?  For example, I can only create about 300 or so windows because I run out of handles and things start crashing and bugging out.  This is under Vista, in this day and age.  Given that controls (buttons, etc) also get window handles, you can easily hit the limit running a few complex applications like Photoshop, VS, Maya, etc.
But I thought a window "handle" was more or less just a integer value (?) pointer. But yes, I have crashed things more than once with complicated image manipulations in PaintshopPro. I do know that using GDI to render things like text in video game is a lot slower than using something like DirectX or OpenGL. I'm also running into more than one book that tells me to "make my own fonts" rather than using anything GDI related.
thumbtacks2 wrote:
But I thought a window "handle" was more or less just a integer value (?) pointer. But yes, I have crashed things more than once with complicated image manipulations in PaintshopPro. I do know that using GDI to render things like text in video game is a lot slower than using something like DirectX or OpenGL. I'm also running into more than one book that tells me to "make my own fonts" rather than using anything GDI related.

Here's why GDI font is not an issue in games. At the game start-up, you use GDI to render all the glyphs you need to a texture, then at game run-time, you render your text out of that texture.

You take no performance hit & GDI is fast enough at start-up time that it's really insignificant.

This is how font works in the DirectX SDK, and how it will work in XNA. It's just plain 'ol GDI.

There are a couple of people out there that are actually converting TTF into real 3D objects for XNA though.
Minh wrote:
Here's why GDI font is not an issue in games. At the game start-up, you use GDI to render all the glyphs you need to a texture, then at game run-time, you render your text out of that texture.

You take no performance hit & GDI is fast enough at start-up time that it's really insignificant.

This is how font works in the DirectX SDK, and how it will work in XNA. It's just plain 'ol GDI.

There are a couple of people out there that are actually converting TTF into real 3D objects for XNA though.
Funny, I was thinking about that yesterday..."why not just dump all the characters into a bitmap (texture) and then pull what I need from that?" Right now I'm at the stage when I'm using display lists (and generating the glyphs in the startup section) and rendering by calling on those...not sure how the performance of that compares with using a texture instead. I'll try that...although making a font would be interesting, I'd much rather spend my time on other things.
thumbtacks2 wrote:
I'm at the stage when I'm using display lists (and generating the glyphs in the startup section) and rendering by calling on those...not sure how the performance of that compares with using a texture instead.

Note sure how GL implement "display lists" -- I'm not familiar w/ GL. They could employ a texture under the hood. I know that in hardware, textures has a minimum size & maximum size... and dimension of powers of 2. At worse, GL keeps that data in RAM & dump it to the graphics card when you use it, that may have perf implications for the AAA titles... Don't know if it will affect less demanding games so much.

thumbtacks2 wrote:

 I'll try that...although making a font would be interesting, I'd much rather spend my time on other things.
Agree.... More important to get things working than working fast.
page 1 of 1
Comments: 5 | Views: 5299