-ve values for viewport

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??

What type is Pic1 and where do these min/max values come from?

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?

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.

Originally posted by Relic:
[b] 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.[/b]

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

Then start the debugger and check your viewing frustum and modelview matrix setup.