Page 8 of 18 FirstFirst ... 678910 ... LastLast
Results 71 to 80 of 179

Thread: nxPascal

  1. #71
    Sorry, there is no easy answer to either of them. Not something i have tested or needed.

    1) I was hoping LazOpenGLContext would have had fullscreen property, but it doesn't. Lazarus crew propably relied on SDL with it, of which i have no experience. It is possible to adapt SDL window and use nxPascal with it in NX_CUSTOM_WINDOW mode, explained in demos and begin of nxGL.pas, but this specific window i haven't tested.

    So what remains is non-crossplatform ways, like directly using WinAPI. Maximizing window, showing it on top of everything and hiding taskbar. As you can imagine that doesn't cope well with Linux with multiple taskbars and other widgetsets.
    There was some discussion for windows. You can find more with search terms something like "delphi fullscreen graphics". Maybe if it's something simple, i might integrate it to nxPascal itself.

    2) At this point there is no font saving or loading. There is another inherited constructor to TGLFont class, which takes just texture-size as parameter (must be square), but loading just that you can't tell how wide each character is. That needs to be loaded from file, or calculated on load from TCanvas fonts. Relevant data goes to charW: array[32..255] of shortint; and textureI: integer; which is index to manually loaded font texture (which is only needed if you want to call font's SetTexture-method). Basically the font class itself supports any kind of fonts, even if they don't exist in Windows system at all. To use such fonts, an editor should propably created, or possibility to use some existing font format of other editor, that includes texture file.

  2. #72
    no problem, thanks for answers

    1) Unfortunately maximizing window is not solution for performance. Full scrreen mode give more FPS and i think picture looks more "stable" (less flickering). For development this is not important, but in the final product would be missing. Bad if its possible only with third-party party libraries like SDL, glut etc. In future i will try it.

    2) Ok, i plan add texture atlas, font is same

  3. #73
    Quote Originally Posted by User137 View Post
    So what remains is non-crossplatform ways, like directly using WinAPI. Maximizing window, showing it on top of everything and hiding taskbar.
    You don't need to hide taskbar. Once you set window to cover the entire screen area, the taskbar is hidden by default.

    Quote Originally Posted by JC_ View Post
    1) Unfortunately maximizing window is not solution for performance. Full scrreen mode give more FPS and i think picture looks more "stable" (less flickering). For development this is not important, but in the final product would be missing. Bad if its possible only with third-party party libraries like SDL, glut etc. In future i will try it.
    In our experiments, there is absolutely no performance difference between exclusive full-screen and non-exclusive full-screen modes. In exclusive full-screen mode you get one less copy operation, but even on Intel integrated cards this is not a problem. Most video players go non-exclusive route anyway as to not mess up with your display. So, FPS is basically the same. Regarding "stable" picture and flickering - as long as you enable VSync, it is exactly the same also.

    Exclusive full-screen mode was important roughly 10 years ago when video card's memory was still relatively slow, so to save one BitBlt operation. Now, when you would use pixel shaders for advanced effects such as shadows and reflections, a single blit/copy operation's impact on performance is negligible. In fact, exclusive full-screen mode can be considered now quite intrusive as it can be harmful to multiple desktop configuration and switching between exclusive and non-exclusive modes can produce flicker and mess up with your desktop.

    P.S. Although, doing rendering in very high resolutions and non-exclusive full-screen mode may still have quite an impact on video memory usage, and even on blit operation, especially considering retina displays getting common these days. But this is the same problem traditional non-full-screen applications need to overcome as well.
    Last edited by LP; 18-11-2012 at 05:53 PM.

  4. #74
    Quote Originally Posted by Lifepower View Post
    In our experiments, there is absolutely no performance difference between exclusive full-screen and non-exclusive full-screen modes. In exclusive full-screen mode you get one less copy operation, but even on Intel integrated cards this is not a problem. Most video players go non-exclusive route anyway as to not mess up with your display. So, FPS is basically the same. Regarding "stable" picture and flickering - as long as you enable VSync, it is exactly the same also.
    I disagre with this. As you probably know AERO desktop on Windows Vista and newer save contents of each whole window (window texture) from every non minimized program which is running. And theese are stored in Graphic Memory. This means that more programs you are running higher is GPU memory consumption. For instance on my laptop I curently have two active programs running (Winamp and Proces Explorer from Sysinternals). So curently my Graphic memory consumtion is 37,8 MB. Sure this seems almost nothing compared to 512 MB of Graphic memory but if I open more programs Graphics memory consumption will increase.
    For instance opening notepad increases Graphic memory consumtion to 39,3 MB and just Maksimizing notepad raises Graphic memory consumtion to 41,8 BM. So you see how quickly can you fill up large protions of Graphic memory.
    And since computer games often require large amounts of Graphic memory you will want to make as much of graphic memory available to them as posible. And you actually do this by running your game in FullScreen mode as this causes Windows to move all information for other programs from Graphic memory either to RAM or into Swap Page (usually RAM but can be later moved into swap if RAM consumption increases).
    Another thing in AERO desktop is that window contents (window textures) are updated even if this window is behind some other window (not shown directly). Eventually this means that more windows are open more work is needed for graphic card to update contents of all of theese textures.
    So yes running some game in Windowed mode could hurt it's performance if you have other programs open at the same time.
    On Windows XP and older there was not much problem with this as only visible pats of each window were updatet at any time and there was only one texture used for whole screen (more when some applications were using overlay surfaces).
    Sure it is posible to temporary disable AERO desktop on Windows Vista and newer but from my expirience this can cause even more problems as you need to make sure that swiching from your application will reenable AERO desktop and then switching back will disable it again. And in case of application crashing aero desktop might not get reenabled properly. So user reloging or system restart is needed.
    Also tranzition between AERO desktop and clasic desktop can take even to few seconds of time depending on the number of open programs.
    So using this approach isn't recomended. It is only included in newest Windows versions as backward compatibility for some older programs.

    Quote Originally Posted by Lifepower View Post
    In fact, exclusive full-screen mode can be considered now quite intrusive as it can be harmful to multiple desktop configuration and switching between exclusive and non-exclusive modes can produce flicker and mess up with your desktop.
    Yes I agree that it can be a bit intrusive becouse if you use multiple monitors they will just go blank. This is due the fact I wrote above when in FullScreen mode windows only process window changes of the application which is ran in FullScreen mode.
    As for flickering this is only present becouse Windows needs to move some data (window textures) from normal meory back to Graphic Memory so that it can be used for rendering other applications windows.
    And on Windows XP or older there can be a bit more flickering since all windows needs to be redrawn compleetly and we all know how slow canvas redraws are. (GUI from Windows XP and older is canvas dependant while Windows Vista and newer using Aero desktop means that whole GUI is DirectX overlay surface based which alows much faster redraws).

  5. #75
    Actually, for every game that i play, i use windowed mode. Be it most can do it maximized windowed mode (taskbar appear behind game window). I should propably research how to do that, be it i'm propably having to IFDEF it to windows only. Anyway, the speed at which you can Alt+Tab when your game resolution is same as desktop resolution, is very fast. In addition you can use webbrowser or music player on top of your game screen. It's a huge benefit. I have never seen any actual performance gain when using desktop resolution fullscreen mode.

    Have you played Skyrim? It's one example of games that do fullscreen mode BAD! Apparently the whole "fullscreen mode" subject is not so self-explanatory for many official game engines. When you alt+tab back in game, it only shows you black screen. You have to alt+tab again for it to switch to game screen, incredibly annoying, especially if you have many windows open. I just want to stay the furthest away from fullscreens as possible. Then there are many more games that can simply just crash when you switch to fullscreen mode. Windows OS has very obviously never been made for that kind of display state change.

    As for font issue, there are options to go, but maybe the best one is:
    Make commands nx.CreateAndSaveFont() which you call just once, and nx.LoadFont(). I could make for example format .nxf, which would stream in the font widths and texture data with compression stream. I have already practised its use in nxData. It would be simple to have everything of 1 font in 1 file, instead of separate image and data files. Besides there is no simple code to save PNG in both Delphi and Lazarus. Added benefit is that the texture data would be straight in OpenGL compatible mode, making the loading much faster than from PNG.

  6. #76
    PGDCE Developer Carver413's Avatar
    Join Date
    Jun 2010
    Location
    Spokane,WA,Usa
    Posts
    206
    I am using freetype2 to create texture maps on the fly. I'm not having any delays so why not just use that ?

  7. #77
    I don't know anything about freetype2. There isn't much of information with google either. I find TFontManager class in fpc, but seems cryptic. Are you really sure it's faster? It might support more font types though. Not all fonts can be drawn to TCanvas. (Also this wouldn't fit in Delphi right?)

    Size 9 "Arial"-font with full character table loading takes, with different texture sizes:
    256 -> 109ms
    512 -> 374ms
    1024 -> 1500ms
    You should always use smallest possible texture size, where characters still fit in. I managed to optimize bitmap loading slightly for fpc, but the numbers were pretty same as before.

    Font saving to bitmap already exists, through setting nxGraph.NX_SaveFontBitmap:=true; , it will save it to 'FontBitmap.bmp' when loaded.
    Attached Images Attached Images

  8. #78
    PGDCE Developer Carver413's Avatar
    Join Date
    Jun 2010
    Location
    Spokane,WA,Usa
    Posts
    206
    I really have no idea whether it is faster, 1500 ms doesn't seem like it is worth worring about. I create one very long bitmap and use it that way but I dont use opengl to render my gui but rather send the final product to opengl. this way it only needs to be redrawn if something changes and because there are so many effects that can be applyed that I could not do in opengl at this time. some day perhaps. anyway the documentation on the freetype2 website is really good and is what I used. I found the fpc solution rather overkill myself. one of the commands was missing from the pascal header so I had to add that in myself.

  9. #79
    Quote Originally Posted by SilverWarior View Post
    As you probably know AERO desktop on Windows Vista and newer save contents of each whole window (window texture) from every non minimized program which is running. And theese are stored in Graphic Memory. This means that more programs you are running higher is GPU memory consumption.
    Since you are talking about AERO, please check WDDM, which allows video memory paging. What this means is that technically the video memory is not bound by the limitations you explained. In other words, you may stop worrying that you'll end up without video memory on Vista+.

    Quote Originally Posted by SilverWarior View Post
    As for flickering this is only present becouse Windows needs to move some data (window textures) from normal meory back to Graphic Memory so that it can be used for rendering other applications windows.
    And on Windows XP or older there can be a bit more flickering since all windows needs to be redrawn compleetly and we all know how slow canvas redraws are.
    Flickering is caused by rendering being out of sync with vertical retrace, therefore enabling VSync resolves the issues in most cases. Please do not confuse or mix Windows XP and Windows Vista+, as the two use very different approaches and completely different driver models.

    Quote Originally Posted by SilverWarior View Post
    (GUI from Windows XP and older is canvas dependant while Windows Vista and newer using Aero desktop means that whole GUI is DirectX overlay surface based which alows much faster redraws).
    Not according to the following:

    In Windows Vista, all Windows applications including GDI and GDI+ applications run in the new compositing engine, Desktop Window Manager which is built atop the Windows Display Driver Model. The GDI render path is redirected through DWM, and GDI is no longer hardware-accelerated by the video card driver. [4][5] However, due to the nature of desktop composition (internal management of moving bitmaps and transparency and anti-aliasing of GDI+ being handled at the DWM core), operations like window moves can be faster or more responsive because underlying content does not need to be re-rendered by the application.
    Actually, it's Windows 7 that brings back hardware acceleration to GDI, but on Windows Vista it's made entirely in software. [Reference]

  10. #80
    Quote Originally Posted by Lifepower View Post
    Since you are talking about AERO, please check WDDM, which allows video memory paging. What this means is that technically the video memory is not bound by the limitations you explained. In other words, you may stop worrying that you'll end up without video memory on Vista+.
    Yes I know this. T
    he reason why I havn't mentioned this is becouse we were discusing perofrmance. And if you go and benchmark Grphic card performance when it is only using its internal Graphic memory or when using Extended graphic memory (some data may be loaded in RAM) you will clearly see performance diferences. The rason for this is the fact that Graphic card can read information from its internal graphic memory much faster than reading this information from RAM especially if some other part of your application is heavily utilizin RAM for some other things.

Page 8 of 18 FirstFirst ... 678910 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •