vanka78bg

Members
  • Content count

    42
  • Joined

  • Last visited

Community Reputation

534 Good

About vanka78bg

  • Rank
    Member

Personal Information

  • Interests
    Programming
  1. 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?
  2. DX12 to Vulkan

    Porting a large game like Tomb Raider to another platform and rendering API would never be easy. The question is whether it is profitable to do the port or not. If it is profitable then a large studio could spare the resources.
  3. Many of these tips apply to game development in general, and not solely to Unity. This doesn't make them less useful with Unity, of course. Nice article!
  4. Hello!   I need to implement a simple DirectX wrapper component for an UWP app similar to how Win2D is implemented, but it should be used for rendering and animating 3D models instead. Since I do not have much experience with universal apps, I need guidance about picking the right technology for the task.   After a bit of research, I have found my options are: WRL, C++/CX, and C++/WinRT. To my understanding, WRL is a very low level C++ template library, and implementing even a simple UWP component with it would require a lot of repetitive boilerplate code - something that can be very error-prone, especially for someone with little C++ experience. The C++/CX option seems more tempting at first glance, for someone with mostly C# and Java background, requiring seemingly less boilerplate code, which is more readable and maintainable at the same time. Unfortunately, C++/CX is not strictly C++, but a custom language extension introduced by Microsoft, so my fears are it is less likely to get adequate help from the community when I get stuck with something. Then it comes the fresh new C++/WinRT, which is basically a template library implemented in standard C++, but using certain C++11 and C++14 features to achieve a friendlier API and reduce the boilerplate code needed, in comparison to plain WRL. C++/WinRT is also advertised to generate more efficient code than C++/CX in some cases. Unfortunately, being a preview technology, I am not certain how capable it is of generating complex UWP components.   There is another option - to ditch C++ entirely and go with C# instead, using a wrapper library like SharpDX. The SharpDX option seems tempting as well, considering my C# background and my previous positive experience using it in some desktop applications. The only problem is I am not certain how well SharpDX runs with UWP. The author of the library does not have enough time to fix bugs, so if something goes wrong, I am basically on my own there.   Any advice from someone more experienced in this would be greatly appreciated.
  5. The daily WTF - time to laugh at me

    True enough. This is how I discovered it was VBCSCOMPILER.exe locking the folder. Unfortunately, killing it unlocked the folder only temporarily, until I tried to recompile...
  6. The daily WTF - time to laugh at me

    Well, it seems the daily WTF is that I cannot find how to rename 'The daily WPF' to 'The daily WTF' in the title of this post! :) 
  7. Finally, I found some spare time at home to test a concept I was thinking about in a while. Without much thought, I started Visual Studio, created a blank console C# project, giving it the name 'Test'. How imaginative of me! Then out of habit I hit F5 to build and run it. To my surprise Visual Studio complained it could not create the file 'Test.exe', because the access to the path was denied. Wait! It was just a blank console project with an empty 'Main' method in it. If I fail to compile that, then what? I tried the obvious things first like clean rebuild etc. to no avail. Then I tried to restart Visual Studio, delete the 'bin' and 'obj' folders in my project manually and then rebuild. Same outcome. Then I tried to restart Windows, delete the 'bin' and 'obj' folders in my project manually and then rebuild. Same thing. Then I tried to disable my antivirus program temporarily, suspecting it was confusing my poor empty console program with some nasty virus. Nope, it was not the antivirus. During my struggles, I found something new however. The 'bin' folder was locked when the project was open in Visual Studio, while closing the project unlocked it. Deleting the 'bin' folder and reopening the project caused the 'bin' folder to be recreated and locked back again. The culprit always was some child process in Visual Studio, namely 'VBCSCompiler.exe'. So, it was the C# compiler itself locking the 'bin' folder and then failing to write 'Test.exe' in there! I spent the rest of my spare time Googling about the problem to no avail. Finally, I had to tend to other matters, so I deleted the useless project and left home. When I returned home, I recreated the console project. This time everything compiled without problem. After toying with my testbed for a while, I noticed there was a typo in the project's name: it was called 'Tset', instead of 'Test'. I hate such small mistakes, so I renamed the project to 'Test'. To my surprise, the problem with the locked folder reappeared. I was starting to feel I was going crazy, when it finally occurred to me. Went to project properties, renamed the generated executable from 'Test' to 'Test1' and it compiled normally. Renaming the executable back to 'Test' prevented me to compile again. So, it seemed I was unable to compile, when I put the name 'Test'. I tried with different project types and the problem reproduced always. C++ projects seemed unaffected, so my guess was it had something to do with the C# compiler. And now the moral of the story is: do not give stupid names to your projects, otherwise the compiler will bite you!
  8. Code quality at work

    We deal with crappy code at work by having peer reviews. Each piece of code that is about to be merged have to be reviewed and approved by at least two teammates. If two of your colleges think that the code needs reworking, then probably they are right. This also helps everybody to get familiar with the entire code base. This slowed us down at first, until we have learned how to do it properly. Now that we have more experience, the peer reviews do not delay us much, but we have greatly improved the overall code quality.
  9. Here is another idea: if you have a simple collision mesh for your model, you can use it to compute the AABB in real time on per-frame basis. No need to store a big database of pre-computed AABBs for each model for each key frame. Plus, the computed skinning transformation of the collision mesh can be reused later, for erm... determining collisions.  :)  
  10. Actually there are plentiful JavaScript game engines and libraries for both 2D and 3D. Here is a short incomplete list of some popular ones: HTML 5 Game Engines. Unity is targeted towards .NET developers and more suitable for PC/Console/Mobile games. While it can do browser games, I believe it is an overkill in most cases.
  11. Direct3D 11 Render Multipass

    I believe Microsoft moved their effect framework to a separate open-source project, so that developers can extend and customize it. You can find the source code here on GitHub. I am not quite certain if Effects 11 is compatible 1:1 with the old D3DX though, because I am not currently using it for my shaders.
  12. Draw a text

    Could the DirectWrite API get the job done for you? It can use Direct2D internally to take advantage of hardware acceleration. You can cache the rendered text to a texture if performance is a concern, as BitMaster have already suggested.     Using bitmaps to store font glyphs has another disadvantage - most of the popular fonts are copyrighted, so distributing them in any form without an explicit permission can lead to legal issues, unless I am mistaken.
  13. If your intent is to store a vector / matrix in order to pass it to a shader, then using XMVECTOR / XMMATRIX would bring no practical benefit over XMFLOAT4 / XMFLOAT4X4. The cases when XMVECTOR / XMMATRIX should be used are when performing some computationally expensive math and need SIMD acceleration. Using unaligned data types would lead to unaligned load / store operations between RAM and SIMD registers, which can be much slower than their aligned counterparts, e.g. by a factor of four. As a rule of thumb: use XMFLOAT4 / XMFLOAT4X4 for storing data; use XMVECTOR / XMMATRIX for math and avoid converting intermediate results to unaligned data types to reduce the performance hit of unaligned loads / stores.
  14. Why is it so hard to do animations?

    The basic concepts behind animations are fairly easy to grasp. Most difficulties are hidden in the implementation details however. There is a short tutorial on animations with DirectX here on GameDev: Animating Characters with DirectX. It uses X files which are a relatively simple model format supporting animations.   Please, keep in mind that most games / game engines do not use any of the popular 3D file formats, but their own custom formats to suit their specific needs best. Typically, 3D models and animations are created in a 3D program and then exported / converted to the specific format of the game / game engine. Actually, there is a very popular library - AssImp, which is strictly intended for such purposes.   Hope this helps.
  15. Testing If 2 Objects Are The Same

    I find member-wise equality rarely necessary in the first place. A few notable exceptions are types that should semantically behave as regular value types, e.g. complex numbers, vectors etc. For such rare cases overriding equals() and getHashCode() to do member-wise comparison makes sense. In many other cases the problem can be simply avoided if you reconsider your approach. For instance, when you need to avoid duplicating a texture in memory, you can simply test the file name, rather than overriding equals() for the texture itself. Can you elaborate in what scenarios you need member-wise equality?