Solved

Mouse Control - OpenGL

Posted on 2003-11-20
4
1,944 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
  • 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 149 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Building cUrl in Windows v7.43.0 4 32
C++ finding a sting in a char* string from a text file 3 110
How to convert MFC APP to Win32 APP. 19 81
Header of docx file 17 103
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…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

831 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