PDA

View Full Version : -ve values for viewport



mithun_daa
11-11-2003, 11:27 AM
im workin on a vb6 project n im usin opengl. the problem i have is that my project works only when my viewport height is negative, kinda wierd right!!! every time i set the height to a +ve value nothin appears on the scene. herez how im settin my viewort

Pic1.Scale (dblXMin, dblYMax)-(dblXMax, dblYMin)
intWidth = Pic1.ScaleWidth
intHeight = Pic1.ScaleHeight
glViewport 0, 0, intWidth, intHeight

any comments??

Xmas
11-11-2003, 12:07 PM
What type is Pic1 and where do these min/max values come from?

mithun_daa
11-11-2003, 12:27 PM
pic1 is the picture box, n im settin the viewport equal to the maximum and minimum x,y values i get from a DEM file.


Originally posted by Xmas:
What type is Pic1 and where do these min/max values come from?

Relic
11-12-2003, 01:33 AM
Originally posted by mithun_daa:
the problem i have is that my project works only when my viewport height is negative, kinda wierd right!!! every time i set the height to a +ve value nothin appears on the scene.

glViewport requires positive width and height values, otherwise you'll get a GL_INVALID_VALUE error.
This also means the call with the negative value had no effect and the previous viewport size has not changed, and might still be set to the window size on startup.

It might help to remember that Windows uses a top left origin and OpenGL a bottom left.

mithun_daa
11-12-2003, 07:00 AM
Originally posted by Relic:
glViewport requires positive width and height values, otherwise you'll get a GL_INVALID_VALUE error.
This also means the call with the negative value had no effect and the previous viewport size has not changed, and might still be set to the window size on startup.

It might help to remember that Windows uses a top left origin and OpenGL a bottom left.


does it really matter where the origin of windows is? cause opengl just renders in the RC and I THINK that the rendering context will have the origin as set by opengl.

anywayz, i have another problem, iv set a +ve viewport and im tryin to draw just one line from the bottom left corner to the top right corner, whatz happenin is that the line is slightly shifted. the line is starting at some height and width and not at the bottom left corner and extends beyond the right side of the window. somebody help!!
thank u

Relic
11-14-2003, 08:49 AM
Then start the debugger and check your viewing frustum and modelview matrix setup.