• 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
NSOpenGLView flickering when adding/removing from superview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSOpenGLView flickering when adding/removing from superview


  • Subject: NSOpenGLView flickering when adding/removing from superview
  • From: Dorian Johnson <email@hidden>
  • Date: Sat, 23 Jun 2007 16:10:29 -0500

I have an NSOpenGLView subclass which is displayed in a custom tab view-like class (I'm not using a real tab view for a variety of reasons, but that's irrelevant: the real tab view does the same exact thing).

Basically, any time I switch from tab to tab, the entire area taken by the tab view briefly flickers to completely white. The tab view itself draws an opaque gray background, and the NSOpenGLView draws a black background (via glClear). This is really visually jarring so I need a solution of some sort.

The code that causes the flicker (from tab view's selectItem: method, with finalContentView as the new NSOpenGLView and initialContentView as the old one):
[self addSubview:finalContentView];
[initialContentView removeFromSuperviewWithoutNeedingDisplay];


If I switch the order, it does nothing to fix the problem.


The NSOpenGLView just draws a bitmap buffer

- (void)drawRect:(NSRect)rect
{
[self generateTexture]; // initializes the texture from the bitmap store

glClear(GL_COLOR_BUFFER_BIT);
GLfloat textureWidth = rdBufferWidth;
GLfloat textureHeight = rdBufferHeight;
glBindTexture(GL_TEXTURE_RECTANGLE_EXT, rdBufferTexture);


	glBegin(GL_QUADS);

	glTexCoord2f(0.0f, textureHeight);
	glVertex2f(-1.0f, 1.0f);
	glTexCoord2f(0.0f, 0.0f);
	glVertex2f(-1.0f, -1.0f);
	glTexCoord2f(textureWidth, 0.0f);
	glVertex2f(1.0f, -1.0f);
	glTexCoord2f(textureWidth, textureHeight);
	glVertex2f(1.0f, 1.0f);

	glEnd();

	[[self openGLContext] flushBuffer];
}
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Best drawing technology for audio waveforms, envelopes, etc.?
  • Next by Date: Re: Best drawing technology for audio waveforms, envelopes, etc.?
  • Previous by thread: Re: Best drawing technology for audio waveforms, envelopes, etc.?
  • Next by thread: ObjC 3D engine
  • Index(es):
    • Date
    • Thread