Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-29 09:20:02

0001 // Created on: 2015-06-18
0002 // Created by: Ilya SEVRIKOV
0003 // Copyright (c) 2015 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef OpenGl_TextBuilder_Header
0017 #define OpenGl_TextBuilder_Header
0018 
0019 #include <OpenGl_Font.hxx>
0020 #include <OpenGl_VertexBuffer.hxx>
0021 #include <OpenGl_VertexBufferEditor.hxx>
0022 #include <OpenGl_Vec.hxx>
0023 
0024 #include <NCollection_DynamicArray.hxx>
0025 #include <NCollection_Handle.hxx>
0026 
0027 class Font_TextFormatter;
0028 
0029 //! This class generates primitive array required for rendering textured text using OpenGl_Font
0030 //! instance.
0031 class OpenGl_TextBuilder
0032 {
0033 public:
0034   //! Creates empty object.
0035   Standard_EXPORT OpenGl_TextBuilder();
0036 
0037   //! Creates texture quads for the given text.
0038   Standard_EXPORT void Perform(
0039     const occ::handle<Font_TextFormatter>&                      theFormatter,
0040     const occ::handle<OpenGl_Context>&                          theContext,
0041     OpenGl_Font&                                                theFont,
0042     NCollection_DynamicArray<GLuint>&                           theTextures,
0043     NCollection_DynamicArray<occ::handle<OpenGl_VertexBuffer>>& theVertsPerTexture,
0044     NCollection_DynamicArray<occ::handle<OpenGl_VertexBuffer>>& theTCrdsPerTexture);
0045 
0046 protected: //! @name class auxiliary methods
0047   Standard_EXPORT void createGlyphs(
0048     const occ::handle<Font_TextFormatter>& theFormatter,
0049     const occ::handle<OpenGl_Context>&     theCtx,
0050     OpenGl_Font&                           theFont,
0051     NCollection_DynamicArray<GLuint>&      theTextures,
0052     NCollection_DynamicArray<NCollection_Handle<NCollection_DynamicArray<NCollection_Vec2<float>>>>&
0053       theVertsPerTexture,
0054     NCollection_DynamicArray<NCollection_Handle<NCollection_DynamicArray<NCollection_Vec2<float>>>>&
0055       theTCrdsPerTexture);
0056 
0057 protected: //! @name class auxiliary fields
0058   NCollection_DynamicArray<OpenGl_Font::Tile>        myTileRects;
0059   OpenGl_VertexBufferEditor<NCollection_Vec2<float>> myVboEditor;
0060 };
0061 
0062 #endif // OpenGl_TextBuilder_Header