OpenGL Base

From FusionWiki

Jump to: navigation, search
OpenGL Base
General Information
Author: Min
Release Date: 2009 ( public beta )
Status: BETA
Last updated: Unknown
Version: Unknown
Build:

249

Developer-only: No
Website: Not available
Download: OpenGL Collection
Runtime Versions
HWA: Yes
Flash: No
Java: No
Java Mobile: No
Vitalize!: No
Unicode: No


The OpenGL Base is an extension for Multimedia Fusion 2 written by Min. It is part of the OpenGL Collection.

Contents

Actions

  • Position
    • Set X coordinate... - Set horizontal position of the Base window in the frame.
    • Set Y coordinate... - Set vertical position of the Base window in the frame.
  • Size
    • Set width... - Set width of the Base window.
    • Set height... - Set heightof the Base window.
  • Visibility
    • Show - Show the Base window.
    • Hide - Hide the Base window.
  • Pixel format descriptor
    • Double buffer... - Decides if the pixel format should be double buffered.
    • Stereo buffer... - Decides if the pixel format should have stereo buffers.
    • Color bits... - Set number of bitplanes in the color buffer.
    • Alpha bits... - Set number of bitplanes in the alpha buffer.
    • Depth bits... - Set number of bitplanes in the depth buffer.
    • Accum bits... - Set number of bitplanes in the accumulation buffer. ( zero if no accumulation buffer is needed. )
    • Stencil bits... - Set number of bitplanes in the stencil buffer. ( zero if no stencil buffer is needed. )
  • Create window - Create the Base window.
  • Make current - Make the rendering context of the Base window current. This is used when having multiple Base objects in the frame to determine which window to draw to.
  • Auto swap buffers
    • Enable - Enable auto swapping of the front and back buffers.
    • Disable - Disable auto swapping of the front and back buffers.
  • Swap buffers - Manually swap front and back buffers.
  • Auto redraw
    • Enable - Automatically trigger the On redraw event at the end of every MMF loop.
    • Disable - Disable auto redrawing of the window.
  • Force redraw - Manually triggers the On redraw event.
  • V-Sync
    • Enable - Enable V-Sync.
    • Disable - Disable V-Sync.

Conditions

  • Is visible? - Check if the Base window is visible.
  • Is V-Sync supported? - Check if V-Sync is supported.
  • Is V-Sync enabled? - Check if V-Sync is enabled.
  • Is double buffered? - Check if pixel format is double buffered.
  • Has stereo buffers? - Check if pixel format has stereo buffers.
  • On create window success - Triggered if the Base window was successfully created.
  • On create window failure - Triggered if the Base window creation failed.
  • On redraw - Triggered when the Base window needs to be redrawn.

Expressions

  • Get X position - Get horizontal position of the Base window in the frame.
  • Get Y position - Get vertical position of the Base window in the frame.
  • Get width - Get width of the Base window.
  • Get height - Get height of the Base window.
  • Pixel format descriptor
    • Color bits - Get number of bitplanes in the color buffer.
    • Alpha bits - Get number of bitplanes in the alpha buffer.
    • Depth bits - Get number of bitplanes in the depth buffer.
    • Accum bits - Get number of bitplanes in the accumulation buffer.
    • Stencil bits - Get number of bitplanes in the stencil buffer.
  • Handles
    • Get window handle - Get handle to the Base window.
    • Get device context handle - Get handle to the Base window device context.
    • Get rendering context handle - Get handle to the Base window rendering context.
  • Error
    • Get error number - Get window creation error number.
    • Get error string - Get window creation error message.

Usage

Here is an example that uses XLua to draw a white triangle in the Base window.

1
  • Start of Frame
  •  : Open "ext.opengl" in External C Module "opengl.dll"

     : Run embedded script "Main"

     : Create window

2
  •  : On create window success
  •  : Call Function: "MySetupRoutine"

3
  •  : On redraw
  •  : Call Function: "MyDrawRoutine"

The lua script:

width  = 320
height = 240

function MySetupRoutine()

 gl.MatrixMode( gl.PROJECTION )
 gl.LoadIdentity()
 glu.Perspective( 45, width/height, 0.1, 100 )
 gl.MatrixMode( gl.MODELVIEW )

end


function MyDrawRoutine()

 gl.Clear( gl.COLOR_BUFFER_BIT )
 gl.LoadIdentity()
 gl.Translate( 0, 0, -5 )
 
 gl.Begin( gl.TRIANGLES )
  gl.Vertex(  0,  1, 0 )
  gl.Vertex( -1, -1, 0 )
  gl.Vertex(  1, -1, 0 )
 gl.End()

end
Personal tools