Windows WGL declarations for OpenGL rendering-context creation, destruction, procedure lookup, and current-context binding.
Imported functions
Stack effects list a C function's parameters with the first parameter on top; see importFunction.
wglCreateContext
(Arg1 -- result) Creates an OpenGL rendering context for a device context.Inputs
Arg1:HDCdevice-context handle whose pixel format is already set withSetPixelFormat.
Outputs
result:HGLRCrendering-context handle, orNILon failure.
wglDeleteContext
(Arg1 -- result) Deletes an OpenGL rendering context.Inputs
Arg1:HGLRCrendering-context handle to delete.
Outputs
result:Int32nonzeroon success,0on failure.
wglGetProcAddress
(procedureName -- result) Retrieves an extension procedure address for the current OpenGL rendering context.Inputs
procedureName:Natxaddress of a zero-terminated byte string naming the procedure.
Outputs
result:Natxraw procedure address, or0nxif no rendering context is current or lookup fails; to call the procedure, view the address as Code withaddressToReferenceand acodeRefsignature.
wglMakeCurrent
(arg2 arg1 -- result) Makes a rendering context current for a device context.Inputs
arg2:HGLRCrendering-context handle, or aNILHGLRCto release the calling thread's current context.arg1:HDCdevice-context handle, ignored whenarg2isNIL.
Outputs
result:Int32nonzeroon success,0on failure.
Signature examples
Printing imported names during compilation shows the exact imported signatures.
"control" use
"windows/opengl32" use
{} Int32 {} [
@wglCreateContext printStack _:;
@wglDeleteContext printStack _:;
@wglGetProcAddress printStack _:;
@wglMakeCurrent printStack _:;
0
] "main" exportFunction
Expected Output During Compilation
{Arg1: {DC: (); unused: Int32;} Cref;} {GLRC: (); unused: Int32;} Cref {convention: "";} codeRef
{Arg1: {GLRC: (); unused: Int32;} Cref;} Int32 {convention: "";} codeRef
{lpParameter: Natx;} Natx {convention: "";} codeRef
{arg1: {DC: (); unused: Int32;} Cref; arg2: {GLRC: (); unused: Int32;} Cref;} Int32 {convention: "";} codeRef
wglGetProcAddress prints its input as lpParameter: a Code schema is identified by its input schemas, output and options, not by the input names, and printing uses the names of the first signature of that structure, here one imported from kernel32.
See also
- windows/gdi32: GDI32 pixel-format and buffer-swap declarations.
- windows/user32: User32 windowing, message, cursor, monitor, and device-context declarations.