1 // Created by: Kirill GAVRILOV
2 // Copyright (c) 2013 OPEN CASCADE SAS
4 // The content of this file is subject to the Open CASCADE Technology Public
5 // License Version 6.5 (the "License"). You may not use the content of this file
6 // except in compliance with the License. Please obtain a copy of the License
7 // at http://www.opencascade.org and read it completely before using this file.
9 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 // The Original Code and all software distributed under the License is
13 // distributed on an "AS IS" basis, without warranty of any kind, and the
14 // Initial Developer hereby disclaims all such warranties, including without
15 // limitation, any warranties of merchantability, fitness for a particular
16 // purpose or non-infringement. Please see the License for the specific terms
17 // and conditions governing the rights and limitations under the License.
19 #include <OpenGl_PointSprite.hxx>
21 #include <Graphic3d_TextureParams.hxx>
22 #include <OpenGl_Context.hxx>
23 #include <Standard_Assert.hxx>
24 #include <Image_PixMap.hxx>
26 IMPLEMENT_STANDARD_HANDLE (OpenGl_PointSprite, OpenGl_Texture)
27 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_PointSprite, OpenGl_Texture)
29 // =======================================================================
30 // function : OpenGl_PointSprite
32 // =======================================================================
33 OpenGl_PointSprite::OpenGl_PointSprite()
34 : OpenGl_Texture (NULL),
37 //myParams->SetFilter (Graphic3d_TOTF_NEAREST);
38 myParams->SetGenMode (Graphic3d_TOTM_SPRITE,
39 Graphic3d_Vec4 (0.0f, 0.0f, 0.0f, 0.0f),
40 Graphic3d_Vec4 (0.0f, 0.0f, 0.0f, 0.0f));
43 // =======================================================================
44 // function : ~OpenGl_PointSprite
46 // =======================================================================
47 OpenGl_PointSprite::~OpenGl_PointSprite()
52 // =======================================================================
55 // =======================================================================
56 void OpenGl_PointSprite::Release (const OpenGl_Context* theGlCtx)
58 if (myBitmapList != 0)
60 if (theGlCtx->IsValid())
62 glDeleteLists (myBitmapList, 1);
67 OpenGl_Texture::Release (theGlCtx);
70 // =======================================================================
71 // function : SetDisplayList
73 // =======================================================================
74 void OpenGl_PointSprite::SetDisplayList (const Handle(OpenGl_Context)& theCtx,
75 const GLuint theBitmapList)
77 Release (theCtx.operator->());
78 myBitmapList = theBitmapList;
82 // =======================================================================
83 // function : DrawBitmap
85 // =======================================================================
86 void OpenGl_PointSprite::DrawBitmap (const Handle(OpenGl_Context)& ) const
88 if (myBitmapList != 0)
90 glCallList (myBitmapList);