本文整理汇总了C++中buffer::Parameters::set方法的典型用法代码示例。如果您正苦于以下问题:C++ Parameters::set方法的具体用法?C++ Parameters::set怎么用?C++ Parameters::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类buffer::Parameters
的用法示例。
在下文中一共展示了Parameters::set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exception
void Texture2D::init(int w, int h, TextureInternalFormat tf, TextureFormat f, PixelType t,
const Parameters ¶ms, const Buffer::Parameters &s, const Buffer &pixels)
{
Texture::init(tf, params);
this->w = w;
this->h = h;
pixels.bind(GL_PIXEL_UNPACK_BUFFER);
if (isCompressed() && s.compressedSize() > 0) {
glCompressedTexImage2D(textureTarget, 0, getTextureInternalFormat(internalFormat), w, h, 0, s.compressedSize(), pixels.data(0));
} else {
s.set();
glTexImage2D(textureTarget, 0, getTextureInternalFormat(internalFormat), w, h, 0, getTextureFormat(f), getPixelType(t), pixels.data(0));
s.unset();
}
pixels.unbind(GL_PIXEL_UNPACK_BUFFER);
generateMipMap();
if (FrameBuffer::getError() != 0) {
throw exception();
}
}
示例2: bindToTextureUnit
void Texture2DArray::setSubImage(int level, int x, int y, int l, int w, int h, int d, TextureFormat f, PixelType t, const Buffer::Parameters &s, const Buffer &pixels)
{
bindToTextureUnit();
pixels.bind(GL_PIXEL_UNPACK_BUFFER);
s.set();
glTexSubImage3D(GL_TEXTURE_2D_ARRAY, level, x, y, l, w, h, d, getTextureFormat(f), getPixelType(t), pixels.data(0));
s.unset();
pixels.unbind(GL_PIXEL_UNPACK_BUFFER);
assert(FrameBuffer::getError() == GL_NO_ERROR);
}
示例3: setSubImage
void TextureCube::setSubImage(CubeFace cf, int level, int x, int y, int w, int h, TextureFormat f, PixelType t, const Buffer::Parameters &s, const Buffer &pixels)
{
bindToTextureUnit();
pixels.bind(GL_PIXEL_UNPACK_BUFFER);
s.set();
glTexSubImage2D(getCubeFace(cf), level, x, y, w, h, getTextureFormat(f), getPixelType(t), pixels.data(0));
s.unset();
pixels.unbind(GL_PIXEL_UNPACK_BUFFER);
assert(FrameBuffer::getError() == GL_NO_ERROR);
}
示例4: init
void TextureRectangle::init(int w, int h, TextureInternalFormat tf, TextureFormat f, PixelType t,
const Parameters ¶ms, const Buffer::Parameters &s, const Buffer &pixels)
{
Texture::init(tf, params);
this->w = w;
this->h = h;
pixels.bind(GL_PIXEL_UNPACK_BUFFER);
bool needToGenerateMipmaps = true;
if (isCompressed() && s.compressedSize() > 0) {
glCompressedTexImage2D(textureTarget, 0, getTextureInternalFormat(internalFormat), w, h, 0, s.compressedSize(), pixels.data(0));
} else {
s.set();
glTexImage2D(textureTarget, 0, getTextureInternalFormat(internalFormat), w, h, 0, getTextureFormat(f), getPixelType(t), pixels.data(0));
s.unset();
GLsizei size = s.compressedSize(); // should work because size is retrieved from file descriptor.
int pixelSize = getFormatSize(f, t);
if (size > w * h * pixelSize) {
// get the other levels from the same buffer
int offset = w * h * pixelSize;
int level = 0;
int wl = w;
int hl = h;
while (wl % 2 == 0 && hl % 2 == 0 && size - offset >= (wl * hl / 4) * pixelSize) {
level += 1;
wl = wl / 2;
hl = hl / 2;
glTexImage2D(textureTarget, level, getTextureInternalFormat(internalFormat), wl, hl, 0, getTextureFormat(f), getPixelType(t), pixels.data(offset));
offset += wl * hl * pixelSize;
needToGenerateMipmaps = false;
}
this->params.lodMax(clamp(params.lodMax(), GLfloat(0.0f), GLfloat(level)));
}
}
pixels.unbind(GL_PIXEL_UNPACK_BUFFER);
if (needToGenerateMipmaps) {
generateMipMap();
}
if (FrameBuffer::getError() != 0) {
throw exception();
}
}