GteGL4Texture1.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  :
21 {
22  // Create a texture structure.
25 
26  // Allocate (immutable) texture storage for all levels.
27  auto const length = texture->GetDimension(0);
29 
30  Initialize();
31 
32  // Cannot leave this texture bound.
34 
35  // Create a staging texture if requested.
36  CreateStaging();
37 }
38 
39 std::shared_ptr<GEObject> GL4Texture1::Create(void*, GraphicsObject const* object)
40 {
41  if (object->GetType() == GT_TEXTURE1)
42  {
43  return std::make_shared<GL4Texture1>(
44  static_cast<Texture1 const*>(object));
45  }
46 
47  LogError("Invalid object type.");
48  return nullptr;
49 }
50 
52 {
53  auto texture = GetTexture();
54 
55  return texture && texture->HasMipmaps() && texture->WantAutogenerateMipmaps();
56 }
57 
58 void GL4Texture1::LoadTextureLevel(unsigned int level, void const* data)
59 {
60  auto texture = GetTexture();
61  if (texture && level < texture->GetNumLevels())
62  {
63  auto length = texture->GetDimensionFor(level, 0);
64 
67  }
68 }
virtual bool CanAutoGenerateMipmaps() const override
virtual ~GL4Texture1()
virtual void LoadTextureLevel(unsigned int level, void const *data) override
GLuint mExternalType
Definition: GteGL4Texture.h:39
GLint level
Definition: glcorearb.h:103
GraphicsObjectType GetType() const
void APIENTRY glDeleteTextures(GLsizei n, const GLuint *textures)
Definition: GteOpenGL.cpp:980
Texture1 * GetTexture() const
#define GL_TEXTURE_1D
Definition: glcorearb.h:303
void APIENTRY glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels)
Definition: GteOpenGL.cpp:941
void APIENTRY glBindTexture(GLenum target, GLuint texture)
Definition: GteOpenGL.cpp:967
GL4Texture1(Texture1 const *texture)
GLuint mInternalFormat
Definition: GteGL4Texture.h:37
#define LogError(message)
Definition: GteLogger.h:92
GLboolean * data
Definition: glcorearb.h:126
GLuint texture
Definition: glcorearb.h:410
void APIENTRY glGenTextures(GLsizei n, GLuint *textures)
Definition: GteOpenGL.cpp:993
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:790
unsigned int GetDimension(int i) const
Definition: GteTexture.h:110
void APIENTRY glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width)
Definition: GteOpenGL.cpp:7613
static std::shared_ptr< GEObject > Create(void *unused, GraphicsObject const *object)
GLuint mExternalFormat
Definition: GteGL4Texture.h:38
GLuint object
Definition: glext.h:6426
#define GL_TEXTURE_BINDING_1D
Definition: glcorearb.h:310
GT_TEXTURE1


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