View Full Version : DevIL screenshot

02-11-2012, 07:59 PM
I am using the package DevIL for screenshot. However, I encounter a problem.
In my program, the viewport is only part of the window.
glViewport((GLsizei)w*0.1, (GLsizei)h*0.1 (GLsizei)w*0.8, (GLsizei)h*0.8);
Then when I use
But the tga image I get is not what in the viewport as indicate in the tutorial. Instead, the tga image starts from the lower left corner of the window and going right 0.8 w and up 0.8 h(which is the viewport size)
What can I do if I want to the image to be everything in the whole window/or only in the viewport? Thanks.

02-11-2012, 08:21 PM
I took a look at the source code. It seems that this is how ilutGLScreen is hard coded. It queries the size of viewport by glGetInteger() then use glReadPixels(0,0,Viewport[2],viewport[3],.....);

I want to fix it and it requires to query the window size. Which function can return the window size? I am using GLUT under linux. Thanks.

02-11-2012, 08:54 PM
I find it, it is glutGet().