res@ptsfa.PacBell.COM (stockwell-1140galaxy-Bob Stockwell) (01/01/89)
I recently purchased Turbo C 2.0, and I thought I would try my hand at Mouse programming. But I ran into a brick wall, and I wonder if anyone can help. My problem is that I can't keep up with the mouse motion. I want to plot some points on the screen, but I can't track the mouse fast enough to plot them. I first tried doing Mouse (Microsoft) function 3 (Get Status), in a polling fashion. That was far too slow. Then I resorted to function 12 (Set Subroutine). Figuring that I would keep up with the mouse, but probably slow it down at worse. Instead I experienced the same problem. I don't understand why I can't plot a single point, in the same time that the mouse driver is able to replot the whole cursor. It seems that my subroutine is not being called consistently. I would like to avoid writing an assembler subroutine, partly because I'm not real adept at assembler, but mostly I don't believe that Turbo C is making all that much difference. I tested it's graphics capabilities and it was able to plot 10,000 points in about 2 seconds. Does anyone have any experience with Turbo C and Microsoft Mouse (and EGA). Working code would be nice :-) Thanks, Bob Stockwell pacbell!ptsfa!res
jwright@atanasoff.cs.iastate.edu (Jim Wright) (01/01/89)
You might try changing the mickey/pixel ratio. This would slow the movement of the mouse, giving your routines more time to work. Of course, this could be bad from a response point of view.
corbin@pinocchio.Encore.COM (Steve Corbin) (01/04/89)
In article <4630@ptsfa.PacBell.COM> res@ptsfa.PacBell.COM (stockwell-1140galaxy-Bob Stockwell) writes: > >My problem is that I can't keep up with the mouse motion. >I want to plot some points on the screen, but I can't >track the mouse fast enough to plot them. I first tried >doing Mouse (Microsoft) function 3 (Get Status), in a >polling fashion. That was far too slow. Then I resorted >to function 12 (Set Subroutine). Figuring that I would >keep up with the mouse, but probably slow it down at >worse. Instead I experienced the same problem. I don't >understand why I can't plot a single point, in the same >time that the mouse driver is able to replot the whole >cursor. It seems that my subroutine is not being called >consistently. I would like to avoid writing an assembler I assume you can plot single points but are not getting a continous line as you move the mouse. If you are trying to make a 'draw' type program then you can't just plot single points. When the mouse moves the controller does not send the data for every point the mouse traversed. Try drawing a line from the current x,y point to the new point reported by the mouse. This will give the feel of a draw program. If you move the mouse too fast then circles come out with too many straight lines but all drawing programs I've seen do the same thing. Stephen Corbin UUCP: {bu-cs,decvax,necntc,talcott}!encore!corbin Internet: corbin@multimax.ARPA
gates@nsc.nsc.com (Tim Gates) (01/06/89)
I have found that the graphics routines in both Turbo C 1.5 and 2.0 are VERY slow. They are not optimized for a specific graphics board. They are general for all graphics boards. If you are having problems keeping up with the mouse, try (as a test) timing how long it takes to plot a dozen horizontal lines a few hundred pixels long each one pixel at a time. -- Tim Gates National Semiconductor {amdahl|decwrl|hplabs|nscpdc|pyramid|sun|voder}!nsc!gates "Where the men are men, and the computers run scared."
res@ptsfa.PacBell.COM (stockwell-1140galaxy-Bob Stockwell) (01/06/89)
In article <4570@xenna.Encore.COM>, corbin@pinocchio.Encore.COM (Steve Corbin) writes: > In article <4630@ptsfa.PacBell.COM> res@ptsfa.PacBell.COM (stockwell-1140galaxy-Bob Stockwell) writes: > > > >My problem is that I can't keep up with the mouse motion. > >I want to plot some points on the screen, but I can't > >track the mouse fast enough to plot them. I first tried > > ... > I assume you can plot single points but are not getting a continous line as > you move the mouse. > ... > > Try drawing a line from the current x,y point to the new point reported > by the mouse. This will give the feel of a draw program. If you move the > mouse too fast then circles come out with too many straight lines but all > drawing programs I've seen do the same thing. > > Stephen Corbin UUCP: {bu-cs,decvax,necntc,talcott}!encore!corbin > Internet: corbin@multimax.ARPA Bingo, that was the problem. As an aside, I found two articles in Turbo Technix (#4 and #5), that contain programs that use the Mouse. I typed them in, and had exactly the problem I first described. Well, after changing them according to Stephen's suggestion they now work great. Now, I have some basic tools to explore mouse/graphics programming. Thanks everyone. Bob Stockwell pacbell!ptsfa!res
hollen@spot.megatek.uucp (Dion Hollenbeck) (01/06/89)
From article <8889@nsc.nsc.com>, by gates@nsc.nsc.com (Tim Gates): > I have found that the graphics routines in both Turbo C 1.5 and 2.0 are > VERY slow. They are not optimized for a specific graphics board. They > are general for all graphics boards. > > If you are having problems keeping up with the mouse, try (as a test) > timing how long it takes to plot a dozen horizontal lines a few hundred > pixels long each one pixel at a time. > -- Also, If you are using the mouse to digitize something, try storing the points and not plotting the lines until all points have been drawn. This assumes, of course, that what you are digitizing is flat and can have the mouse moved over its surface. Dion Hollenbeck (619) 455-5590 x2814 Megatek Corporation, 9645 Scranton Road, San Diego, CA 92121 seismo!s3sun!megatek!hollen ames!scubed/