#118423 - perh - Tue Feb 13, 2007 11:25 am
Hi I'm having some weired scale behavior when scaling with values above 16(!).
I've tried scaling with both the glScalef(float,float,float) and glScalef32, with the exact same behavior.
When drawing a simple cube I increase its size and reduce the scale modifier so that it should appear to be constant size.
After the inverted scale value reaches 1/16 the cube starts to reduce in size.
Here is some relevant code from my test:
This is probably due to some float overflow somewhere, I wonder where?
I've tried scaling with both the glScalef(float,float,float) and glScalef32, with the exact same behavior.
When drawing a simple cube I increase its size and reduce the scale modifier so that it should appear to be constant size.
After the inverted scale value reaches 1/16 the cube starts to reduce in size.
Here is some relevant code from my test:
Code: |
... const int size = 1; // Cube size const float step = 0.1f; // Step to increase scale const int distance = size*2; // Distance to draw the cube from float scale = 1.0f; f32 scale_i = divf32(inttof32(1),floattof32(scale)); float realSize = size*scale; while (1) { ... glTranslatef(0, 0, -distance); glColor3f(1.0f, 0.0f, 0.0f); glScalef32(scale_i); drawCube(realSize, realSize, realSize); glTranslatef(0, 0, distance); scale += step; scale_i = divf32(inttof32(1),floattof32(scale)); realSize = size*scale; ... } |
This is probably due to some float overflow somewhere, I wonder where?