1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025213: Visualization, TKOpenGl - do not use deprecated built-ins in GLSL shaders

Inherit NCollection_Buffer from Standard_Transient, do not use incomplete NCollection_Handle.

OpenGl_Context, add methods ActiveProgram(),BindProgram()
to manage currently active GLSL program.
Add method ::ToUseVbo().

OpenGl_ShaderProgram, setup locations of pre-defined vertex attributes
occVertex, occNormal, occTexCoord, occColor before linkage.
Remove methods OpenGl_ShaderProgram::Bind(), ::BindWithVariables()
and ::Unbind() - OpenGl_Context::BindProgram() should be used instead.

Introduce class OpenGl_VertexBufferCompat, which emulates VBO
behavior on systems without VBO (compatibility with broken OpenGL drivers on Windows).

OpenGl_PrimitiveArray - use OpenGl_VertexBufferCompat when VBO is unavailable,
remove duplicated code. Use OpenGl_VertexBuffer::HasNormalAttribute()
method to activate lighting.

OpenGl_Text - use OpenGl_VertexBufferCompat, eliminate duplicated code.

Changes in OpenGl_VertexBuffer, drop methods BindFixed()/UnbindFixed().
Superseded by new methods BindAllAttributes()/UnbindAllAttributes()
which handle active GLSL program, when it is set.
This commit is contained in:
kgv
2014-09-17 13:02:32 +04:00
committed by bugmaster
parent 9f33b387e2
commit 7d3e64ef5e
30 changed files with 1057 additions and 735 deletions

View File

@@ -14,10 +14,14 @@
// commercial license or contractual agreement.
#include <NCollection_AlignedAllocator.hxx>
#include <NCollection_Buffer.hxx>
IMPLEMENT_STANDARD_HANDLE (NCollection_AlignedAllocator, NCollection_BaseAllocator)
IMPLEMENT_STANDARD_RTTIEXT (NCollection_AlignedAllocator, NCollection_BaseAllocator)
IMPLEMENT_STANDARD_HANDLE (NCollection_Buffer, Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT (NCollection_Buffer, Standard_Transient)
//=======================================================================
//function : NCollection_AlignedAllocator()
//purpose : Constructor

View File

@@ -17,10 +17,10 @@
#define _NCollection_Buffer_HeaderFile
#include <NCollection_BaseAllocator.hxx>
#include <NCollection_Handle.hxx>
#include <Standard_Transient.hxx>
//! Low-level buffer object.
class NCollection_Buffer
class NCollection_Buffer : public Standard_Transient
{
public:
@@ -128,8 +128,12 @@ protected:
Standard_Size mySize; //!< buffer length in bytes
Handle(NCollection_BaseAllocator) myAllocator; //!< buffer allocator
public:
DEFINE_STANDARD_RTTI(NCollection_Buffer) // Type definition
};
typedef NCollection_Handle<NCollection_Buffer> Handle(NCollection_Buffer);
DEFINE_STANDARD_HANDLE(NCollection_Buffer, Standard_Transient)
#endif // _NCollection_Buffer_HeaderFile