# include <windows.h>
#endif
-#include <osg/GLU>
+#include <osg/Matrixf>
#include <math.h>
#include <zlib.h>
void
SGTexture::resize(unsigned int width, unsigned int height)
{
+ using namespace osg;
GLfloat aspect;
// Make sure that we don't get a divide by zero exception
// Go to the projection matrix, this gets modified by the perspective
// calulations
glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
// Do the perspective calculations
- gluPerspective(45.0, aspect, 1.0, 400.0);
+ Matrixf proj = Matrixf::perspective(45.0, aspect, 1.0, 400.0);
+ glLoadMatrix(proj.ptr());
// Return to the modelview matrix
glMatrixMode(GL_MODELVIEW);
int yp1 = (y < (texture_height-1)) ? y+1 : 0;
int posxp1 = (xp1 + ytw)*num_colors;
int posyp1 = (x + yp1*texture_width)*num_colors;
+ float fx,fy;
GLubyte c = texture_data[dpos];
GLubyte cx1 = texture_data[posxp1];
map[mpos+3] = a;
}
- map[mpos+0] = (128+(cx1-c)/2);
- map[mpos+1] = (128+(cy1-c)/2);
+ fx = asin((c/256.0-cx1/256.0))/1.57079633;
+ fy = asin((cy1/256.0-c/256.0))/1.57079633;
+
+ map[mpos+0] = (GLuint)(fx*256.0)-128;
+ map[mpos+1] = (GLuint)(fy*256.0)-128;
map[mpos+2] = 127+int(brightness*128); // 255-c/2;
mpos += colors;