Computer Graphics

Moderators: Sephiroth
Number of threads: 1263
Number of posts: 2665

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
mouse picking in opengl Posted by dev48 on 16 May 2003 at 12:56 AM
Hello!

I want to know if someone knows how to make real time picking in OpenGL!
Indeed i want to make a program where when my mouse move through an objeect this object would be highlighted..
Can someone explain me how to do this?

thanks
Report
Re: mouse picking in opengl Posted by gautam on 16 May 2003 at 5:21 AM
: Hello!
:
: I want to know if someone knows how to make real time picking in OpenGL!
: Indeed i want to make a program where when my mouse move through an objeect this object would be highlighted..
: Can someone explain me how to do this?
:
: thanks
:

You can use the picking of opengl, or you can use custom routines to do that or you can push the matrix, draw in orthographic mode and pop the matrix and then use regular WM_MOUSE to do what you want or use direct input to do what you want with the mouse


Report
Re: mouse picking in opengl Posted by Sephiroth on 16 May 2003 at 7:41 AM
: You can use the picking of opengl, or you can use custom routines to do that or you can push the matrix, draw in orthographic mode and pop the matrix and then use regular WM_MOUSE to do what you want or use direct input to do what you want with the mouse
:
:
:
I use regular WM_MOUSE and other windows messages to control mouselook in my 3D world, and it works fine. However, I may go to DirectInput later.

-Sephiroth

Report
Re: mouse picking in opengl Posted by dev48 on 16 May 2003 at 8:11 AM
Hello!

My problem is that i work with qt + opengl!
Of course I can use the equivalent of WM_MOUSE in qt but I think it's going to be hard...
Can you show me an example of your code?
Report
Re: mouse picking in opengl Posted by Sephiroth on 16 May 2003 at 11:57 AM
: Hello!
:
: My problem is that i work with qt + opengl!
: Of course I can use the equivalent of WM_MOUSE in qt but I think it's going to be hard...
: Can you show me an example of your code?
:
I don't know how QuickTime deals with GL. I hate Apple and don't deal with any of their products. However, the simlpe way to get mouse stuff working can be done without WM_MOUSE stuff (I upgraded). Here's a basic run-down:

1) Get the mouse coordinates and store them in a POINT variable
2) Get the window width and height
3) Set the mouse coordinates to width divided by two, and height divided by 2
4) Now you've got what you need! Calculate the distance the mouse had moved from the center of the screen, multiply that by sensitivity, and deal with the results

This method is used inside my 3D engine and is checked every frame. Very accurate and it doesn'tsuck my CPU dry either. I'll look for the sources of this being implemented on my old project and paste later.

-Sephiroth

Report
Re: mouse picking in opengl Posted by gautam on 16 May 2003 at 12:26 PM
Hi,
err I don;t think qt is quicktime. QT is an API normally used in KDE.

QT + OpenGL, thats only in the enterprise edition if its QT the API!! You bought the enterprise edition ?? Even in Linux its not free.

: : Hello!
: :
: : My problem is that i work with qt + opengl!
: : Of course I can use the equivalent of WM_MOUSE in qt but I think it's going to be hard...
: : Can you show me an example of your code?
: :
: I don't know how QuickTime deals with GL. I hate Apple and don't deal with any of their products. However, the simlpe way to get mouse stuff working can be done without WM_MOUSE stuff (I upgraded). Here's a basic run-down:
:
: 1) Get the mouse coordinates and store them in a POINT variable
: 2) Get the window width and height
: 3) Set the mouse coordinates to width divided by two, and height divided by 2
: 4) Now you've got what you need! Calculate the distance the mouse had moved from the center of the screen, multiply that by sensitivity, and deal with the results
:
: This method is used inside my 3D engine and is checked every frame. Very accurate and it doesn'tsuck my CPU dry either. I'll look for the sources of this being implemented on my old project and paste later.
:
: -Sephiroth
:
:

Report
Re: mouse picking in opengl Posted by Sephiroth on 17 May 2003 at 12:39 PM
Ah, I don't do the X-Win thing (WHICH IS NOT LINUX!@#). Linux is an OS thatis shell-based like DOS was. X-Win is a pretty GUI put over Linux that issues commands for a user based on pointing and clicking on stuff so that even people who have trouble finding the power switch can say they use Linux, when in reality they're just pointing and clicking with no clue what's really going on. Yeah I go overboard when it comes to X-Win kiddies because I used to code on the Linux kernel, and have been doing Linux forever, and it ticks me off that some people have the audacity to say they can use Linux when, if they were ata shell-prompt, would be crying for their mothers.

Anyways, were you referring to the KDE thing, or QuickTime. If it's the KDE thing, I can't really offer much help there. If it's QuickTime I can offer advice.

-Sephiroth




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.