neuray API Programmer's Manual

mi::neuraylib::ICanvas_opengl Class Reference

[Rendering and Picking]

Description

Abstract interface for a canvas that represents an OpenGL buffer. The three methods below provide the interface for the render mode to directly interact with OpenGL resources to store the result of the rendering operation. Using this interface instead of mi::neuraylib::ICanvas allows the result of the rendering operation to remain on the GPU instead of transfering it back to main memory. From there it can be processed further, or can be simply displayed.

Public Member Functions

virtual Sint32 bind_opengl_context() =0
Binds the OpenGL context to be used by the render mode to the calling thread. More...
virtual Uint32 get_texture_id() const =0
Returns the texture ID to be used by the render mode. More...
virtual Sint32 release_opengl_context() =0
Releases the OpenGL context to be used by the render mode from the calling thread. More...

Member Functions

virtual Sint32 mi::​neuraylib::​ICanvas_opengl::bind_opengl_context() [pure virtual]

Binds the OpenGL context to be used by the render mode to the calling thread.

Note:

The implementation of this method depends on the operating system and/or the libraries used to interact with OpenGL. On Windows, the implementation of this method usually calls wglMakeCurrent(). On Linux, glXMakeCurrent() is typically used.

See also:

release_opengl_context()

Returns

0 in case of success, -1 in case of failure

virtual Uint32 mi::​neuraylib::​ICanvas_opengl::get_texture_id() const [pure virtual]

Returns the texture ID to be used by the render mode. The result of the rendering operation is written to the OpenGL buffer identified by this texture ID. The resolution and pixel type of the texture resource has to match the results of get_resolution_x(), get_resolution_y(), and get_type().

virtual Sint32 mi::​neuraylib::​ICanvas_opengl::release_opengl_context() [pure virtual]

Releases the OpenGL context to be used by the render mode from the calling thread.

Note:

The implementation of this method depends on the operating system and/or the libraries used to interact with OpenGL. On Windows, the implementation of this method usually calls wglMakeCurrent(). On Linux, glXMakeCurrent() is typically used.

See also:

bind_opengl_context()

Returns

0 in case of success, -1 in case of failure