PDA

View Full Version : DevIL screenshot



sguTiger
02-11-2012, 08:59 PM
Hi,
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
ilutGLScreenie();
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.

sguTiger
02-11-2012, 09: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.

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