![]() |
ImFusion SDK 4.3
|
With SDK version 2.32 we moved the low-level OpenGL wrapper classes and interfaces to the newly introduced ImFusionGL library. This opportunity was used to address a couple of issues of the existing classes and clean up the interfaces where needed. We introduced the new ImFusion::GL namespace so that all affected GlFooBar
classes in ImFusionLib (header ImFusion/GL/GlFooBar.h
) have their new counterpart in GL::FooBar
(header ImFusion/Core/GL/FooBar.h
). For many classes, it is sufficient to simply change the include and use the new class name. However, for some classes there are breaking changes (both in API and in behavior). Please follow this document to get detailed information on what has changed.
See also: Context management
We introduced the new GL::Context::CreateInfo struct to encapsulate the configuration options for new OpenGL contexts to create. As a result, constructors/factory functions no longer take a series of arguments but a single instance of that struct. Furthermore, you can now configure whether you want to create a Debug Context if supported (see also Debugging).
A series of static helper functions of the GlContext class has not been migrated to GL::Context. Instead, their functionality has been moved to free functions with an improved interface in the GL namespace, see Utilities. You can use the GlContextDeprecationLayer namespace as a temporary workaround to keep the old API.
The GLCHECK
and GL_CALL()
have been migrated to ImFusionGL (now in Core/GL/Debug.h
). However, we discourage relying on this kind of explicit error checking because it's cumbersome and rather ineffective. Instead, we recommend to use the OpenGL Debug Context facilities to track OpenGL errors.
See also. Texture management
Originally, OpenGL texture objects were solely handled by the GlImage class, which had some disadvantages such as such as doing certain opaque format conversions or not supporting special targets such as array textures. ImFusionGL introduces the new GL::Texture class to more closesly model the API of OpenGL texture objects independent of the ImFusion Image API. The GlImage class now holds a Gl::Texture internally and provides an implicit conversion to a GL::Texture reference so that you can pass it easily to other ImFusionGL classes expecting a GL::Texture as input.
Finally, we introduced the GL::InternalFormat class serving as scoped enumeration with a couple of convenience functions for working with texture formats.
GlSamplingParameters has been renamed to GL::Sampler. It's enumerations have been made scoped, thus code like this
becomes
The following changes apply when migrating from GlFramebuffer to GL::Framebuffer:
See also: GLSL Shaders
The following changes apply when migrating from GlProgram to GL::Program:
bindAttributeLocation()
and bindFragDataLocation()
have been removed, use explicit input/output mapping instead.finish()
has been moved to a free function in the GL namespace because it was often used needlessly. If the implicit synchronization of shader executions is not sufficient, use OpenGL memory barriers instead.The DeviceCodeRepository infrastructure has been deprecated for GLSL shaders and OpenCL kernels. Instead, GL::Program will load shader code from through the ImFusion Resource System. If a shader name contains a path prefix this will be interpreted as repository name to allow for more specific source code queries and resolve potential ambiguities. For instance the identifier MyPlugin/MyShader.frag
will first search to find the resource MyShader.frag
in a repository with the name MyPlugin
. Only if this can not be resolved, it will continue searching for a resource with the name MyPlugin/MyShader.frag
in any registered repository.
.gl
to shader names if they don't have one.The GlAbstractInclude interface was split into the GL::AbstractInclude base interface and the templated GL::MultiIncludable interface. If you require the functionality of both polymorphic shader includes and having multiple includes of the same type in one shader, you must now inherit from both interfaces. This enables us to disentagle it from ImFusionLib dependencies (such as SharedImage) and furthermore make the text replacement happening with multi-includable shader includes explicit. This has implications on the GlMask and Deformation interfaces (see below)!
Due to the refactoring of abstract shader includes (see above), the GlMask and Deformation interfaces exhibit partially breaking API changes:
setIncludeArguments()
function was changed:GL::Program&
instead of a GlProgram*
const SharedImage*
as input: This argument was never considered anyway and was merely there for technical reasons.createMultiInclude()
instead.See also: Buffers
The following changes apply when migrating from GlBuffer to GL::Buffer:
becomes
Since our font rendering has matured, the polymorphic aspect of GlTextRenderer is discontinued and ImFusionGL provides only the non-virtual GL::TextRenderer class. The GlContextManager singleton is no longer required since GL::TextRenderer inherits from GL::InstanceManager so that you can easily access a cached instance from anywhere in a thread-safe fashion.
The GL::TextRenderer::Font structure has been changed/extended to include the font color as well as Flags to select font face and decoration, so that you do not need to pass them as extra parameters to the renderText()
overloads. Furthermore, our font rendering now finally support all combinations of decoration options. The 3D overload of renderText()
has been renamed to renderTextWorld()
to yield more explicit code on the call-site.
becomes
We fixed an (undocumented) inconsistency of where the position passed to GlTextRenderer::renderText() was not considered wrt. the viewport passed to the same function but wrt. the viewport of the current global OpenGL context state. The new GL::TextRenderer::renderText() function will always use the viewport passed as argument. Thus, if after migration to the new API your text does not end up where you expect (or not at all) make sure that you pass the correct viewport and do not rely on the current OpenGL context state.
The default font family (Deja Vu Sans) is now fully included/embedded in ImFusionGL. You no longer need to register a default family yourself. When registering extra font families, you should provide a fourth face (italic+bold) so that GL::TextRenderer is capable of rendering all combinations of faces.
ServerState
and ClientAttrib
(wrapping glPush/PopAttrib()
and glPush/PopClientAttrib()
).glPointSize()
yourself.