Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:35

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 class OpenGl_PointSprite;
0021 DEFINE_STANDARD_HANDLE(OpenGl_PointSprite, OpenGl_Texture)
0022 
0023 //! Point sprite resource. On modern hardware it will be texture with extra parameters.
0024 //! On ancient hardware sprites will be drawn using bitmaps.
0025 class OpenGl_PointSprite : public OpenGl_Texture
0026 {
0027   DEFINE_STANDARD_RTTIEXT(OpenGl_PointSprite, OpenGl_Texture)
0028 public:
0029 
0030   //! Create uninitialized resource.
0031   Standard_EXPORT OpenGl_PointSprite (const TCollection_AsciiString& theResourceId);
0032 
0033   //! Destroy object.
0034   Standard_EXPORT virtual ~OpenGl_PointSprite();
0035 
0036   //! Destroy object - will release GPU memory if any.
0037   Standard_EXPORT virtual void Release (OpenGl_Context* theCtx) Standard_OVERRIDE;
0038 
0039   //! Returns TRUE for point sprite texture.
0040   virtual bool IsPointSprite() const Standard_OVERRIDE { return true; }
0041 
0042   //! @return true if current object was initialized
0043   virtual bool IsValid() const Standard_OVERRIDE
0044   {
0045     return myBitmapList != 0
0046         || myTextureId != NO_TEXTURE;
0047   }
0048 
0049   //! @return true if this is display list bitmap
0050   inline Standard_Boolean IsDisplayList() const
0051   {
0052     return myBitmapList != 0;
0053   }
0054 
0055   //! Draw sprite using glBitmap.
0056   //! Please call glRasterPos3fv() before to setup sprite position.
0057   Standard_EXPORT void DrawBitmap (const Handle(OpenGl_Context)& theCtx) const;
0058 
0059   //! Initialize point sprite as display list
0060   Standard_EXPORT void SetDisplayList (const Handle(OpenGl_Context)& theCtx,
0061                                        const GLuint                  theBitmapList);
0062 
0063 protected:
0064 
0065   GLuint myBitmapList; //!< if of display list to draw sprite using glBitmap (for backward compatibility)
0066 
0067 };
0068 
0069 #endif // _OpenGl_PointSprite_H__