1 // Created on: 2015-06-18
2 // Created by: Ilya SEVRIKOV
3 // Copyright (c) 2015 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef OpenGl_TextBuilder_Header
17 #define OpenGl_TextBuilder_Header
19 #include <Font_TextFormatter.hxx>
21 #include <OpenGl_Context.hxx>
22 #include <OpenGl_Font.hxx>
23 #include <OpenGl_VertexBuffer.hxx>
24 #include <OpenGl_VertexBufferEditor.hxx>
25 #include <OpenGl_Vec.hxx>
27 #include <NCollection_Vector.hxx>
28 #include <NCollection_Handle.hxx>
31 //! This class generates primitive array required for rendering textured text using OpenGl_Font instance.
32 class OpenGl_TextBuilder
36 //! Creates empty object.
37 Standard_EXPORT OpenGl_TextBuilder();
39 //! Creates texture quads for the given text.
40 Standard_EXPORT void Perform (const Font_TextFormatter& theFormatter,
41 const Handle(OpenGl_Context)& theContext,
43 NCollection_Vector<GLuint>& theTextures,
44 NCollection_Vector<Handle(OpenGl_VertexBuffer)>& theVertsPerTexture,
45 NCollection_Vector<Handle(OpenGl_VertexBuffer)>& theTCrdsPerTexture);
47 protected: //! @name class auxillary methods
49 Standard_EXPORT void createGlyphs (const Font_TextFormatter& theFormatter,
50 const Handle(OpenGl_Context)& theCtx,
52 NCollection_Vector<GLuint>& theTextures,
53 NCollection_Vector< NCollection_Handle < NCollection_Vector <OpenGl_Vec2> > >& theVertsPerTexture,
54 NCollection_Vector< NCollection_Handle < NCollection_Vector <OpenGl_Vec2> > >& theTCrdsPerTexture);
56 protected: //! @name class auxillary fields
58 NCollection_Vector<OpenGl_Font::Tile> myTileRects;
59 OpenGl_VertexBufferEditor<OpenGl_Vec2> myVboEditor;
62 #endif // OpenGl_TextBuilder_Header