mhagain

Members
  • Content count

    3644
  • Joined

  • Last visited

Community Reputation

13430 Excellent

About mhagain

  • Rank
    Contributor

Personal Information

  • Interests
    Programming
  1. Double-buffering on it's own is insufficient to prevent flickering; you must also use vsync (set PresentationInterval to D3DPRESENT_INTERVAL_ONE in your D3DPRESENT_PARAMETERS).
  2. According to MSDN, thread safety is managed by the runtime rather than the driver (clicky), so I'd consider it even more unlikely that the OP has found a bug in this behaviour.
  3. There is no 32 texture limit. True, there are only GLenums up to GL_TEXTURE31, but for textures higher than that you can just use GL_TEXTURE0 + num.
  4. OpenGL SwapBuffer Nvidia Crash

    You're still making a call to GetDC each frame though - that's a resource leak. You need to fix that first because otherwise you've two potential problems going on and you won't know whether any issues you have are coming from either.
  5. OpenGL SwapBuffer Nvidia Crash

    I mean ReleaseDC after each GetDC; as it stands now you call GetDC each frame so eventually you're going to run out of DCs. Use something like this instead: HDC hDC; if ((hDC = GetDC (window_handle)) != NULL) { SwapBuffers (hDC); ReleaseDC (hDC); }
  6. Best of luck calling D3DX11CompileFromFileW with DirectXMath. I'm only being half-facetious here; there is a tendency to say "don't use D3DX, use DirectXMath" which totally overlooks the fact that D3DX contained a lot of other functionality too. It's far more useful to the OP to point them at this page instead: https://blogs.msdn.microsoft.com/chuckw/2013/08/20/living-without-d3dx/
  7. OpenGL SwapBuffer Nvidia Crash

    SwapBuffers(GetDC(window_handle)); This is a resource leak; you need to call ReleaseDC to match your GetDC. You should also create your window class with CS_OWNDC if you use this pattern (otherwise store the window DC once only at startup in a global of some kind).
  8. C++ Shader help

    gl_FragColor has been deprecated since GLSL 130; use an out vec4 instead. Your GLSL compilation should be giving you an error for this.
  9. Why is present so slow? Read the rest of the post linked above for more info. It's really good stuff that might seem non-obvious sometimes.
  10. 2D The missing triangle.

    There is no "raw" OpenGL. The task of creating a context, irrespective of platform, has never been part of the OpenGL API, but is instead delegated to the operating system. By learning context creation all you are learning is a few OS-level calls with the appropriate flags. This is of absolutely no benefit to your eventual usage of OpenGL itself. Regarding GL versions, you'll sometimes see buffers and shaders discussed as though they were modern features. This is completely untrue. Vertex arrays date back to OpenGL 1.1, buffer objects to 1.5 and shaders to 2.0, and all are available as extensions to even earlier versions. These "modern" features are actually 15 years (or more) old. Don't be concerned about any risk of using them, these are mature, stable features.
  11. 2D The missing triangle.

    It's actually all legacy; GL 1.1 using client-side vertex arrays and fixed function vertex attribs to be precise.
  12. DX11 Shader signature question

    Validation. Because different states can be specified in isolation from each other, part of an API's job is to validate the current combination of states in order to ensure that it's OK to draw with them. Traditionally this could only be done at run time because older API's had no way of knowing what the final combination of states used for a draw call would be until the draw call is made. Direct3D 10 moved a lot of validation from run time to object creation time, and Direct3D 11 continued with this. One place you see it is in the use of immutable state objects, gathering groups of related states used at different parts of the pipeline together. Another place you see it is in the tight coupling of input layouts with vertex shaders. Think back to Direct3D 9 and try to imagine how vertex declarations might work. What happens if the vertex declaration provides an input that the vertex shader doesn't consume? What happens if the vertex shader consumes an input that the declaration doesn't provide? How are format conversions worked out? There are rules for all of these things, but because the API doesn't have a way to know which combination of declaration and shader will be used together it can't work things out until run time, typically when you make a draw call. Under Direct3D 10+ because they're linked at creation time the validation can also be done at creation time, meaning that this step can be skipped at run time and run time gets faster.
  13. 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.
  14. 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.
  15. 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