GteGL4SamplerState.cpp
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #include <GTEnginePCH.h>
9 #include <LowLevel/GteLogger.h>
11 using namespace gte;
12 
14 {
16 }
17 
19  :
20  GL4DrawingState(samplerState)
21 {
23 
27 
28  // TODO - GL_TEXTURE_MAX_ANISOTROPY_EXT is not defined?
29  // glSamplerParameterf(samplerState, GL_TEXTURE_MAX_ANISOTROPY_EXT, samplerState->maxAnisotropy);
30 
34 
35  float borderColor[4];
36  borderColor[0] = samplerState->borderColor[0];
37  borderColor[1] = samplerState->borderColor[1];
38  borderColor[2] = samplerState->borderColor[2];
39  borderColor[3] = samplerState->borderColor[3];
41 
42  switch(samplerState->filter)
43  {
47  break;
51  break;
55  break;
59  break;
63  break;
67  break;
71  break;
75  break;
76  default:
77  LogWarning("GL4 does not support samplerState filter = " + samplerState->filter);
80  break;
81  }
82 }
83 
84 std::shared_ptr<GEObject> GL4SamplerState::Create(void*, GraphicsObject const* object)
85 {
86  if (object->GetType() == GT_SAMPLER_STATE)
87  {
88  return std::make_shared<GL4SamplerState>(
89  static_cast<SamplerState const*>(object));
90  }
91 
92  LogError("Invalid object type.");
93  return nullptr;
94 }
95 
96 
98 {
99  GL_REPEAT, // WRAP
100  GL_MIRRORED_REPEAT, // MIRROR
101  GL_CLAMP_TO_EDGE, // CLAMP
102  GL_CLAMP_TO_BORDER, // BORDER
103  GL_MIRRORED_REPEAT // MIRROR_ONCE
104 };
#define GL_TEXTURE_WRAP_T
Definition: glcorearb.h:381
#define GL_CLAMP_TO_BORDER
Definition: glcorearb.h:542
#define GL_NEAREST
Definition: glcorearb.h:372
int GLint
Definition: glcorearb.h:85
#define GL_MIRRORED_REPEAT
Definition: glcorearb.h:575
MIN_L_MAG_P_MIP_L
#define GL_CLAMP_TO_EDGE
Definition: glcorearb.h:460
void APIENTRY glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
Definition: GteOpenGL.cpp:5141
static GLint const msMode[]
#define GL_TEXTURE_MAG_FILTER
Definition: glcorearb.h:378
void APIENTRY glGenSamplers(GLsizei count, GLuint *samplers)
Definition: GteOpenGL.cpp:5086
#define GL_LINEAR_MIPMAP_NEAREST
Definition: glcorearb.h:375
void APIENTRY glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
Definition: GteOpenGL.cpp:5167
#define GL_TEXTURE_WRAP_R
Definition: glcorearb.h:447
GT_SAMPLER_STATE
GraphicsObjectType GetType() const
GL4SamplerState(SamplerState const *samplerState)
#define GL_REPEAT
Definition: glcorearb.h:384
#define GL_NEAREST_MIPMAP_LINEAR
Definition: glcorearb.h:376
MIN_P_MAG_L_MIP_L
#define GL_NEAREST_MIPMAP_NEAREST
Definition: glcorearb.h:374
MIN_P_MAG_P_MIP_P
#define LogError(message)
Definition: GteLogger.h:92
Vector4< float > borderColor
void APIENTRY glDeleteSamplers(GLsizei count, const GLuint *samplers)
Definition: GteOpenGL.cpp:5099
void APIENTRY glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
Definition: GteOpenGL.cpp:5180
#define GL_TEXTURE_MIN_LOD
Definition: glcorearb.h:461
#define GL_TEXTURE_MIN_FILTER
Definition: glcorearb.h:379
#define LogWarning(message)
Definition: GteLogger.h:95
static std::shared_ptr< GEObject > Create(void *unused, GraphicsObject const *object)
MIN_P_MAG_L_MIP_P
MIN_P_MAG_P_MIP_L
#define GL_TEXTURE_WRAP_S
Definition: glcorearb.h:380
#define GL_LINEAR
Definition: glcorearb.h:373
#define GL_TEXTURE_BORDER_COLOR
Definition: glcorearb.h:315
#define GL_TEXTURE_MAX_LOD
Definition: glcorearb.h:462
MIN_L_MAG_P_MIP_P
#define GL_LINEAR_MIPMAP_LINEAR
Definition: glcorearb.h:377
MIN_L_MAG_L_MIP_P
GLuint object
Definition: glext.h:6426
#define GL_TEXTURE_LOD_BIAS
Definition: glcorearb.h:577
MIN_L_MAG_L_MIP_L


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:00