glutwarppointer, what should i use instead?

Member
Posts: 52
Joined: 2007.06
Post: #1
My native code uses this but it doesnt seem to work well under OSX.

The cursor warps to the middle of the screen with a height of 0, stuck at the top basically.

Ive verified the values that are being passed to glutwarppointer, they are correct.

Any suggestions on another call to use?

thanks for the help.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
glutWarpPointer worked fine the last time I used it, aside from the 0.25s delay thing discussed in the other recent thread on this topic. It just calls out to the CoreGraphics function that does the same thing.
Quote this message in a reply
Member
Posts: 52
Joined: 2007.06
Post: #3
Your the king onesadcookie,

It doesnt seem to work very well, it resets always to the same position no matter what args i give it.

My old code was
glutwarppointer(width/2, height/2) where width and height are set during reshape opengl callback.

I check the values and they are accurate, if i initialize the window to say 800 by 600 i get the 400 and 300.

The width seems to get set right but the height, no matter what i set it to seems to get stuck at the top of the mac bar(not sure what its called, toolbar or somethin) at what looks to be height 0 cause its as high as its goes.

I attempted negative values for fun and some different window settings.

Anythoughts?

All the cg fragment and vertex shader work like a charm thanks again for the help in the other thread
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #4
Wait, are you trying to use glutWarpPointer and SDL in the same program?!

GLUT and SDL are mutually exclusive.

SDL includes perfectly good mouse handling routines.
Quote this message in a reply
Member
Posts: 52
Joined: 2007.06
Post: #5
Glut and SDL are not mutually exclusive ive used them in many programs together.

I actually was just using SDL for the ease of image loading, there sdl_image lib was a little better than mine.

Ive used sdl_image but nothing other than that in a few programs where were dealing with a lot of different formats.

I guess maybe ive never actually used SDL now that i think about it, just sdl_image.

This is some older code im working with let me check before i talk anymore, lol
Quote this message in a reply
Member
Posts: 52
Joined: 2007.06
Post: #6
So would there be a way to use SDL_image without all the sdl overhead?

Its pretty strange,

Went through the process of destroying glut and only using SDL but i had some strange happenings with my clipping planes which are extracted from the model and projection view opengl matrix's.

Argg,

Nothing but hastles,

Guess im learnin a bit, i knew sdl was powerful and its relatively easy to setup.
Quote this message in a reply
Member
Posts: 260
Joined: 2005.05
Post: #7
I just had a question from a student on this topic, and I did enjoy to hit the "right" forum when Googling for it! Smile But I can't find the "other" tread mentioned here.

I just tried CGPostMouseEvent, which GLUT uses, and it seems fast and nice (500 calls in a fraction of a second). So why is there a delay? Is that imposed by GLUT?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #8
CoreGraphics uses a "local event suppression interval" following an artificial event during which natural events (of the same kind?) are discarded. If you want to actually move the cursor, you will need to turn off the suppression interval.

Normally, you should instead move the mouse once to the center of the window, disassociate the mouse and cursor position, and read the raw deltas out of the mouse moved events.
Quote this message in a reply
Member
Posts: 260
Joined: 2005.05
Post: #9
OneSadCookie Wrote:CoreGraphics uses a "local event suppression interval" following an artificial event during which natural events (of the same kind?) are discarded. If you want to actually move the cursor, you will need to turn off the suppression interval.

Normally, you should instead move the mouse once to the center of the window, disassociate the mouse and cursor position, and read the raw deltas out of the mouse moved events.
(Great with a quick reply!)

Do you mean that I can't move the mouse for some time after my call?

What is "normal" depends on the application. Moving the mouse to the center every time is what you want in some cases. That allows you to get "infinite" mouse range. Quite a few games are controlled that way. (I think Bugdom is, for instance.) Is that kind of control hard or even impossible to get today?
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #10
I hide the cursor and use CGWarpMouseCursorPosition every frame because the Wacom mouse ignores the disassociation and will continue to move the cursor. Dealing with Wacom is tricky... Even with the warped position I think I still had problems and further had to issue a command to the driver to constrain the mouse rect to the viewing window because otherwise it would send mouse clicks through to the dock and menus.

As I recall (it's been years since I worked this out), mouse deltas are still generated, even if you disassociate the mouse, aren't they?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #11
Yes, both techniques give you infinite mouse range.

I didn't know about Wacom devices breaking things though, that's annoying :/
Quote this message in a reply
Member
Posts: 260
Joined: 2005.05
Post: #12
OneSadCookie Wrote:Normally, you should instead move the mouse once to the center of the window, disassociate the mouse and cursor position, and read the raw deltas out of the mouse moved events.
Now I think I get it. You mean disassociating the mouse (with CGAssociateMouseAndMouseCursorPosition) and staying that way for as long as the cursor is hidden? And then the mouse pointer just sits, invisible, in the middle. Yes, that should work.

There is one side of it that disturbs me: Portability. I guess I will have to make a common interface to this functionality to all platforms that I want to support.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  glutWarpPointer lag and fps movement Ropeburn 3 6,785 Jan 18, 2011 09:47 PM
Last Post: OneSadCookie