Hello everybody,
I am trying to render a image that I read from the disk. The image is ok, and it renders, but if renders differently under Windows and Linux. The Linux version is ok, that is, the image is scaled to fit the window, but under Windows, only the upper left corner is rendered with a strange scale. Now, there is one code part :
void myGlutDisplay(void){
GLboolean pos_ok;
GLenum format;
GLenum type;
int tx, ty, tw, th;
float scale;
GLUI_Master.get_viewport_area( &tx, &ty, &tw, &th );
glClearColor( .9f, .9f, .9f, 1.0f );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(left,right,top,down,-1.0,1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glPixelStorei(GL_UNPACK_ROW_LENGTH,0);
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
switch(samplesPerPixel){
case 1:
format = GL_LUMINANCE;
break;
case 3:
format = GL_RGB;
break;
}
glRasterPos2i(left,down);
scale = (float)tw / (float)imageWidth;
glPixelZoom(scale ,-scale);
glDrawPixels(imageWidth,imageHeight,format,GL_UNSIGNED_BYTE ,imageData);
glutSwapBuffers();
}
where imageWidth is the width of the image and the margins with top,down,left,right have been computed somewhere else ( when loading the image ). Does anybody have an idea why this is working under one environment and not under the other ?
Thanks,
Stefan