PDA

View Full Version : MAX_VIEWPORT_DIMS problem



hockeyman
10-30-2012, 03:29 AM
I have app for image editing. Everything related to image or it's editing is done via OpenGL. I implemented zooming method. To achieve zooming effect I'm using glTranslatef. I draw everything 5 times bigger than it is, to achieve zoom-in effect. But now I met problem. When drawing everything 5 times bigger, automatically viewport is 5 times bigger than original image. And on older macs sometimes MAX_VIEWPORT_DIMS is too small to redraw image. For example if I use this app on mac with NVIDIA GeForce 7300 graphics card, witch's MAX_VIEWPORT_DIMS is 4096, when user opens for example 825x825 image, it can't be redrawn correctly, because 5*825 = 4125, and it is bigger than MAX_VIEWPORT_DIMS. Maby anyone could point me to some way-arround, to avoid this type of problem.

By the way, viewport is set to be 5 times bigger, only when rendering to frame buffers. When drawing mainframebuffer to screen it is set to be equal to visible rectangle.
P.S. for zooming i'm using glTranslatef, because I need perspective projection.

carsten neumann
11-05-2012, 07:15 AM
You could split your draw calls into tiles so that each one does not exceed the max. size of the viewport.

However, why are you drawing stuff that you know won't fit on the screen anyway? Also, to just draw an image (and possibly zoom it) a full screen quad with appropriately chosen texture coordinates should be enough.

nigels
11-05-2012, 08:41 AM
Generally the viewport should be determined by the Windowing system - not fiddled by the application for viewing.
A full screen quad with well chosen texture coordinates ought to do the job.

- Nigel