mhagain

Members
  • Content count

    3632
  • Joined

  • Last visited

Community Reputation

13422 Excellent

About mhagain

  • Rank
    Contributor
  1. The major advantage of packaging everything into an archive is for distribution. Users only need to download a single file and so long as that file is intact and it's checksums match then you can have a good degree of expectation that they have the correct content. A simple collapse of a directory structure to a single file, with the inclusion of a table of contents, can satisfy this requirement. After that it depends on how fancy you wish to go. One example here is that you might place resources that are loaded together - such as a map and it's textures - contiguous in the file so that they can load with less jumping around the disk. That kind of very specific fine-tuning is something that no format will give you; you need to do this yourself. Another thing that a package can give is the ability to override content. To use the example of ID's old PAK system, a file in pak1.pak will override the same file in pak0.pak. Again, this isn't something you get from the format, you code this up in your file loading subsystem. Some food for thought there, but again it highlights that the format is not the important thing, it's what you do with it, how you use it, that matters.
  2. Things you need to consider when choosing one? Have a think about the reasons why you want compression. Depending on your platform, saving disk space may not be as important a consideration as it would have been 10 or even 5 years ago. You might place more importance on how quick it is to read the archive off the disk and how quick it is to decompress the file - both of these will factor into the load times your users experience. Do you want any kind of encryption, perhaps as a deterrent to casual meddling? Does the format come with any IP encumberance regarding distribution? What is the licensing like in general anyway? Can you statically link to the library or does it have to be dynamic, and does that even matter to you? Does it come with good sample code that matches well with your use case(s)? What about support facilities - is there an active end-user forum, for example? That's a sampling of things that should be going through your head as you weigh up the options.
  3. For NVIDIA Optimus use the following: extern "C" { _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; } For AMD use the following: extern "C" { __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; } Reference (for AMD): https://community.amd.com/thread/169965
  4. It's instructive in cases such as this to examine how the compilation process actually works. Under D3D compiling a shader is a two-stage process. Stage 1 compiles the text-based HLSL code to hardware-independent binary blobs and this is the stage that is carried out by fxc.exe or D3DCompile (which are actually the same thing but I'll get to that in a moment). Stage 2 always happens in your program and this stage takes the hardware-independent binary blobs and converts them to actual shader objects (i.e. ID3D11VertexShader, etc); this stage is exposed by the ID3D11Device::CreateVertexShader/etc API calls. The point I made above is that fxc.exe and D3DCompile are actually the same thing; fxc.exe actually calls D3DCompile to compile it's shaders, and this is something you can confirm by using a tool such as e.g. Dependency Walker. You can also infer that D3DCompile and D3DCompile2 are hardware-independent by the fact that they don't take an ID3D11Device as a parameter (in other words Direct3D doesn't even need to be initialized in order to compile a shader; this is a pure software stage). Microsoft's own advice on this matter is given at the page titled HLSL, FXC, and D3DCompile and I'll quote: This page then goes on to discuss scenarios in which you may, despite this advice, still wish to compile at runtime, such as for development purposes; runtime compilation is particularly useful for shader development if you're able to quickly reload and recompile your shaders while the program is running, and see the effects of code changes immediately. Finally, and this may not be immediately obvious, but you can actually compile your shaders for a lower target than the D3D device you end up creating and ship a single set of precompiled shaders that way. For example, if you set a minimum of D3D10 class hardware, you can compile your shaders for SM4 and set up your feature levels appropriate, and they'll work on D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_11_0 or higher.
  5. What might not be obvious is that you can make this an error even without bumping your warning level to 4 (although you should be compiling with warning level 2 or 3 at least, as well as with warnings-as-errors, anyway).
  6. Rather than testing for NULL after CreateDevice you really should be testing the HRESULT it returns, using the SUCCEEDED and FAILED macros, with failure HRESULTs giving you some more info on why it failed. You also have a nasty memory leak in that code - you need a surface->Release for each GetBackBuffer call. In this case it won't destroy the backbuffer because GetBackBuffer will increment the reference count for it, so Release will just decrement it; it doesn't get destroyed until the reference count goes to 0.
  7. Your 800x347 rendering actually is stretched slightly; you need to look a little carefully, but if you compare the middle (largest) sphere in that with the same sphere in the others you'll see it. Resizing it to 694x347 brings it back to unstretched, which does indeed seem to confirm that you're getting a truncation-to-integer somewhere. As a test try a rendering at a skinny-but-tall resolution - something like 480x640; it'll either display nothing, give you a single uniform colour, or crash spectacularly.
  8. This is called a menu - look for examples for creating a menu in a Windows program. Here might be a useful place to start: https://msdn.microsoft.com/en-us/library/windows/desktop/ms646977(v=vs.85).aspx This looks like a simple tutorial: http://zetcode.com/gui/winapi/menus/ Also here: http://www.winprog.org/tutorial/menus.html
  9.   It's not dumb, it means that a scan line is aligned on a 4 byte boundary and can always be read in chunks of 4 bytes.  Think a little about possible intended uses of bitmaps and how this may interact with hardware. You're very quick to dismiss something as "dumb", in this and other threads, in cases where a little more understanding on your part may actually be of benefit to you.
  10. It says a lot for recent times that we have people who seriously think that "going right wing" is just about immigration.  Hint: it's not.  "Going right wing" means that you're also buying into a whole package of other economic and social ideologies, and it would be a shame if they were ideologies you disagreed with but the immigration platform led you to give them a mandate. Think very carefully before you make this kind of decision.
  11. How many 2048x2048 textures have you?  Are they DXT-compressed or RGBA/RGBX?  Have you calculated how much memory is required for a full mipmap pyramid of a texture this size?  It may indeed be time to put them on a diet.
  12. OpenGL

    Part of the problem with OpenGL is that design by committee just doesn't work. Let's say there's a new feature that is proposed for a new version of the spec.  Vendors A and B would like to get it in, but vendor C's hardware doesn't support it. Option 1 is that it goes in; vendor C are now in a position where they can't claim support for the new version but vendors A and B are happy. Option 2 is that it doesn't go in; vendor C can now claim support for the new version but vendors A and B aren't happy. Or we could do it the OpenGL way and massage the spec a little to allow vendor C to claim support for it but in a way that allows them to not actually support it, thereby keeping all of the vendors happy.  But now of course the poor programmer has to be aware of edge cases such as this. The end result is that in the absence of a central controlling body putting a stop to this kind of nonsense, vendor-specific behaviour bubbles up into the core specification (let's look for how many times the term "implementation dependent" occurs in the GL spec) and the programmers and end-users are the ones who take the hit. And just in case you're interested - the example I gave wasn't a contrived example to make OpenGL look bad: it actually happened.
  13. OpenGL

    Another point is that having a cross-platform graphics API is not actually as important as people think it is. Graphics is after all only a small part of a game engine. A cross-platform graphics API won't get you sound, input, networking, memory management, file access, etc. Just using OpenGL won't magically make a game engine be cross-platform; you still have to deal with all of these other areas (and even something like SDL has platform-specific quirks once you go beyond trivial programs). If you're targetting multiple platforms you're probably already using multiple graphics APIs anyway. If you're targetting PC, XBox and PS you're already using 3. Having to support multiple graphics APIs is a solved problem, so rather than ask "why wouldn't you use OpenGL?" you should be asking "why wouldn't you use the best API for each platform?" That's a much more interesting and useful question.
  14. OpenGL

    PSGL existed on PS3 only (its not on PS4) and was a sub-ES 1.0 (or maybe 1.1) implementation that was a wrapper built on top of it's native API but which nobody used because it's performance and functionality were dreadful. That's basically where the "PS supports OpenGL" mythology came from.
  15. OpenGL

      Be very careful. Several people who post on this forum actually have worked with major console devkits and on AAA titles - they have actual hands-on experience of which APIs are used and know what they're talking about.  Others are well-known and well-respected industry figures.  So when one of these people says "not every device supports OpenGL" - they're probably right.