0024345: TKOpenGl - GLSL compatibility issues on NV40 (GeForce 6xxx/7xxx)
[occt.git] / src / OpenGl / OpenGl_PointSprite.cxx
CommitLineData
a577aaab 1// Created by: Kirill GAVRILOV
2// Copyright (c) 2013 OPEN CASCADE SAS
3//
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.
8//
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.
11//
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.
18
19#include <OpenGl_PointSprite.hxx>
20
21#include <Graphic3d_TextureParams.hxx>
22#include <OpenGl_Context.hxx>
23#include <Standard_Assert.hxx>
24#include <Image_PixMap.hxx>
25
26IMPLEMENT_STANDARD_HANDLE (OpenGl_PointSprite, OpenGl_Texture)
27IMPLEMENT_STANDARD_RTTIEXT(OpenGl_PointSprite, OpenGl_Texture)
28
29// =======================================================================
30// function : OpenGl_PointSprite
31// purpose :
32// =======================================================================
33OpenGl_PointSprite::OpenGl_PointSprite()
34: OpenGl_Texture (NULL),
35 myBitmapList (0)
36{
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));
41}
42
43// =======================================================================
44// function : ~OpenGl_PointSprite
45// purpose :
46// =======================================================================
47OpenGl_PointSprite::~OpenGl_PointSprite()
48{
49 Release (NULL);
50}
51
52// =======================================================================
53// function : Release
54// purpose :
55// =======================================================================
56void OpenGl_PointSprite::Release (const OpenGl_Context* theGlCtx)
57{
58 if (myBitmapList != 0)
59 {
fd4a6963 60 if (theGlCtx->IsValid())
61 {
62 glDeleteLists (myBitmapList, 1);
63 }
a577aaab 64 myBitmapList = 0;
65 }
66
67 OpenGl_Texture::Release (theGlCtx);
68}
69
70// =======================================================================
71// function : SetDisplayList
72// purpose :
73// =======================================================================
74void OpenGl_PointSprite::SetDisplayList (const Handle(OpenGl_Context)& theCtx,
75 const GLuint theBitmapList)
76{
77 Release (theCtx.operator->());
78 myBitmapList = theBitmapList;
79}
80
81
82// =======================================================================
83// function : DrawBitmap
84// purpose :
85// =======================================================================
86void OpenGl_PointSprite::DrawBitmap (const Handle(OpenGl_Context)& ) const
87{
88 if (myBitmapList != 0)
89 {
90 glCallList (myBitmapList);
91 }
92}