[F-Script-talk] Re: OpenGL functions in f-script?
Brought to you by:
pmougin
From: Philippe M. <pm...@ac...> - 2004-02-21 00:50:17
|
Alas, no plan currently to implements access to OpenGL functions from=20 F-Script. As you experienced, F-Script only allows you to invoke Objective-C=20 methods, not C functions. In general, when you need to interface to=20 specific C functions from F-Script, it is relatively easy, for=20 Objective-C programmers, to wrap C-function with Objective-C methods=20 and call the latter from F-Script. This might be tedious if you need to=20= wrap a large set of C functions, tough. Best, Phil Le 21 f=E9vr. 04, =E0 01:17, Philippe de Rochambeau a =E9crit : > Philippe, > > do you have any plans to implement the OpenGLfunctions in FScript? > > I have tried to code tutorial0, which is available here=20 > http://divide.zerobyzero.ca/, in FScript, but to no avail because the=20= > OpenGL gl... functions are not accessible. > > Here's my code (the bottom part is untranslated Objective-C) for=20 > illustrative purposes, in case anyone is interested. > > ------------- > > scrWidth :=3D NSScreen mainScreen visibleFrame size width. > scrHeight :=3D NSScreen mainScreen visibleFrame size height. > winWidth :=3D 400. > winHeight :=3D 400. > "Centrer" > winX :=3D (scrWidth / 2) - (winWidth / 2). > winY :=3D (scrHeight / 2) - (winHeight / 2). > > "Instantiate and configure a window" > window :=3D NSWindow alloc initWithContentRect:(winX<>winY=20 > extent:winWidth<>winHeight) > styleMask:NSTitledWindowMask + NSClosableWindowMask+ > NSMiniaturizableWindowMask + NSResizableWindowMask > backing:NSBackingStoreBuffered defer:NO. > > "Put the window on screen" > window orderFront:nil. > > "Give a title to the window" > window setTitle:'Currency Converter'. > > nsgl :=3D NSOpenGLView alloc. > nsgl initWithFrame:winX<>winY winWidth<>winHeight . > > "Initialization" > nsglFormat :=3D NSOpenGLPixelFormat. > "NSOpenGLPixelFormatAttribute est juste un =E9num=E9ration de = constantes" > attr :=3D { > NSOpenGLPFADoubleBuffer, > NSOpenGLPFAAccelerated, > NSOpenGLPFAColorSize, BITS_PER_PIXEL, > NSOpenGLPFADepthSize, DEPTH_SIZE, > 0 }. > > > nsgl setPostsFrameChangedNotifications:YES. > > nsglFormat :=3D (NSOpenGLPixelFormat alloc) initWithAttributes:attr. > nsgl pixelFormat:nsglFormat. > > nsglFormat :=3D nil. > > (nsgl openGLContext) makeCurrentContext). > > "initGL method" > > glClearColor(0.0f, 0.0f, 0.0f, 0.0f); > > // Set the clear depth to 1. This is the initial (default) value. > // Set the depth function. This specifies when something will be = drawn. > // GL_LESS passes if the incoming > // depth value is LESS than the current value > // Turn the depth test on > > glClearDepth(1.0f); > glDepthFunc(GL_LESS); > glEnable(GL_DEPTH_TEST); > > // Set up a hint telling the computer to create the nicest (aka=20 > "costliest" or "most correct") > // image it can > // This hint is for the quality of color and texture mapping > > glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); > > // This hint is for antialiasing > > glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); > > ---------= |