Paul Varcholik

Forum Replies Created

Viewing 15 posts - 16 through 30 (of 38 total)
  • Author
    Posts
  • in reply to: High CPU/GPU usage on opengGL demos #328

    Paul Varcholik
    Keymaster

    Hello,

    Optimizing the game loop is my first suggestion. The existing game loop is as simple as it gets — it runs as fast as it can and this will consume more resources than necessary.

    Here’s a good read on the topic of Game Loops, from the book/e-book Game Programming Patterns by Robert Nystrom.

    Paul

    in reply to: VectorHelper.h and MatrixHelper.h #325

    Paul Varcholik
    Keymaster

    Hello,

    There are a few headers that I don’t mention in the book, or don’t detail in their entirety. This is for the sake of brevity, when the material is tangential to the chief topic, and/or when the classes are relatively simple.

    For the two headers you mention, VectorHelper.h and MatrixHelper.h, these files include helper classes to simplify common uses for vectors and matrices. VectorHelper.h includes declarations for 2D, 3D and 4D vector helpers. These classes expose static const vectors like Zero (a vector with zero in each component) and One (a vector with one in each component). There is also a ToString method that represents the vector as an std::string.

    For MatrixHelper there’s an Identity static const (representing a 4×4 identity matrix) and methods for getting and setting the Forward, Up, Right, and Translation components contained within a 4×4 matrix.

    Paul

    in reply to: New book #323

    Paul Varcholik
    Keymaster

    I have such a proposal brewing, but no specific dates yet. I appreciate the support and will keep you posted.

    Paul

    in reply to: Only get black window #322

    Paul Varcholik
    Keymaster

    Sounds like you’ve made some progress and are headed in the right direction. Yes, the CubeDemo renders a cube and the TriangleDemo renders a single, spinning triangle.

    Have you installed FX Composer and tried rendering the book’s earlier shaders using DirectX 9 or 10? That’s the next step here — determining if there’s an issue with DirectX 11 specifically.

    Paul

    in reply to: Only get black window #319

    Paul Varcholik
    Keymaster

    Your original problem was unrelated to a compiler or linker problem, nor a problem with your Visual Studio project configuration. Prior to your installation of the platform update you were compiling and linking successfully. Had you had a project configuration issue, that would not have been the case.

    The external libraries, referenced by the various projects in the book’s demo code, were compiled using Visual Studio 2013. You won’t be able to use those libraries in Visual Studio 2012 without rebuilding the libraries. My recommendation is that you use Visual Studio 2013.

    To your original problem, it still points to a driver or video card issue — more supported since you stated that you had OpenGL 4.x issues. I recommend that you open the Chapter 4 projects in FX Composer — not Visual Studio 2013 — in order to diagnose the problem further. FX Composer doesn’t render with DirectX 11, it uses either DirectX 9 or DirectX 10 (you choose this). If you can render the Chapter 4 shaders (likewise for the shaders presented in Chapters 5 – 9) that will tell you that your card is having trouble with DirectX 11. Read Chapters 3 and 4 for a walk through of using FX Composer and a discussion of those first shaders.

    I also wonder if you’ve updated your video card driver to the latest revision?

    Paul

    in reply to: Only get black window #314

    Paul Varcholik
    Keymaster

    Have you tried running any of the other demos? In Chapter 14’s solution, there is also a TriangleDemo. What results do you get when running that application?

    Have you worked through any of the shaders through FX Composer? i.e. the earlier chapters in the book? If so, what results do you see there?

    Paul

    in reply to: Only get black window #312

    Paul Varcholik
    Keymaster

    You can only use vs_4_0 for the vertex shader. You must use ps_4_0 for the pixel shader. Also, set the “fx_4_0” string, for the call to D3DCompileFromFile, back to “fx_5_0”. That’s actually about the platform target and I instructed you incorrectly.

    As to the compile-time warnings, both are fine. The FXC warning is generated because the .FX file format has indeed been deprecated. The DirectInput warning can be eliminated by including the following somewhere in your source code (typically where you #include ).

    #ifndef DIRECTINPUT_VERSION
    #define DIRECTINPUT_VERSION 0x0800
    #endif

    Paul

    in reply to: Only get black window #307

    Paul Varcholik
    Keymaster

    I suspect you might have a shader compilation error. Do you see any warnings/errors, displayed in the output window, at runtime?

    More specifically, I’m wondering if your graphics card/driver supports shader model 5. The BasicEffect.fx file employed in the Chapter 14 demos (indeed, all of the shaders in this section of the book), uses shader model 5. Try editing the BasicEffect.fx file, in the Library project, and the invocation of D3DCompileFromFile, in the CubeDemo project, to use shader model 4.

    Paul

    in reply to: Ch 10 Linker Error #303

    Paul Varcholik
    Keymaster

    I’m still thinking that you might have the wrong directory structure. The external folder must be one directory above the Chapter10 folder. My last post removed the spacing in front of the directories I listed which may have been confusing.

    Here’s an image of what your directory structure should look like (if you’d downloaded the entire repository).

    Directory Structure

    Moreover, you can see what directories are in the project’s search path by looking at the Game project’s Property Pages | Configuration Properties | Linker | General | Additional Library Directories. Here’s an image of the settings used in the Chapter10 source code (the Debug configuration):

    If these settings don’t match your actual directory structure, then you won’t be able to link the associated libraries.

    Paul

    in reply to: Ch 10 Linker Error #299

    Paul Varcholik
    Keymaster

    Hello M. Rafi,

    Did you download only the Chapter10 folder? Because most of the code from the chapters (including Chapter 10) requires the “external” folder one directory above. More specifically, your folder structure should resemble:

    YourDownloadLocation\
    Chapter10\
    external

    The external folder includes the DirectXTK library, Open Asset Import Library (used in Chapters 15 – 22) and the Effects 11 Library.

    Paul

    in reply to: entity component system #275

    Paul Varcholik
    Keymaster

    Hello Ahmed,

    The design mimics the component-oriented architecture of XNA. DrawableGameComponent extends GameComponent with a Visible property and a virtual Draw() method. The idea being, that if you had a component that should be rendered to the screen (drawn) it would inherit from DrawableGameComponent and override the Draw() method.

    If you had a component with no visual representation (e.g. the keyboard) then you would inherit from GameComponent and override the Update() method. Of course, since DrawableGameComponent inherits from GameComponent, any DrawableGameComponent-derived classes can override Update() as well.

    Paul

    in reply to: shader editor #272

    Paul Varcholik
    Keymaster

    ShaderTool looks fantastic! Same for WorldCreator, looks like you folks are writing some very cool software. Good luck and thanks for the post!

    Paul

    in reply to: orthographic camera #266

    Paul Varcholik
    Keymaster

    Hi Ahmed,

    There’s nothing special you need to worry about with respect to the view matrix. If you were writing an orthographic camera component, you might split a class hierarchy into Camera, PerspectiveCamera, and OrthographicCamera — where the Camera class becomes an abstract base class with a pure virtual UpdateProjectionMatrix method. The base Camera class would then contain properties for position, direction, up, right, view matrix, projection matrix, near/far planes, but would move Perspective/Orthographic-specific fields to their associated derived classes. For example, the PerspectiveCamera class would contain field of view and aspect ratio members; and an OrthgraphicCamera class would contain view width and view height fields. These derived classes would then implement the UpdateProjectionMatrix method with the XMMatrixPerspectiveFovRH or XMMatrixOrthographicRH methods, respectively.

    Here’s an implementation of that hierarchy.

    Paul

    in reply to: Scene Graph #265

    Paul Varcholik
    Keymaster

    Hello Ahmed,

    Sorry I haven’t responded to your question. I didn’t see your follow-up post until now.

    I recommend Game Engine Architecture, 2nd Edition by Jason Gregory as a great engine book, though, to your specific question, I think it’s lacking details on scene graph implementation. Past that, there’s quite a lot of information on the Internet. A Google search on Scene Graphs should get you started.

    If my next book idea takes root, it’ll include implementations of several systems for scene management.

    As to any plans on a game demo, no I don’t currently have any such plans. The graphics framework, presented in the book, is primarily a context for exercising graphics techniques and exploring the Direct3D API. It doubles as a decent start to an engine, which could be extended, but that wasn’t the intent. I have extended the framework to include multi-platform support (for Win32, Windows Phone 8.1, and Windows 8.1) and will continue to expand the framework to support the next book and/or video series.

    Paul

    in reply to: Scene Graph #256

    Paul Varcholik
    Keymaster

    Hello Ahmed,

    I’m glad you like the book! I have a proposal cooking right now for a second book that would include a deep dive on space partitioning and scene management. No word yet on the “when”, but that plan is percolating.

    I also have a proposal in for a second video series on DirectX development. DirectX Essentials LiveLessons was just published this week and it covers the first two parts of the book. A second video series would cover the last two parts of the book and include a lesson on Multi-Platform DirectX development (Win32, Windows 8.1, Windows Phone 8.1, and Xbox One). No definitive timing on those videos either, but that’s also in the works.

    To your second question, the software services pattern is formal known as the “Service Locator” pattern. It’s the exact opposite of dependency injection.

    Paul

Viewing 15 posts - 16 through 30 (of 38 total)