Basic classes for ChuGL: strongly-timed audiovisual programming in ChucK.
Base ChuGL utility class.
float aspect()
Returns aspect ratio of the window. Equal to windowWidth / windowHeight.
GCamera camera()
Gets the GCamera used for rendering the main scene.
float dt()
Time in seconds since the last render frame.
string font(string fontPath)
Sets the default font for all text rendering.
string font()
Gets the path to the default font file for all text rendering.
int fps()
FPS of current window, averaged over sliding window of 30 frames.
int frameHeight()
Returns height of the framebuffer in pixels. Used for settings the viewport dimensions and camera aspect ratio.
int frameWidth()
Returns width of the framebuffer in pixels. Used for settings the viewport dimensions and camera aspect ratio.
void fullscreen()
Fullscreen the window. This will significantly improve performance.
FX fx()
Returns the root of the post processing chain. See the ChuGL post processing tutorial for more information.
void hideCursor()
Hides mouse cursor when focused on window.
void lockCursor()
Hides and locks cursor to the window.
int mouseCapturedByUI()
Returns true if the ImGui library is currently capturing the mouse.I.e. if the mouse is currently over an ImGui windowUseful for disabling mouse controls when the mouse is over an ImGui window.
float mouseDX()
Mouse horizontal position change since last frame.
float mouseDY()
Mouse vertical position change since last frame.
void mouseMode(int mode)
Set mouse mode. Options are GG.MOUSE_LOCKED, GG.MOUSE_HIDDEN, GG.MOUSE_NORMAL.
float mouseX()
Mouse horizontal position in window screen-space.
float mouseY()
Mouse vertical position in window screen-space.
NextFrameEvent nextFrame()
Registers the calling shred to be notified when the next frame is finished rendering. When all graphics shreds are finished calling.Note: this function returns an event that MUST be waited on for correct behavior, i.e. GG.nextFrame() => now;See the ChuGL tutorial and examples for more information.
int numRegisteredShreds()
Internal debug. Get number of registered graphics shreds.
int numRegisteredWaitingShreds()
Internal debug. Get number of registered graphics shreds currently waiting on GG.nextFrame()
void register()
For interal debug purposes, registers the calling shred to ChuGL's list of graphics-related shreds.
void resolution(int width, int height)
Change resolution of current window. Will NOT exit fullscreen mode.
GScene scene()
Gets the main scene, which is the root / parent of all GGens. Only the main scene and its connected GGens are rendered.
void showCursor()
Default mouse behavior. Not hidden or locked.
void unregister()
For internal debug purposes, unregisters the calling shred from the ChuGL's list of graphics-related shreds.
void useChuckTime(int use)
Internal debug. Switches between using Chuck VM time or GLFW window time for auto-updates.
int windowHeight()
Returns screen-space height of the window.
string windowTitle()
Returns the title of the window.
string windowTitle(string title)
Sets the title of the window.
dur windowUptime()
Time in seconds since the grapics window was opened.
int windowWidth()
Returns screen-space width of the window.
void windowed(int width, int height)
Enter windowed mode and set the window size to the specified width and height.
int MOUSE_HIDDEN
When passed to GG.mouseMode(mode), hides the cursor when focused on the ChuGL window.
int MOUSE_LOCKED
When passed to GG.mouseMode(mode), hides and locks the cursor to the ChuGL window. Good for FPS cameras.
int MOUSE_NORMAL
When passed to GG.mouseMode(mode), neither hides the cursor nor locks it to the ChuGL window (this is the default behavior)
[ top ]
Event triggered whenever the ChuGL window is resized, either by the user or programmatically.
WindowResizeEvent()
Default constructor for WindowResizeEvent.
[ top ]
ChuGL color utility class.
vec3 grayscale(vec3 rgb)
Convert an rgb value to grayscale, scaled according to NTSC formula based on human perception.
vec3 hsv2rgb(vec3 hsv)
Convert from hsv colorspace to rgb.
vec3 random()
Generate a random rgb color.
vec3 rgb2hsv(vec3 rgb)
Convert from rgb colorspace to hsvhsv stands for hue, saturation, value, and is a more human-friendly color formathue takes on a value between 0 and 360, and represents the color itselfsaturation takes on a value between 0 and 1, and represents the amount of colorvalue takes on a value between 0 and 1, and represents the brightness of the color.
vec3 BEIGE
Beige: (.827, .69, .514)
vec3 BLACK
Black: (0.0, 0.0, 0.0)
vec3 BLUE
Blue: (0.0, 0.0, 1.0)
vec3 BROWN
Brown: (.498, .416, .31)
vec3 DARKBLUE
Darkblue: (0, .322, .675)
vec3 DARKBROWN
Darkbrown: (.298, .247, .184)
vec3 DARKGRAY
Darkgray: (.3, .3, .3)
vec3 DARKGREEN
Darkgreen: (0, .459, .173)
vec3 DARKPURPLE
Darkpurple: (.439, .122, .494)
vec3 GOLD
Gold: (1.0, .796, 0)
vec3 GRAY
Gray: (.51, .51, .51)
vec3 GREEN
Green: (0.0, 1.0, 0.0)
vec3 LIGHTGRAY
Lightgray: (.784, .784, .784)
vec3 LIME
Lime: (0, .619, .184)
vec3 MAGENTA
Magenta: (1.0, 0.0, 1.0)
vec3 MAROON
Maroon: (.745, .129, .216)
vec3 ORANGE
Orange: (1.0, .631, 0)
vec3 PINK
Pink: (1.0, .427, .76)
vec3 PURPLE
Purple: (.784, .478, 1.0)
vec3 RED
Red: (1.0, 0.0, 0.0)
vec3 SKYBLUE
Skyblue: (.4, .749, 1.0)
vec3 VIOLET
Violet: (.529, .235, .745)
vec3 WHITE
White: (1.0, 1.0, 1.0)
vec3 YELLOW
Yellow: (.9921, .976, 0)
[ top ]