This includes many updates, fixes and experimental architectural improvements.
Note that there are some API breaking changes highlighted below, however porting should be easy.
It's mostly an incremental improvement over VL v1.0 at this stage, plus better Qt4/Qt5 support, better OpenGL Core support, more powerful GLSL management in general, more coherent API and various fixes. It has also been battle-tested in a couple of big projects, so as far as I know it's quite stable.
I haven't been able to accept pull requests and patches so far because I had this major new version in the works for months - hopefully now I'll be able to go through the various feedback I've received and start incorporating the good stuff :)
OpenGLContext::dispatchRunEvent() renamed dispatchUpdateEvent()
Added standard GLSL includes uniforms.glsl
and vertex_attribs.glsl
Using new GLSL #pragma VL include
capability
#version 150 compatibility
is current preferred safe version for many GLSL scripts
mGLSLProgram->useProgram();
becomes
openglContext()->useGLSLProgram( mGLSLProgram.get() );
Legacy GLSL removed (these are taken care of from inside the GLSL script)
glsl->setGeometryInputType(GIT_TRIANGLES);
glsl->setGeometryOutputType(GOT_TRIANGLE_STRIP);
glsl->setGeometryVerticesOut( 3*6 );
Vertex Attrib Arrays now can be used in 3 ways:
// bind the tangent vertex attribute - can be done in 3 ways
#if 1
// user defines his custom vertex attribute
mGLSL->linkProgram();
int tangent_idx = mGLSL->getAttribLocation("VertexTangent"); VL_CHECK( tangent_idx != -1 );
model->setVertexAttribArray(tangent_idx, tangent.get() ); // GLSL: in vec3 VertexTangent (user declared)
#elif 0
// user uses pre-defined aliased utility vertex attribute
model->setVertexAttribArray( vl::VA_Tangent, tangent.get() ); // GLSL: vl_VertexTangent (decl. /glsl/std/vertex_attribs.glsl)
#else
// user uses pre-defined basic vertex attribute
model->setVertexAttribArray( vl::VA_TexCoord1, tangent.get() ); // GLSL: vl_VertexTexCoord1 (decl. /glsl/std/vertex_attribs.glsl)
#endif
sceneManager()->extractActors( *intersector.actors() );
becomes
sceneManager()->extractVisibleActors( *intersector.actors(), NULL );
Removed because not needed anymore: (see tessellation shader example, see morphing callback example)
geom_patch->convertToVertexAttribs();
mGLSL->addAutoAttribLocation( 0, "vl_Position" );
Added Qt4 & Qt5 GUI and filesystem support
Now QFile and QDirectories can be used as part of VL virtual file system - including Qt compiled resurces.
Added CalibratedCamera class for augmented reality applications
Added AdjacencyExtractor class
Used to generate PT_LINES_ADJACENCY, PT_LINE_STRIP_ADJACENCY,
PT_TRIANGLES_ADJACENCY, PT_TRIANGLE_STRIP_ADJACENCY primitive type for
silhouette extraction, geometry slicing and topology manipulation in geometry shaders.
Updated vlVolume
- Improved raycast volume rendering quality & fixed bugs.
- Automatic slice count computation for sliced volume rendering & fixed bugs.
- vl::genGradientNormals() utility function fixed.
added vl::Object::setObjectName()
added vl::String constructor for std::string
& std::wstring
Vector2, Vector3 and Vector4 can be constructed from single scalar.
Better automatic texture unit management.
User configurable VL_MAX_TEXTURE_UNITS now removed by internal VL_MAX_TEXTURE_IMAGE_UNITS
and VL_MAX_LEGACY_TEXTURE_UNITS constants.
Fixed warnings in glsl_math.hpp
Improved Buffer Object documentation in Array.hpp
Fixed various render states getter/setter constness in Shader.hpp
TriangleIterator supports PT_TRIANGLES_ADJACENCY primitive type.
removed Viewport::enableScissorSetup()
added Viewport::setScissorEnabled(bool)
added bool Viewport::isScissorEnabled()
Viewport::mSetupScissor -> mScissorEnabled
Improved Uniform getters/setters
Image:
- added support to IF_RG and
- new constructor Image(void* buffer_ptr, int buffer_bytes) allowing initializing an Image against a user/externally allocated buffer
TextureSampler::reset(int index, OpenGLContext* ctx) utility function to set a texture sampler to it's default disabled state.
Textures: Managed Textures and Destroy on Create.
Managed Textures: allow user to assign and manage the low level OpenGL handle with vl::Texture
Useful when you want to use a single vl::Texture object but change/recreate the underlying OpenGL texture handle at will.
Destroy on create: calling Texture::createTexture() (or any function that calls this) will automatically destroy any existing texture (not if it's managed).
GLSL: removed UniformInfo, AttribInfo and AutoAttribLocations
Because not useful and superseded by new auto vertex attrib system
GLSL: new #pragma VL include /path/to/file.glsl
directive
You can now include a GLSL file from another GLSL file!
GLSL: removed deprecated GeometryVerticesOut, GeometryInputType, GeometryOutputType logic
OpenGL 3+ uses the layout
keyword for these.
GLSL: added GLSLShader and GLSLProgram reload() functions
GLSLProgram::useProgram() removed, use OpenGLContext::useGLSLProgram()
GLSL: Automatic vertex attrib location binding:
vl_VertexPosition
vl_VertexNormal
vl_VertexColor
vl_VertexSecondaryColor
vl_VertexFogCoord
vl_VertexTexCoord0
vl_VertexTexCoord1
vl_VertexTexCoord2
vl_VertexTexCoord3
vl_VertexTexCoord4
vl_VertexTexCoord5
vl_VertexTexCoord6
vl_VertexTexCoord7
vl_VertexTexCoord8
vl_VertexTexCoord9
vl_VertexTexCoord10
GLSL: Automatic standard uniform detection:
vl_WorldMatrix
vl_ModelViewMatrix
vl_ProjectionMatrix
vl_ModelViewProjectionMatrix
vl_NormalMatrix
GLSL: various improvements and fixes.
Added Renderer::rederRaw() function.
Makes it easy to create custom Renderer classes.
Added Enabled
attribute to Actor and ActorTree.
See also the new/updated functions:
- bool Renderer::isEnabled(const Actor* actor)
- bool Rendering::isEnabled(const Actor* actor)
- bool SceneManager::isEnabled(const Actor* actor)
- SceneManager::extractActors() vs extractVisibleActors()
- Actor::setEnabled()/isEnabled()
- ActorTreeAbstract::setEnabled()/isEnabled()
- ActorTreeAbstract::extractActors() vs extractVisibleActors()
ActorTree API changes:
mChildren
is now protected and can be accessed in read-only mode using the children()
method.
New/updated methods to manipulate the tree nodes:
- void addChild(ActorTreeAbstract* node);
- void addChildOnce(ActorTreeAbstract* node);
- void setChild(int i, ActorTreeAbstract* node);
- void eraseChild(int i, int count=1);
- int findChild(ActorTreeAbstract* node);
- bool eraseChild(ActorTreeAbstract* node);
- void eraseChild(int i, int count = 1);
- void eraseAllChildren();
Automatic Generalized Vertex Attribute Arrays
- Unified API to access all vertex attibutes, position, normal, color but also
texture coords and the generic vertex attibutes (glVertexAttribPointer). - Standard vertex attributes like position, normal and color can be seen both
from the legacy API (ex.Geometry::normalArray()
) and the generic api
(ex.Geometry::vertexAttribArray( vl::VA_Normal )
). - Geometry::convertToVertexAttribs() removed as it's not needed anymore.
- Great simplification of lot's of code that can now be agnostic of legacy vs
generic vertex attributes usage.
Geometry::setColorArray() tries to not reallocate the color array.
It also sets the buffer object dirty.
Rendering: fixed bug creating a continuous stream of Textures
Always setup legacy GLSL matrices as well as vl standard matrix uniforms.
OpenGLContext: much better Core profile support and closer OpenGL state tracking.