i never thought settin a viewport would be such a pain

im using VB and OGL ( i dont know why im doin that) and 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!! herez how im settin the viewport

Pic1.ScaleMode = vbPixels
intWidth = Abs(Pic1.ScaleWidth)
intHeight = Abs(Pic1.ScaleHeight)
glViewport 0, 0, intWidth, intHeight

pic1 is the picture box into which im renderin.
thank u

  1. Maybe Pic1 is set up incorrectly?
  2. This is the ADVANCED OpenGL forum. Try somewhere else for beginner help.
  3. Since you’re using VB, and this seems to be a very basic OpenGL-on-VB interaction question, perhaps you’d have better luck on VB-oriented forums?

Oooh. I’m giddy. A wierd feeling of deja vu. It’s almost like I’ve seen this question two or three or four times already…

Have you ever considered the fact that it might not be the Viewport setup code, but rather the way you are drawing your line that is causing the problem? Or even that you might not be setting up your projection matrix correctly? (Or have you considered that this is an Advanced forum?)