View Full Version : Viewport/Ortho Issues
10-02-2006, 05:59 AM
I am trying to draw a viewport of around size 8000 with an ortho of about 500 inside a Qt application using a scroll area so I can see the various sections of the viewport when I want to. I have lines that are supposed to draw every 7.5 ortho coordinates for all 8000 viewport pixels. For some reason the lines seem to draw for only about 2000 pixels of the viewport even though the for-loop says to go for all 8000 pixels. Does anybody know if a QGLWidget has a limit on how big the viewport can be. Thanks for your help!
10-02-2006, 07:13 AM
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, &maxViewportDims) is an OpenGL implementation dependent value.
You seem to run on one which doesn't support viewports bigger than 2048.
10-02-2006, 02:56 PM
Where did you find this function call and enum at? I never saw anything like this in the Red Book or Super Bible. I have seen the function call before but never the enum. I tried that code out and it gave me a value of 2560 in maxViewportDims so I guess the biggest viewport I can have is 2560. Do you know of a way to change this value so I can handle bigger viewports? Thanks again!
please read the documentation for glViewport.
You can always find a more detailed description in the specification.
The specification is the the real nuts and bolts of OpenGL, whereas the Red Book is designed for a hands on introduction to the API and its applications. When in doubt, refer to the spec. I believe you will find its coverage comprehensive.
As Relic said, GL_MAX_VIEWPORT_DIMS is an implementation maximum, and therefor fixed, as are all such GL_MAX_* values (in case you were wondering).
10-02-2006, 10:29 PM
Independant of the maximum viewport size, it would be better to implement the scrolling functionality yourself. You'll get far better performance this way.
Just manually place two scrollbars, and change the parameters of glOrtho according to the scroll position. This should give exactly the same effect as using a scroll area, with the additional advantage that primitives outside the visible area are never actually drawn.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.