Jump to content
  • Advertisement
Sign in to follow this  
GTuan

Select and move Vertices by mouseX, mouseY of gluUnProject

This topic is 2579 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I solved the problem turn on 'Line' and 'point' at the same time.I have funtion:
public void convert2dto3d(int _winX,int _winY,int _winZ)
{
//int array 4
int[] viewp = new int[4];
double[] modelview = new double[16];
double[] proj = new double[16];
int winX;
int winY, winZ;
GL.glGetDoublev(Convert.ToUInt32(GLFlags.GL_MODELVIEW_MATRIX), modelview);
GL.glGetDoublev (Convert.ToUInt32 (GLFlags.GL_PROJECTION_MATRIX),proj);
GL.glGetIntegerv(Convert.ToUInt32(GLFlags.GL_VIEWPORT), viewp);
winX = _winX;
winY = viewp[3]-_winY;
winZ = _winZ;
//output is mposWldX,mposWldY,mposWldZ
GL.gluUnProject(winX, winY, winZ, modelview, proj, viewp,out mposWldX,out mposWldY,out mposWldZ);
}

You can see mposWldX, mposWldY, mposWldZ in convert2dto3d function.X, Y of the mouse became mposWldX, mposWldY, mposWldZ in 3D.
I store the coordinates of each point into _posX , _posY , _posZ when click mouse to draw the line.
Next,if the value of mposWldX = posX -> this point is selected.
I'm having trouble here.:o
Draw function:
private void DrawDot(float xt, float yt, float zt)
{
GL.glPointSize(5.0F);
GL.glBegin(GL.GL_POINTS);
for (int i = 0; i <= i; i++)
{
GL.glVertex3f(_posX, _posY, _posZ);
//when the button click, Enable =! Enable
if (Enable)
{
//problem:messagebox appears repeatedly when run
if (mposWldX == _posX[iz]) MessageBox.Show("select");
}
}
GL.glEnd();
}

And drawline function:
public void Draw1(float xt,float yt,float zt)
{
GL.glColor3f (1.0F, 1.0F, 0.0F);
GL.glBegin ( GL.GL_LINE_STRIP);
for (int i = 0; i <=i; i++)
{
GL.glVertex3f(_posX, _posY, _posZ);
}
GL.glEnd();

}

How to disable drawing mode switch on the mode selected?
I do not want to use GL_SELECT.Just grab My mouse coordinates in the world compared with the coordinates X, Y of point i

Share this post


Link to post
Share on other sites
Advertisement
I chose vertices by gluUnProject :rolleyes:.I am the axis x, y appear when users select and move vertices.Just one thing.That is to select the face and edges?
The console code is similar csgl .Help me :unsure:

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!