Viewport/Ortho Issues

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!

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.

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!

Hi,

please read the documentation for glViewport.

http://www.mevis.de/opengl/glViewport.html

You can always find a more detailed description in the specification.

http://www.opengl.org/documentation/specs/

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).

Cheers

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.