本文整理汇总了C++中ofTexture::setTextureMinMagFilter方法的典型用法代码示例。如果您正苦于以下问题:C++ ofTexture::setTextureMinMagFilter方法的具体用法?C++ ofTexture::setTextureMinMagFilter怎么用?C++ ofTexture::setTextureMinMagFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofTexture
的用法示例。
在下文中一共展示了ofTexture::setTextureMinMagFilter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadTexture
bool loadTexture(ofTexture & tex, const std::string & path, bool mipmap, float bias, int anisotropy){
bool ok = ofLoadImage(tex, path);
if (ok){
tex.generateMipmap();
tex.enableMipmap();
tex.setTextureMinMagFilter(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
tex.bind();
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_LOD_BIAS, bias);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy); //TODO check for hw support!
tex.unbind();
ofLogError("ofxApp") << "Failed to load texture at \"" << path << "\"";
}else{
ofLogError("ofxApp") << "Failed to load texture at \"" << path << "\"";
}
return ok;
}
示例2: prepareBitmapTexture
//---------------------------------------------------------------------
static void prepareBitmapTexture(){
if (!bBitmapTexturePrepared){
myLetterPixels.allocate(16*16, 16*16, 4); // letter size:8x14pixels, texture size:16x8letters, gl_rgba: 4bytes/1pixel
myLetterPixels.set(0);
bitmappedFontTexture.allocate(16*16, 16*16, GL_RGBA, false);
bBitmapTexturePrepared = true;
for (int i = 0; i < 256; i++) {
const unsigned char * face = bmpChar_8x13_Map[i];
for (int j = 1; j < 15; j++){
for (int k = 0; k < 8; k++){
if ( ((face[15-j] << k) & (128)) > 0 ){
myLetterPixels[(((int)(i/16))*16*16*16+(i%16)*16 + (j-1)*16*16 + k)*4] = 255;
myLetterPixels[(((int)(i/16))*16*16*16+(i%16)*16 + (j-1)*16*16 + k)*4+1] = 255;
myLetterPixels[(((int)(i/16))*16*16*16+(i%16)*16 + (j-1)*16*16 + k)*4+2] = 255;
myLetterPixels[(((int)(i/16))*16*16*16+(i%16)*16 + (j-1)*16*16 + k)*4+3] = 255;
}else{
myLetterPixels[(((int)(i/16))*16*16*16+(i%16)*16 + (j-1)*16*16 + k)*4] = 0;
myLetterPixels[(((int)(i/16))*16*16*16+(i%16)*16 + (j-1)*16*16 + k)*4+1] = 0;
myLetterPixels[(((int)(i/16))*16*16*16+(i%16)*16 + (j-1)*16*16 + k)*4+2] = 0;
myLetterPixels[(((int)(i/16))*16*16*16+(i%16)*16 + (j-1)*16*16 + k)*4+3] = 0;
}
}
}
}
bitmappedFontTexture.loadData(myLetterPixels);
bitmappedFontTexture.setTextureMinMagFilter(GL_LINEAR,GL_NEAREST);
charMesh.setMode(OF_PRIMITIVE_TRIANGLES);
}
}
示例3: setup
//--------------------------------------------------------------
void testApp::setup(){
// ofSetFrameRate(60);
ofBackground(0, 0, 0);
glDisable(GL_DEPTH_TEST);
float w = 720; //ofGetWidth();
float h = 720; //ofGetHeight();
// renderFbo.allocate(ofGetWidth() * 0.75, ofGetHeight() * 0.75, GL_RGBA32F);
renderFbo.allocate(w, h, GL_RGBA32F);
renderFbo.getTextureReference().setTextureMinMagFilter(GL_NEAREST, GL_NEAREST);
// renderFbo.getTextureReference().setTextureWrap(GL_CLAMP_TO_BORDER, GL_CLAMP_TO_BORDER);
parts_res = (int)sqrt((float)numParticles);
numParticles = parts_res * parts_res;
float * parts_buf = new float[numParticles * 4];
for (int x = 0; x < parts_res; x++) {
for (int y = 0; y < parts_res; y++) {
int i = x * parts_res + y;
parts_buf[i * 4 + 0] = ofRandom(0.0, w-1);
parts_buf[i * 4 + 1] = ofRandom(0.0, h-1);
parts_buf[i * 4 + 2] = ofRandom(0.0, part_life);
parts_buf[i * 4 + 3] = 0.0;
/* pos is now an index into the postion map fbo */
pos[i][0] = x;
pos[i][1] = y;
pos[i][2] = 0;
}
}
parts_vbo.setVertexData((ofVec3f *)&pos[0], numParticles, GL_STATIC_DRAW);
randtex.allocate(parts_res, parts_res, GL_RGBA32F);
randtex.setTextureMinMagFilter(GL_NEAREST, GL_NEAREST);
randtex.loadData(parts_buf, parts_res, parts_res, GL_RGBA);
partsFbo.allocate(parts_res, parts_res, GL_RGBA32F);
partsFbo.src->getTextureReference().setTextureMinMagFilter(GL_NEAREST, GL_NEAREST);
partsFbo.dst->getTextureReference().setTextureMinMagFilter(GL_NEAREST, GL_NEAREST);
partsFbo.src->getTextureReference().loadData(parts_buf, parts_res, parts_res, GL_RGBA);
partsFbo.dst->getTextureReference().loadData(parts_buf, parts_res, parts_res, GL_RGBA);
// partsFbo.src->getTextureReference().setTextureWrap(GL_CLAMP_TO_BORDER, GL_CLAMP_TO_BORDER);
// partsFbo.dst->getTextureReference().setTextureWrap(GL_CLAMP_TO_BORDER, GL_CLAMP_TO_BORDER);
delete[] parts_buf;
colorFbo.allocate(parts_res, parts_res, GL_RGBA32F);
colorFbo.src->getTextureReference().setTextureMinMagFilter(GL_NEAREST, GL_NEAREST);
colorFbo.dst->getTextureReference().setTextureMinMagFilter(GL_NEAREST, GL_NEAREST);
// colorFbo.src->getTextureReference().setTextureWrap(GL_CLAMP_TO_BORDER, GL_CLAMP_TO_BORDER);
// colorFbo.dst->getTextureReference().setTextureWrap(GL_CLAMP_TO_BORDER, GL_CLAMP_TO_BORDER);
colorShader.load("", "color.frag");
velFbo.allocate(parts_res, parts_res, GL_RGBA32F);
velFbo.src->getTextureReference().setTextureMinMagFilter(GL_NEAREST, GL_NEAREST);
velFbo.dst->getTextureReference().setTextureMinMagFilter(GL_NEAREST, GL_NEAREST);
// velFbo.src->getTextureReference().setTextureWrap(GL_CLAMP_TO_BORDER, GL_CLAMP_TO_BORDER);
// velFbo.dst->getTextureReference().setTextureWrap(GL_CLAMP_TO_BORDER, GL_CLAMP_TO_BORDER);
velshader.load("", "velocity.frag");
partshader.load("particle.vert", "");
posshader.load("", "position.frag");
debugShader.load("", "debug.frag");
debugFbo.allocate(ofGetWidth(), ofGetHeight(), GL_RGBA32F);
w = h = renderFbo.getHeight();//720;//ofGetHeight();
dja.setup(w, h, 200);
dja.logmaxd = 5.0;
dja.setZoom(zoom);
dja.setParam(0.5 * PI, 0.5 * PI, -0.5 * PI, -0.5 * PI);
dja.update();
randmap_rebuild(-1.0, 1.0);
needDraw = true;
blur = new ofxBlur();
// blur->setup(ofGetWidth(), ofGetHeight());
blur->setup(renderFbo.getWidth(), renderFbo.getHeight());
blur->setScale(blur_scale);
// printf("setup: blur dim %.0f %.0f\n", blur.getTextureReference().getWidth(), blur.getTextureReference().getHeight());
cf.setup(renderFbo.getWidth(), renderFbo.getHeight());
cf.setScale(0.5);
cf.build(dja.getTextureReference());
// cf.setScale(curl_scale);
//at some stage set inital vels cause atm it looks not so good when it starts
velFbo.src->begin();
ofClear(ofFloatColor(0.0, 0.0, -1.0, 1.0));
velFbo.src->end();
width_offset = (int)((renderFbo.getWidth() - dja.getWidth()) / 2.0);
//.........这里部分代码省略.........