Mixing OpenGL and NS
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