Jump to content

  • Log In with Google      Sign In   
  • Create Account

mouse input question


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
20 replies to this topic

#1   Members   -  Reputation: 100

Like
Likes
Like

Posted 02 July 2001 - 06:22 AM

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?

#2   Members   -  Reputation: 122

Like
Likes
Like

Posted 02 July 2001 - 08:58 AM

http://reality.sgi.com/mjk/spec3/spec3.html



#3   Members   -  Reputation: 100

Like
Likes
Like

Posted 02 July 2001 - 01:27 PM

now is their a tutorial or example that demonstrates this?

#4   Members   -  Reputation: 100

Like
Likes
Like

Posted 06 July 2001 - 02:48 AM

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();
}




#5   Members   -  Reputation: 122

Like
Likes
Like

Posted 06 July 2001 - 04:57 AM

is there anyway to process mouse input without using GLUT??

#6   Members   -  Reputation: 124

Like
Likes
Like

Posted 06 July 2001 - 06:31 AM

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



#7   Members   -  Reputation: 122

Like
Likes
Like

Posted 06 July 2001 - 03:17 PM

... and remove the local x variables. The one in main is never used and you should use yrot or xrot in renderscene.

#8   Members   -  Reputation: 100

Like
Likes
Like

Posted 06 July 2001 - 07:08 PM

hehe a litter over sight i guess, forgot about that.

#9   Members   -  Reputation: 1323

Like
Likes
Like

Posted 07 July 2001 - 01:15 AM

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

#10   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 July 2001 - 01:26 AM

Try glutPassiveMouseFunc

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

#11   Members   -  Reputation: 124

Like
Likes
Like

Posted 07 July 2001 - 04:44 AM

ShiningKnight, looking forward to it. Are there any tutes out there right now that cover some of that stuff? (maybe i''ll check nehe.) either way, when will your tute come out?

a2k

#12   Members   -  Reputation: 1323

Like
Likes
Like

Posted 07 July 2001 - 05:06 AM

Hmmm... Whenever I feel like writing the tut (I just wrote a 17 page one on .md2 loading and .ms3d loading that should be up on NeHe''s site pretty soon... So I''m a little burned out on writing). But the code *IS* done, so whenever I feel like writing, I''ll write it.

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

#13   Members   -  Reputation: 100

Like
Likes
Like

Posted 07 July 2001 - 06:01 AM

ok what is the difference between the two?

glutMotionFunc(processMouseActiveMotion);
glutPassiveMotionFunc(processMousePassiveMotion);

#14   Members   -  Reputation: 100

Like
Likes
Like

Posted 07 July 2001 - 06:05 AM

cool it works

#15   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 July 2001 - 12:39 PM

I thought abut DirectInput, but i already know how to use that, i wanted to know if there was any other pratical ways to trap the mouse!!

As for the tut's, looking forward to them, i already know how to use DirectInput, but i always benefit from looking at tutorials, i get to see all the little tricks i missed first time round!!

Will they be based on C or C++??



Edited by - PaulP on July 7, 2001 7:40:58 PM

#16   Members   -  Reputation: 100

Like
Likes
Like

Posted 08 July 2001 - 03:57 PM

i found after searching that their are very little tutorials on directinput about devices. but theres a ton on graphics

#17   Members   -  Reputation: 2076

Like
Likes
Like

Posted 08 July 2001 - 04:08 PM

That''s because the SDK documents are fairly complete. There isn''t too much to mouse input in DI - or keyboard either. Joystick is just a little bit more involved. So, check your SDK docs - the answer lies within.



Or some fantasy-sounding junk like that...

#18 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 11 July 2001 - 11:25 AM

http://www.gamedev.net/reference/articles/article539.asp

#19   Members   -  Reputation: 174

Like
Likes
Like

Posted 11 July 2001 - 12:02 PM

Don''t bother with DirectInput to grab the mouse, unless you need automatic buffering (which you could set up using less code than it takes to initialize DirectInput properly). Use GetCursorPos (and SetCursorPos to set the position) instead.

#20   Members   -  Reputation: 122

Like
Likes
Like

Posted 11 July 2001 - 11:40 PM

whenever i try to read the mouse coords with GetCursorPos, my game crashes. why?




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.




PARTNERS