Advertisement Jump to content
  • Advertisement

Rene Z

  • Content Count

  • Joined

  • Last visited

Community Reputation

605 Good

About Rene Z

  • Rank
  1. The dot product between two perpendicular vectors is zero, check if you divide some value by the dot product between the surface normal and the light direction. Can you show your shaders? I can't be more specific without them.
  2. Rene Z

    Draging a map in directx

    For some reason the edit button doesn't work. Read 'Then multiply the size of the camera view' in the post above as 'Then multiply the width and height of the camera view'.
  3. Rene Z

    Draging a map in directx

    If you're using an orthographic projection, the area the camera can see has a width height, and depth. Transform the mouse position data to normalized coordinates (a range from zero to one) if you're currently using pixels or something else. Then multiply the size of the camera view with delta mouse position, negate, and use the result to translate the camera. If you're using a perspective projection this won't work, so let me know if that's the case.
  4. Rene Z

    [SDL] SDL_Rect array

    What is the value of NumberOfPlatforms? Why don't you use the same constant to specify the size of the array? Doing so will avoid bugs when resizing the array later on. If you're using C++ it's even better to use a container like std::vector. I can't be sure what the problem is without knowing the value of NumberOfPlatforms, but it's most likely an out of bounds array access. Try to figure out why. Also, have you ever used a debugger? It allows you to step through your code while the program is running, so you can see when and why it's crashing.
  5. Probably not. I always use smart pointers, unless there's a good reason not to. A good reason can be performance in tight loops or something like that, but those cases are rare and should never leak out of your interfaces. Note that using smart pointers doesn't mean 'don't think about ownership', which often results in overusing shared pointers. Quite the opposite in fact: different types of smart pointers are a great way to explicitly state ownership of an object.
  6. Rene Z

    link 2005 error in project

    The linker gives you a hint: some symbols have been defined multiple times. Those float globals in Camera.h can be declared there, but you shoud define them somewhere else, best place is in Camera.cpp. The header should contain float camX, camY, camZ. The cpp should contain float camX = 0.0f; Now some (constructive!) criticism towards your code: Why does your FPSCamera class use those global variables? Only use globals when you absolutely have to, or they will come back to bite you in the behind. In this case, camX ect. should be members of the FPSCamera class. Remove the globals in main.cpp too. Pi is indeed a good candidate for a const global, but doesn't belong in Camera.h. Ask yourself this: you need Pi for some calculations, does it make sense if you have to include Camera.h? Camera.h includes main.h. Why? Has the camera a dependency on main? Include as little as possible in the header. In this case, you don't have to include anything. Include what you need for the implementation on your cpp file. Use smart pointers instead of raw pointers. I may be missing something, but you don't appear to be using shutdown(). Remove this function, move the call to glfwTerminate to the end of main(). Terminate the application by changing 'while(1)' in the main loop to 'while(running)' where running is a bool. When the user presses escape, set running to false. Try to avoid using exit(), it makes it harder to reason about code. Add parameter names to your function declarations. They're a form of documentation. When peeking at the header, I have no idea what I should pass to moveCamera(float, float). Never put 'using namespace x' in a header, this kills the benefits of namespaces in every file that includes it, directly or indirectly. Don't handle keypresses in your camera class. Add functions to the class which allow you to move the camera, call these from another place where you handle all user input. There is more I can find, but this should be enough for now. Please let me know if you have any more questions.
  7. Rene Z

    Bloom Fail

    In glsl, the pow(x, y) function return value is undefined if x < 0 or if x = 0 && y = 0. I once had a situation where the specular multiplier and specular exponent of a specular map were both zero at some texels, which caused pow to return NaN. You can also check for that.
  8. Rene Z

    [Java] Problems saving to file.

    Scanner.nextLine removes line separators.
  9. Rene Z

    glsl problem

    You need to put a ; after the declarations of vVertex, vFragColor and vVaryingColor.
  10. The SomeType* means a pointer to SomeType, but that's a raw pointer. Raw pointers can easily cause problems in large codebases like dangling pointers, memory leaks, heap corruption just to name a few. A smart pointer is a small class or struct that manages the data it's pointing to. Basically, this means the pointed-to data will automatically be deleted as soon as there's no longer a pointer pointing to it, and no sooner than that. Most high quality code bases will almost exclusively use smart pointers. As NightCreature said, if you want to use polymorphism you must use pointers or references. If you want to understand why, look up the 'slicing problem'. The following answer on StackOverflow explains nicely: http://stackoverflow...lem-in-c#274636
  11. vector< vector< GridTile* > > grid; Better to use a smart pointer though.
  12. glGenBuffers(sizeOfBuffer, &nameOfBuffer); // Generate the buffer The first parameter of GenBuffers is the number of buffers, not the size of the buffer. Pass 1 instead of sizeOfBuffers. The size of the buffer is determined when you call BufferData, which is when the buffer is allocated
  13. You can call glGenTextures as many times as you want. When adding a texture, call glGenTextures(1, &handle); where handle is a single GLuint.
  14. Transform Feedback would work, but it's probably faster and easier to do this completely on the CPU.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!