示例#1
0
Image::Image(image_ptr this_) :
    ObjectWrap(),
    this_(this_),
    estimated_size_(this_->width() * this_->height() * 4)
    {
        V8::AdjustAmountOfExternalAllocatedMemory(estimated_size_);
    }
示例#2
0
 //! @brief テクスチャバッファを生成し、
 //!        バッファへ画像をバインドする
 void bind_image(image_ptr img){
     uint_t id;
     glGenTextures(1, &id);
     glBindTexture(GL_TEXTURE_2D, id);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     glTexImage2D(GL_TEXTURE_2D, 0, img->internal_format(), img->width(), img->height(), 0,
                  img->pixel_format(), GL_UNSIGNED_BYTE, img->data_front());
     glBindTexture(GL_TEXTURE_2D, 0);
     info.reset(new texture_info(id, img));
 }