OpenRM - RM Library (rmwin.c)

## Index of OpenRM - RM Library

     RMenum rmPipeSetContext (RMpipe *toUse,
    		          HGLRC theContext)

     RMpipe *toUse - a handle to an RMpipe object (input, but not const).

     HGLRC theContext - a valid to a Windows OpenGL context (created by
     wglCreateContext, or obtained by some other nefarious means).

Returns the current Windows OpenGL associated with an RMpipe object upon success. A return value of zero is returned if there is a problem.

Note that the OpenGL returned by this routine is not necessarily "active" unless this call is made after the RMpipe is "made current" by using rmPipeMakeCurrent.

librm library source file: rmwin.c

     RMenum rmPipeSetContext (RMpipe *toUse,
    		          HGLRC theContext)

     RMpipe *toUse - a handle to an RMpipe object (input, but not const).

     HGLRC theContext - a valid to a Windows OpenGL context (created by
     wglCreateContext, or obtained by some other nefarious means).

Use this routine to assign a Windows OpenGL rendering context to an RMpipe. Inside this routine, the input context "theContext" is copied into a field internal to the RMpipe object. This routine would be used, for example, to obtain an OpenGL context from your application (e.g., some FLTK infrastructure) and to tell OpenRM to use it for subsequent rendering.

Since this routine only makes a copy of the context, you need to "make it current" with a call to rmPipeMakeCurrent *after* you call rmPipeSetContext.

This routine will return RM_WHACKED if the input RMpipe is NULL. Otherwise, it returns RM_CHILL. No error checking is performed on the input Windows OpenGL context.

librm library source file: rmwin.c

     RMenum rmPipeSetWindow (RMpipe *toUse,
    		         HWND window,
    			 int windowWidth,
    			 int windowHeight)

     RMpipe *toUse - a handle to an RMpipe object (input, but not const).

     HWND window - a valid Win32 window handle (input).

     int windowWidth, int windowHeight - integer values specifying the
        pixel width & height of the window "w".

Use this routine to "bind" an X11 Window to an RMpipe. When this routine is called, the RMpipe's window attribute is set to the value specified by theWindow parameter, and the RMpipe's window pixel dimension attributes are set.

Note that there are no event callbacks associated with the RMpipe: when the window geometry changes (size, etc) it is the responsibility of the application to inform RM that the window geometry has changed (rmPipeSetWindowSize). There are separate versions of this routine for Win32 and X.

To assign an offscreen rendering area to the RMpipe, use the routine rmPipeSetOffscreenWindow() rather than rmPipeSetWindow().

Win32 notes: in addition to setting the window handle and size attributes, this routine also grabs the DC associated with the window, and stores the DC in a field in the RMpipe structure.

librm library source file: rmwin.c

     int rmPipeSetOffscreenWindow (RMpipe *toUse,
    		               HWND window,
    		               int windowWidth,
    		               int windowHeight)

     RMpipe *toUse - a handle to an RMpipe object (input, but not const).

     HWND window - a valid Win32 window handle (input).

     int windowWidth, int windowHeight - integer values specifying the
        pixel width & height of the window "w".

Use this routine to "bind" a Win32 HWND window to an RMpipe. When this routine is called, a number of things happen:

1. The RMpipe's notion of the window size is set (rmPipeSetWindowSize).

2. The OpenGL context contained within the RMpipe is made current.

3. Final internal initialization within RM on the RMpipe's OpenGL context is performed, readying both RM and OpenGL for use.

After this call succeeds, on X11 systems is is safe to begin making raw OpenGL calls. Note that things work a bit differently in Win32. See rmauxSetInitFunc().

Returns RM_CHILL upon success, or RM_WHACKED upon failure.

This routine should be used by all applications to activate an OpenGL context and to bind a window to the RMpipe.

Note that there are no event callbacks associated with the RMpipe: when the window geometry changes (size, etc) it is the responsibility of the application to inform RM that the window geometry has changed (rmPipeSetWindowSize). There are separate versions of this routine for Win32 and X.

On Win32, there is no distinction between an onscreen and offscreen window. The routine rmPipeSetOffscreenWindow() is present to provide API compatibility between X and Win32. Internally, this routine simply makes a call to rmPipeSetWindow().

librm library source file: rmwin.c