Jump to content

  • Log In with Google      Sign In   
  • Create Account

Rene Z

Member Since 24 May 2010
Offline Last Active Jun 02 2015 04:30 AM

Posts I've Made

In Topic: specular light flickers when a ray is parallel to the lit surface

26 September 2012 - 03:31 AM

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.

In Topic: Draging a map in directx

25 July 2012 - 05:53 PM

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'.

In Topic: Draging a map in directx

25 July 2012 - 05:49 PM

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.

In Topic: [SDL] SDL_Rect array

26 June 2012 - 06:43 AM

for (int i = 0; i <= NumberOfPlatforms;i++){

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.

In Topic: Overusing smart pointers?

17 June 2012 - 10:02 AM

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.