Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualBrother Bob

Posted 10 May 2013 - 12:25 PM

The reason it appears to not work is that "8/32" is integer division because both operands are integers, and the result of integer division is an integer. You need to ensure that at least one operand of the division has a floating point type to get a floating point division. For example: 8.0/32, 8/32.0, 8.0/32.0, static_cast<float>(8)/32, or whatever method you want, as long as at least one operand is not an integer.

 

But you can also use the texture matrix.

 

glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScale(1.0/32, 1.0/32, 1);

#1Brother Bob

Posted 10 May 2013 - 12:24 PM

The reason it appears to not work is that "8/32" is integer division because both operands are integers, and the result of integer division is an integer. You need to ensure that at least one operand of the division has a floating point type to get a floating point division. For example: 8.0/32, 8/32.0, 8.0/32.0, static_cast<float>(8)/32, or whatever method you want, as long as at least one operand is not an integer.

 

But you can also use the texture matrix.

glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScale(32, 32, 1);

PARTNERS