Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

184 Neutral

About Zilmerx

  • Rank

Personal Information

  • Interests
  1. Zilmerx

    Using Exceptions

    I like this talk on exception handling from one of my college teacher :
  2. Zilmerx

    Multi-thread question

    Try keeping a vector of threads, so that you can call join on them later.
  3. Zilmerx

    Multi-thread question

    Also, joining right after the starting the thread is not a good idea, since you will only be able to have one or two threads running at a time. In order to use the full potential of multi threading, you should try to parallelize you work. By splitting your work into two loops, one loop to boot the threads, and another to join them, it will allow your threads to keep booting one right after the other and work all at the same time until they complete their task. Also, threads are a pretty low level and can easily be misused. C++ 11 I believe added a stl class called "future" which wrap threads and make them easier to use. EDIT: Typed at the same time.as you :p. Try keeping a vector of threads, so that you can call join on them later.
  4. Zilmerx

    Multi-thread question

    Try to use the first parameter in the first answer of this thread. http://stackoverflow.com/questions/10673585/start-thread-with-member-function
  5. Some pretty sexy solutions to make a checkerboard pattern, but the problem I have is that it makes a checkerboard pattern without me actually wanting to have one  :lol:.   Re-reading my first post, I notice that I didn't give a lot of information as far as what the issue in those images is. Let me clarify, and update with some progress that I have made in regards as to isolating the issue :   I am trying to make a 2d map of tiles like this one (that I have managed to create with a lot of duct-tape : Putting the objects twice in a row in my vector of objects).     If we look at the piece of code that I have pasted in my first post, this is the pattern that should appear on my screen, but I get the results posted in my first post. Only one tile on two gets rendered correctly in my image, which is why doubling each object in my vector makes it "work..". Obviously this is not a very valid solution, so I am looking for a way to only have one object for each tile.   While digging for the bug I have found that my problem is probably situated at the level of my shader or my way of using my objects. In order to render my tiles, I make many "objects" which contain a pointer to a unique model, and store them in a vector, like this.   Then I loop through the vector and render each model with the texture attached to it. Is this a valid technique ?   Thank you for your time.
  6. std::unique_ptr<Object> obj; if (x % 2 == y % 2) // Is Even { obj = std::make_unique<Object>(model1); // Stones } else // Is Odd { obj = std::make_unique<Object>(model2); // Grass } Produces this with and interval of [-4,3].     Produces this with and interval of [-3,3].     After having read some more, I have a feeling that this could be related to occlusion culling. Maybe the "black" squares are in fact being culled because they are seen as being behind the other ones ?
  7. Hi,   I am a starting to learn to code with DirectX in C++, and have hit a bug for which I am unable to find a solution.   In this part of my code, I am attempting to fill a vector of objects (models with x,y,z positions, rotations and scaling) to create a 2D map of square tiles (First block of code).   Once these have been put in the vector, I call a loop to render the objects one by one. After using the debugger, I can assure you that the X and Y values are correct at the rendering stage, and that all tiles have a pointer to their respective model.   In order to try to debug this problem, I have added a piece of code to make it so that squares with even X values are stones, and squares with odd X values are grass. In the image #1, I have changed the values of my loop so that the map tiles X and Y values have an interval of [-4,3]. In the image #2, I have changed the values of my loop so that the map tiles X and Y values have an interval of [-3,3].   I have also tried increasing the jump in my loops so that they increase by 2 each time, but it didn't fix the issue.   Looking at this problem, I can only think that I am missing a key piece of information about DirectX that is causing this bug.   Thank you for your time.   EDIT: In the event that somebody would like to have a look at the full code, my project is on Github.  The crucial pieces of information are (I think) in the WorldClass Initialize() function, or in the GraphicsClass Render() function. https://github.com/Zilmerx/GameProjectFinal     Code #1 : // Test #2. for (int y = -3; y <= 3; y++) // -3 to 3, 7 values. { for (int x = -3; x <= 3; x++) // -3 to 3, 7 values. { std::unique_ptr<ObjectClass> obj; if (x % 2 == 0) // Is Even { obj = std::make_unique<ObjectClass>(model1); } else // Is Odd { obj = std::make_unique<ObjectClass>(model2); } obj->SetPosition(x, y); obj->Initialize(); m_Map.push_back(std::move(obj)); } } Image #1   Image #2
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!