mouse input question

Started by
19 comments, last by omegasyphon 22 years, 9 months ago
how do i get get the mouse coords to move an object on the screen? is there a function in glut that i can use?
Advertisement
http://reality.sgi.com/mjk/spec3/spec3.html

----------------------------www.physicsforums.comwww.opengl.org
now is their a tutorial or example that demonstrates this?
alright why doesnt this work? if i move the mouse shouldnt it move what i have displayed or am i doing this wrong?

  void processmousecords(int x,int y){	xrot=x;	yrot=y;}void renderscene(){	GLfloat x;	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	glMatrixMode(GL_MODELVIEW);	glPushMatrix();	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);	glRotatef(x,1.0f,0.0f,0.0f);	glRotatef(30.0f,0.0f,0.0f,1.0f);	glEnableClientState(GL_VERTEX_ARRAY);	glVertexPointer(3,GL_FLOAT,0,cords);	glDrawElements(GL_TRIANGLE_STRIP,1600,GL_UNSIGNED_INT,corners);	glPopMatrix();	glutSwapBuffers();}void main(){	GLfloat x=0.0;	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);	glutCreateWindow("game engine console");	glutReshapeFunc(ChangeSize);	glutDisplayFunc(renderscene);	setuprc();	glutMotionFunc(processmousecords);	glutMainLoop();}  

is there anyway to process mouse input without using GLUT??
Hope i make it through the day
omegasyphon, try adding

glutPostRedisplay();

in your processmouse inputs function. this tells the renderer that the function has made an update.

paulP,

yes there is a way without glut. you use regular Win32 code. the topic goes into the WinProc, which i don''t wanna discuss, but that is where you would put your mouse processing commands.

a2k

------------------General Equation, this is Private Function reporting for duty, sir!a2k
... and remove the local x variables. The one in main is never used and you should use yrot or xrot in renderscene.
hehe a litter over sight i guess, forgot about that.
To answer some of your questions: Yes you can get mouse input without using the GLUT... Its called DirectInput, and it kicks ass (writing a tutorial on mouse movement with DI, and DirectAudio as we speak actually).

------------------------------
Trent (ShiningKnight)
E-mail me
OpenGL Game Programming Tutorials
Try glutPassiveMouseFunc

or something like that... check the specs!!!!

This topic is closed to new replies.

Advertisement