0032121: Draw Harness, ViewerTest - implement -reset option for vlight command
[occt.git] / src / OpenGl / OpenGl_PointSprite.hxx
1 // Created by: Kirill GAVRILOV
2 // Copyright (c) 2013-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #ifndef _OpenGl_PointSprite_H__
16 #define _OpenGl_PointSprite_H__
17
18 #include <OpenGl_Texture.hxx>
19
20 class OpenGl_PointSprite;
21 DEFINE_STANDARD_HANDLE(OpenGl_PointSprite, OpenGl_Texture)
22
23 //! Point sprite resource. On modern hardware it will be texture with extra parameters.
24 //! On ancient hardware sprites will be drawn using bitmaps.
25 class OpenGl_PointSprite : public OpenGl_Texture
26 {
27   DEFINE_STANDARD_RTTIEXT(OpenGl_PointSprite, OpenGl_Texture)
28 public:
29
30   //! Create uninitialized resource.
31   Standard_EXPORT OpenGl_PointSprite (const TCollection_AsciiString& theResourceId);
32
33   //! Destroy object.
34   Standard_EXPORT virtual ~OpenGl_PointSprite();
35
36   //! Destroy object - will release GPU memory if any.
37   Standard_EXPORT virtual void Release (OpenGl_Context* theCtx) Standard_OVERRIDE;
38
39   //! Returns TRUE for point sprite texture.
40   virtual bool IsPointSprite() const Standard_OVERRIDE { return true; }
41
42   //! @return true if current object was initialized
43   virtual bool IsValid() const Standard_OVERRIDE
44   {
45     return myBitmapList != 0
46         || myTextureId != NO_TEXTURE;
47   }
48
49   //! @return true if this is display list bitmap
50   inline Standard_Boolean IsDisplayList() const
51   {
52     return myBitmapList != 0;
53   }
54
55   //! Draw sprite using glBitmap.
56   //! Please call glRasterPos3fv() before to setup sprite position.
57   Standard_EXPORT void DrawBitmap (const Handle(OpenGl_Context)& theCtx) const;
58
59   //! Initialize point sprite as display list
60   Standard_EXPORT void SetDisplayList (const Handle(OpenGl_Context)& theCtx,
61                                        const GLuint                  theBitmapList);
62
63 protected:
64
65   GLuint myBitmapList; //!< if of display list to draw sprite using glBitmap (for backward compatibility)
66
67 };
68
69 #endif // _OpenGl_PointSprite_H__