Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Mouse Control - OpenGL

Posted on 2003-11-20
4
Medium Priority
?
1,953 Views
Last Modified: 2011-09-20
Ok my question is simple enouph as many people have gatherd I've been making a 3d pong game. I am trying to add mouse control however its proving rather difficult as the OpenGL coidinates are different to the mouse cordinates on the screen . This means I can't say ptx(player translate x) = x (passive mouse motiion x) the same with the y.  Could someone help me liike tell me an equation or something . If you need anyinfo don't hessitate to ask . Im stuck until I get this done. No your not doing my uni homework either because im still in secodary school (year 10).

PS. I took a break from my game a while ago im not that slow

Thank you please help.

0
Comment
Question by:Paladin_VB
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Expert Comment

by:n_fortynine
ID: 9791906
Well, what OpenGL returns to you as the y coor will be the distance from the top of your (program) window to the current position of the mouse, while your supposed screen coord y will start from the bottom of your window and go up.
For example:
-------------------TOP OF WINDOW -----------------------




   Mouse -->  + (x, WIN_HEIGHT - y)






------------------BOTTOM OF WINDOW-------------------
If that's not what you're looking for please be more specific.
0
 
LVL 1

Expert Comment

by:Imhotep
ID: 9796532
you could use the new glut functions for mouse control: at the beginning you plave the mouse at the center of the window by using glutWarpPointer. Then, every frame you take the difference between the mouse position and the window center and move your player, maybe in z-direction for mouse movement in the x-direction or so. Finally you warp the cursor back to the window center.

Imhotep
0
 
LVL 1

Author Comment

by:Paladin_VB
ID: 9798263
I managed to solve it myself although what you said fortynine did help me. You can have the points
0
 
LVL 4

Accepted Solution

by:
n_fortynine earned 596 total points
ID: 9801872
Paladin_VB you can finalise the question by clicking Accept Comment I hope you've already known that. :)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question