Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

omegasyphon

mouse input question

This topic is 6161 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

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


Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
... and remove the local x variables. The one in main is never used and you should use yrot or xrot in renderscene.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!