Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-02 09:13:31

0001 // Created by: Kirill GAVRILOV
0002 // Copyright (c) 2013-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef OpenGl_PointSprite_HeaderFile
0016 #define OpenGl_PointSprite_HeaderFile
0017 
0018 #include <OpenGl_Texture.hxx>
0019 
0020 //! Point sprite resource. On modern hardware it will be texture with extra parameters.
0021 //! On ancient hardware sprites will be drawn using bitmaps.
0022 class OpenGl_PointSprite : public OpenGl_Texture
0023 {
0024   DEFINE_STANDARD_RTTIEXT(OpenGl_PointSprite, OpenGl_Texture)
0025 public:
0026   //! Create uninitialized resource.
0027   Standard_EXPORT OpenGl_PointSprite(const TCollection_AsciiString& theResourceId);
0028 
0029   //! Destroy object.
0030   Standard_EXPORT ~OpenGl_PointSprite() override;
0031 
0032   //! Destroy object - will release GPU memory if any.
0033   Standard_EXPORT void Release(OpenGl_Context* theCtx) override;
0034 
0035   //! Returns TRUE for point sprite texture.
0036   bool IsPointSprite() const override { return true; }
0037 
0038   //! @return true if current object was initialized
0039   bool IsValid() const override { return myBitmapList != 0 || myTextureId != NO_TEXTURE; }
0040 
0041   //! @return true if this is display list bitmap
0042   inline bool IsDisplayList() const { return myBitmapList != 0; }
0043 
0044   //! Draw sprite using glBitmap.
0045   //! Please call glRasterPos3fv() before to setup sprite position.
0046   Standard_EXPORT void DrawBitmap(const occ::handle<OpenGl_Context>& theCtx) const;
0047 
0048   //! Initialize point sprite as display list
0049   Standard_EXPORT void SetDisplayList(const occ::handle<OpenGl_Context>& theCtx,
0050                                       const GLuint                       theBitmapList);
0051 
0052 protected:
0053   // clang-format off
0054   GLuint myBitmapList; //!< if of display list to draw sprite using glBitmap (for backward compatibility)
0055   // clang-format on
0056 };
0057 
0058 #endif // _OpenGl_PointSprite_H__