• Advertisement
Sign in to follow this  

[SharpDX] [DXGI] Trying to get the current display mode

Recommended Posts

Hello!

I am trying to get the current display mode resolution, refresh rate and pixel format with the following code:

var bounds = output.Description.DesktopBounds;
var mode = new ModeDescription
{
    Width = bounds.Right - bounds.Left,
    Height = bounds.Bottom - bounds.Top
};

output.GetClosestMatchingMode(device, mode, out ModeDescription match);

Here 'output' is the current output device. My first question is if the above code is correct? My assumption is that I can compute the current display mode resolution from the desktop bounds returned for the current output. Does that make any sense at all or is there a better way to do so? Then I call 'GetClosestMatchingMode' to get the current display mode, assuming that if I let the pixel format and refresh rate unspecified (all zeroed out), the function would fill them out with the values from the current display mode. Is my assumption correct? The above code seems to work fine on my machine, but that might just be a coincidence.

My second question is related to a particular error I am receiving. When calling 'GetDisplayModeList' and 'GetClosestMatchingMode' on my own desktop everything seems to work just fine. However, when accessing my PC via a remote desktop both methods would throw an exception with DXGI error 'DXGI_ERROR_NOT_CURRENTLY_AVAILABLE'. Is that expected or I am doing something wrong? My current workaround is to simply catch the exception and deal with it by assuming the available display modes cannot be determined, except for the current desktop resolution computed from the output bounds.

Any advice or insight regarding this would be greatly appreciated!

By the way, I have noticed that posting a code block would render it with black text on black background on my Chrome browser, making it extremely difficult to read, unless I copy-paste it to Notepad. Seems like a broken CSS perhaps? :)

Edited by vanka78bg

Share this post


Link to post
Share on other sites
Advertisement

According to https://msdn.microsoft.com/en-us/library/windows/desktop/bb174549(v=vs.85).aspx:

Quote

If GetDisplayModeList is called from a Remote Desktop Services session (formerly Terminal Services session), DXGI_ERROR_NOT_CURRENTLY_AVAILABLE is returned.

 

Edited by SoldierOfLight
Formatting.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Advertisement
  • Advertisement
  • Popular Tags

  • Advertisement
  • Popular Now

  • Similar Content

    • By Bokchee 88
      I am animator by hand, and i am doing game animation for at least 8 years so far. During the last 2 years, i came with a idea for game and maybe some day, i want to start indie game company. As i am thinking to start game company, i am also thinking what kind of value i can give to the company. For example, am experience in animation,sales(I was selling web development services, before i jumped to gaming), bit of rigging- just not for production, i am learning on the side as well. The rest of the gaming production, like modeling, concept art, texturing, i am total noob or to say better, i am no near interest to do modeling for example, don't have such a patience to do it. But before characters and things are made for animating, what the hell i am would do?
      Also, what is the ideal size of the founding team of a game company? Positions to be filled mostly are, Concept artist, Modeler/Texture artist, programmer, animator-rigger. And later would need more people to join, like more animators, programmers, sound, fx,etc.
       
      And lastly, do i need to have something,like a prototype, to show people and get them interest, or should i ask someone i know, for skill that i lack, for example, Modeling would be great, texturing and rigging, and to start all together from scratch?  
    • By Terry Jin
      Hi everyone! 

      I am from an indie studio that has received funding for our concept and is ready to create the next generation 2D Pokemon-inspired MMORPG called Phantasy World. This ad is for a volunteer position but hopefully will transition into something more. Our vision is to create a game that draws inspiration from the series but is dramatically different in both aesthetics and gameplay as the work would be our own.
       
      We are hoping that you can help us make this a reality and are looking for game developers familiar with the unreal engine and would be happy to work on a 2D top down game. Sprite artists are also welcome as we are in desperate need of talented artists! Join our discord and let's have a chat! https://discord.gg/hfDxwDX

      Here's some of our in game sprites for playable characters while moving around the game world! Hope to see you soon!
       


    • By Karol Plewa
      Hi, 
       
      I am working on a project where I'm trying to use Forward Plus Rendering on point lights. I have a simple reflective scene with many point lights moving around it. I am using effects file (.fx) to keep my shaders in one place. I am having a problem with Compute Shader code. I cannot get it to work properly and calculate the tiles and lighting properly. 
       
      Is there anyone that is wishing to help me set up my compute shader?
      Thank you in advance for any replies and interest!
    • By Katie Byrne
      F.OB: Forward Operating Base is a military themed base building and resource management game.

      I am currently about 6 weeks into development. still implementing core game mechanics. The game is playable in a basic sense right now but there are no objectives or missions or anything motivating really lol. 

      I have been inspired by games such as prison architect and rimworld. both in visual style and general gameplay ideas. Here is a quick 2 minute video i put together that hopefully communicates the general feel of the game and what gameplay is like. Any feedback or criticism is welcome
       
       
      I have been keeping a development diary on my youtube channel and i hope to have more developments on this project very soon. 

      UPDATE FEBRUARY 2018 - DOWNLOAD LINK FOR BUILD 0.38 AVAILABLE
      So i decided to upload the current build. hopefully get some feedback.

      Its still incredibly incomplete and poorly documented so please feel free to ask me any questions about how to do tihngs. I am working on better documentation and more intuitive interactions.

      Any feedback would be a huge help. positive or negative.

      https://drive.google.com/open?id=1WpgO5h1nHyTh5AGYX7kxeC9qnDZ_ByAX


      It's just a zipped Unity build. simply unzip and run the .exe no need to install anything

      Oh yes, there will be bugs  but please let me know if you find any and i'll do my best to fix them 
    • By Swift Katana Studios
      Do YOU play Horror Games; if so WHAT is your favourite and WHY?
      Hello! I want to develop a Horror Game for PC and Consoles, however, I need to understand WHY people enjoy playing Horror Games. 
      Here's a list of Questions:
      What's your favourite Horror Game and Why? What environment scares YOU the most? What Creature/ Enemy scares YOU the most? Do YOU like Maze's/ Labyrinths?  Do you enjoy Puzzles/ Riddles? Thanks for taking the time out of your day to read this topic, I appreciate it!
       
  • Advertisement