• 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
Mixing OpenGL and NS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mixing OpenGL and NS


  • Subject: Mixing OpenGL and NS
  • From: Valerio Ferrucci <email@hidden>
  • Date: Wed, 22 Mar 2006 16:19:23 +0100

Hi,
in the drawRect method of my NSOpenGLView I draw some openGL stuff and then I want to draw a line on it (with NSBezierPath).
The problem is that the line is always covered by opengl and I never see it.


Any help?

Follows the code:

- (void)drawRect:(NSRect)rect
{
	// OpenGL
	glClearColor(0,0,0,0);
	glClear(GL_COLOR_BUFFER_BIT);
	if (draggedIcon >= 0)
	{	glColor3f(0.0f,1.0f,0.0f);
		glBegin(GL_TRIANGLES);
		glVertex3f(-1.0f,1.0f,0.0f);
		glVertex3f(1.0f,1.0f,0.0f);
		glVertex3f(0.,-1.,0.0f);
		glEnd();
	}
	glFinish();
	[[self openGLContext] flushBuffer];

	// Cocoa: draw a line with NSBezier
	NSRect	bounds = [self bounds];
	[[NSColor whiteColor] set];
	[NSBezierPath setDefaultLineWidth: 4];
	float	h = bounds.size.height * 3 / 4;
	NSPoint	from = NSMakePoint(0, h);
	NSPoint	to = NSMakePoint(bounds.size.width, h);
	[NSBezierPath strokeLineFromPoint:from toPoint:to];
}


================================================================== Valerio Ferrucci Tabasoft Sas email@hidden http://www.tabasoft.it


_______________________________________________ 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
  • Follow-Ups:
    • Mixing OpenGL and NS (2)
      • From: Valerio Ferrucci <email@hidden>
  • Prev by Date: Copy NSTableView row vs Bindings
  • Next by Date: Re: awakeFromNib vs appdidfinishlaunching
  • Previous by thread: Re: Copy NSTableView row vs Bindings
  • Next by thread: Mixing OpenGL and NS (2)
  • Index(es):
    • Date
    • Thread