To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.dev.macOpen lugnet.cad.dev.mac in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / Macintosh / 469
468  |  470
Subject: 
Re: rotating models in MBC 0.4.1d Cocoa
Newsgroups: 
lugnet.cad.dev.mac
Date: 
Wed, 23 Jul 2003 22:33:30 GMT
Viewed: 
1262 times
  
Travis,

To date I have used this apporach in both C and Objective-C:

The mouse drag subroutine on the first loop through saves the current system
time in a global variable.

An event is then sent to initiate redrawing of the model.

The the model is then drawn using the display subroutine which ends with the
command glFinish().

Then on the second loop through the mouse drag routine, the system time
previously saved in the global variable is subtracted from the current system
time. If the difference is greater than 0.1 seconds, then during all subsequent
loops throught the mouse drag routine the basic draw routine is called instead
of the detailed draw routine.

Under C this works fine as the glFinish() command prevents all program execution
(including mouse drag polling) until the rendering has completed.

However in Objective-C:

tracking a mouse drag with mouseDragged also triggers the [self setNeedsDisplay:
YES] command to send an event to the drawRect routine.

drawRect then creates a render instance and allows this to render the window
before disposing of the instance.

If however during the rendering the mouse continues to move creating a new event
then I believe the system sends the new event to mouseDragged (immediately)
which now incorrectly assumes that the window has completed rendering and
calculates a time for rendering which is too short.

If however the mouse is dragged slowly, then the time between mouseEvents maybe
over the threshold time for basic drawing, thus creating the behavior observed
by Chris.

Taking a reading at the "beginning" and "end" of the frame can lead to less
predictable results.  Of course, for the first frame, you have to take your
initial reading at the beginning of the frame, because you have no previous
frame to judge against.

My intention is to move this timing routine into the render instance and see if
that averts the problem. An exercise for tonight - I'll let you know how I go.

Andrew...



Message has 1 Reply:
  Re: rotating models in MBC 0.4.1d Cocoa
 
(...) As an update to this comment, I have now placed the glFinish() command and the timing loop into the render instance, and now I get correct behavior. It's clear that Cocoa creates a new thread for each instance, therefore as guessed before, (...) (21 years ago, 25-Jul-03, to lugnet.cad.dev.mac)

Message is in Reply To:
  Re: rotating models in MBC 0.4.1d Cocoa
 
(...) I'm not sure I completely understand the above. What are you timing? If you are just timing how long the glFinish takes, then a change in its behavior might not be indicative of a bug in the new OpenGL drivers. And if you time how long you (...) (21 years ago, 23-Jul-03, to lugnet.cad.dev.mac)

7 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR