Sha256: 04e0f95e810be92ba75aac5638f6c9672a05771dc973f8e08fb71b6bf2935e31

Contents?: true

Size: 1.19 KB

Versions: 21

Compression:

Stored size: 1.19 KB

Contents

#include <pixlib/texture.hpp>

namespace Pixlib {
  Texture::Texture(const Texture& copy) : width(copy.width), height(copy.height), id(copy.id), isCopy(true)
  { }

  Texture::Texture(int width, int height) : width(width), height(height), isCopy(false)
  {
    // The texture we're going to render to
    glGenTextures(1, &id);
    glBindTexture(GL_TEXTURE_2D, id);
    glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, width, height, 0,GL_RGB, GL_UNSIGNED_BYTE, 0);
  }


  Texture::~Texture()
  {
  	if(isCopy)
  		return;
  	glDeleteTextures(1, &id);
  }



  Texture3d::Texture3d(const Texture3d& copy) :
   width(copy.width),
   height(copy.height),
   depth(copy.depth),
   id(copy.id),
   isCopy(true)
  { }

  Texture3d::Texture3d(int width, int height, int depth) :
   width(width),
   height(height),
   depth(depth),
   isCopy(false)
  {
    // The texture we're going to render to
    glGenTextures(1, &id);
    glBindTexture(GL_TEXTURE_3D, id);
    glTexImage3D(GL_TEXTURE_3D,
      0,
      GL_DEPTH_COMPONENT,

     width,
     height,
     depth,
    0,
    GL_DEPTH_COMPONENT,
    GL_UNSIGNED_SHORT,
    nullptr);
  }


  Texture3d::~Texture3d()
  {
  	if(isCopy)
  		return;
  	glDeleteTextures(1, &id);
  }
}

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
pixo-0.4.5 ext/pixo/pixlib/src/texture.cpp
pixo-0.4.4 ext/pixo/pixlib/src/texture.cpp
pixo-0.4.3 ext/pixo/pixlib/src/texture.cpp
pixo-0.4.2 ext/pixo/pixlib/src/texture.cpp
pixo-0.4.1 ext/pixo/pixlib/src/texture.cpp
pixo-0.4.0 ext/pixo/pixlib/src/texture.cpp
pixo-0.3.2 ext/pixo/pixlib/src/texture.cpp
pixo-0.3.1 ext/pixo/pixlib/src/texture.cpp
pixo-0.3.0 ext/pixo/pixlib/src/texture.cpp
pixo-0.2.6 ext/pixo/pixlib/src/texture.cpp
pixo-0.2.5 ext/pixo/pixlib/src/texture.cpp
pixo-0.2.4 ext/pixo/pixlib/src/texture.cpp
pixo-0.2.3 ext/pixo/pixlib/src/texture.cpp
pixo-0.2.2 ext/pixo/pixlib/src/texture.cpp
pixo-0.2.1 ext/pixo/pixlib/src/texture.cpp
pixo-0.2.0 ext/pixo/pixlib/src/texture.cpp
pixo-0.1.4 ext/pixo/pixlib/src/texture.cpp
pixo-0.1.3 ext/pixo/pixlib/src/texture.cpp
pixo-0.1.2 ext/pixo/pixlib/src/texture.cpp
pixo-0.1.1 ext/pixo/pixlib/src/texture.cpp