View Full Version : Problem with form pixels and open gl

10-18-2009, 08:08 PM

I develop an application in visual basic.net that contains both vb controls and opengl. The problem is that the visual basic in forms uses pixels and opengl does not. I tried to make the conversion :

x = -1+(2/Form1.width)*x_coord_in_pixels
y = 1 - +(2/Form1.height)*y_coord_in_pixels

Gl.glRectf(x, y, x + 0.25, y + 0.25)

but i see that the coordinates in my form are still different from theese in opengl. It is a litle bit confusing but i hope you understand. If you don't please tell me and I will explain more

Thank you

10-19-2009, 05:45 AM
Would u explain what exactly are you trying to do..?? I mean why are u converting it..?? what is the problem u r trying to solve.??

10-19-2009, 03:47 PM
Well, my form contains both opengl components that i have created and .net controls. The problem is that I control the object's position dynamicaly, so when I say that the .net button is in position (100,200) the opengl component (for example a rectangle) should have the SAME position.

10-19-2009, 04:00 PM
holly god! It was the border of the form! I should disable it...
Thanks anyway