''this is for the top down viewport
Public Sub Check(oldX As GLfloat, oldY As GLfloat, _
newX As GLfloat, newY As GLfloat)
picRight = Form1.picCamera.ScaleLeft + Form1.picCamera.ScaleWidth
picBottom = Form1.picCamera.ScaleTop + Form1.picCamera.ScaleHeight
''this is to center the x and y cord
oldX = oldX - (picRight / 2)
oldY = picBottom / 2 - oldY
newX = newX - (picBottom / 2)
newY = picBottom / 2 - newY
''this working is supposed to do the conversion
oldX = 2 * (oldX + Look(1).x / 2)
oldY = 2 * (oldY - Look(1).z / 2)
newX = 2 * (newX + Look(1).x / 2)
newY = 2 * (newY - Look(1).z / 2)
however I end up with large results like -111 or 52, which can''t work well with the tiny 3d cords like 0 or -1. Your help is greatly appreciated.
Urgent! Need reply asap...
Sorry if this is blunt but i really need a solution to this problem quickly. Here''s the question:
I am trying to create a function that captures the vertexes contained within a mouse''s selection field. Basically what i do is I drag the mouse across an area, and it does a check to find out if the vertexes (which are glfloats) are contained within the area i dragged across. Here is how I went about:
1. records the first mouse down X,Y coordinates
2. records the X,Y coordinates when mouse up
3. passes to a function the 4 coordinates.
Note: The scale mode of the picturebox is PIXELS. (This is vb, but you can give me c++ solutions)
Now I am in desperate need of a way to convert the 4 cordinates from pixels to the floats of the 3d world cordinates. For example, the pixel for the oldX mouse cordinate is 300. I need the formula or a way to convert that 300 to a float as used in the 3d world data files. If you still do not understand, here is the solution that I got which doesn''t quite cut out.
it''s an assignment due in a few hours. and i still can''t figure it out. but it''s ok i''m not forcing anyone to answer.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement