• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem with setNeedsDisplay: in derived NSOpenGLView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with setNeedsDisplay: in derived NSOpenGLView


  • Subject: Re: Problem with setNeedsDisplay: in derived NSOpenGLView
  • From: Shaun Wexler <email@hidden>
  • Date: Thu, 1 Dec 2005 18:06:06 -0800

On Dec 1, 2005, at 9:13 AM, Brant Sears wrote:

I have a view that is derived from NSOpenGLView. It draws when it is initially opened and redraws when it is resized. However, when I call:

[glView setNeedsDisplay:YES];

the view is not redisplayed. I have verified that the value of the view to which I am sending the message is correct and also that the redraw is really not happening (using Quartz debug). When I resize the window (which resizes the view), Quartz debug shows it redrawing (and I see other consistant behavior), but not when I explicitly call setNeedsDisplay: on the view from a button push.

It sounds like you forgot to explicitly flush your GL context in - drawRect:

What things should I investigate that might cause this behavior?

Add an ivar to your GLView class, and some optimization code:

NSSize lastBoundsSize;


- (void)drawRect:(NSRect)rect
{
/* perform drawing here */

NSSize size;
if (!NSEqualSizes(lastBoundsSize, (size = [self bounds].size))) {
lastBoundsSize = size;
} else if (doubleBufferedAndPantherCompatible) {
glFlush();
} else { // singleBuffered, or doubleBufferedAndTigerOrGreater
glFlushRenderAPPLE();
}
}

--
Shaun Wexler
MacFOH
http://www.macfoh.com

Efficiency is intelligent laziness.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >Problem with setNeedsDisplay: in derived NSOpenGLView (From: "Brant Sears" <email@hidden>)

  • Prev by Date: Re: [NSApp mainMenu] returns nil under 10.4.3
  • Next by Date: CoreData and plugins
  • Previous by thread: Problem with setNeedsDisplay: in derived NSOpenGLView
  • Next by thread: Re: Problem with setNeedsDisplay: in derived NSOpenGLView
  • Index(es):
    • Date
    • Thread