1 // Created by: Kirill GAVRILOV
2 // Copyright (c) 2013-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
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.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #include <OpenGl_PointSprite.hxx>
17 #include <Graphic3d_TextureParams.hxx>
18 #include <OpenGl_Context.hxx>
19 #include <Standard_Assert.hxx>
20 #include <Image_PixMap.hxx>
22 IMPLEMENT_STANDARD_HANDLE (OpenGl_PointSprite, OpenGl_Texture)
23 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_PointSprite, OpenGl_Texture)
25 // =======================================================================
26 // function : OpenGl_PointSprite
28 // =======================================================================
29 OpenGl_PointSprite::OpenGl_PointSprite()
30 : OpenGl_Texture (NULL),
33 //myParams->SetFilter (Graphic3d_TOTF_NEAREST);
34 myParams->SetGenMode (Graphic3d_TOTM_SPRITE,
35 Graphic3d_Vec4 (0.0f, 0.0f, 0.0f, 0.0f),
36 Graphic3d_Vec4 (0.0f, 0.0f, 0.0f, 0.0f));
39 // =======================================================================
40 // function : ~OpenGl_PointSprite
42 // =======================================================================
43 OpenGl_PointSprite::~OpenGl_PointSprite()
48 // =======================================================================
51 // =======================================================================
52 void OpenGl_PointSprite::Release (OpenGl_Context* theGlCtx)
54 if (myBitmapList != 0)
56 Standard_ASSERT_RETURN (theGlCtx != NULL,
57 "OpenGl_PointSprite destroyed without GL context! Possible GPU memory leakage...",);
59 if (theGlCtx->IsValid())
61 glDeleteLists (myBitmapList, 1);
66 OpenGl_Texture::Release (theGlCtx);
69 // =======================================================================
70 // function : SetDisplayList
72 // =======================================================================
73 void OpenGl_PointSprite::SetDisplayList (const Handle(OpenGl_Context)& theCtx,
74 const GLuint theBitmapList)
76 Release (theCtx.operator->());
77 myBitmapList = theBitmapList;
81 // =======================================================================
82 // function : DrawBitmap
84 // =======================================================================
85 void OpenGl_PointSprite::DrawBitmap (const Handle(OpenGl_Context)& ) const
87 if (myBitmapList != 0)
89 glCallList (myBitmapList);