PDA

View Full Version : How to display a small window(such as smaller than 32*32) correctly in glut?



bluestone
06-05-2006, 05:01 AM
I must display small windows(smaller than 32*32 pixels) in my work.The window height can display correctly,but the window width cannot smaller than a specifical value,so the view is displayed in a wrong scale.seems the window width is restricted by the "windows minimize,maximize and close buttons",you can see this phenomena in normal windows forms.
I used glut all along,can you solve the problem in glut? Or give me some other advice.
thanks!

Bob
06-05-2006, 07:01 AM
As far as I know, this limitation in size is something the Win32 API enforces when these system buttons are present, so it's really nothing GLUT can do about it.

However, depending on what you want, maybe a "large" window and a small viewport would work. As long as the window is larger than 32x32 pixels, glViewport(0, 0, 32, 32) will give you a 32x32 pixel area to play with. Those particular values will put the 32x32 block in the bottom left corner of the window, but you can adjust them to place the viewport anywhere on the window.

bluestone
06-06-2006, 05:45 AM
thanks,your advice is worth taking a try.I limpingly solved the problem using the glutCreateSubWindow().Create a subwindow in parent window,they can be set at the same size,the subwindow width can be displayed correctly,although the parent window width cannot while the size is small(such as the width<60).There is a block of blank in parent window beside the subwindow,draw view in the subwindow,it works.
thanks again!