Re: Convert NSOpenGLView pixel coordinates to OpenGL world coordinates
Re: Convert NSOpenGLView pixel coordinates to OpenGL world coordinates
- Subject: Re: Convert NSOpenGLView pixel coordinates to OpenGL world coordinates
- From: Ian was here <email@hidden>
- Date: Sun, 7 Oct 2007 13:25:52 -0700 (PDT)
>From within the NSOpenGLView subclass...
- (void)reshape
{
NSSize viewSize = [self bounds].size;
glViewport( 0.0, 0.0, viewSize.width, viewSize.height
);
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective( 70.0, viewSize.width/viewSize.height,
0.2, 100.0 );
}
--- David Spooner <email@hidden> wrote:
>
> What code do you use to set the projection matrix;
> in particular, the
> near and far distances? How about the viewport?
>
> dave
>
> On 6-Oct-07, at 12:07 PM, Ian was here wrote:
>
> > The only issue that I'm having is that I'm getting
> > some rather strange values. Such as...
> >
> >
> > This is clicking on the center of the view:
> > x: 377.000000 y: 270.000000 wx: 0.175438 wy:
> > -0.899123
> >
> > Which seems OK.
> >
> >
> > This is the upper-left corner:
> > x: 41.000000 y: 582.000000 wx: -987407225.612816
> wy:
> > 942763954.976947
> >
> >
> > And this is near the lower-right corner:
> > x: 770.000000 y: 30.000000 wx: 0.000000 wy:
> -1.000000
> >
> >
> > There is one last step that I seem to be
> missing...
> >
>
>
____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
_______________________________________________
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