[F-Script-talk] OpenGL functions in f-script?
Brought to you by:
pmougin
From: Philippe de R. <phi...@ww...> - 2004-02-21 00:24:22
|
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); --------- =20= |