本文整理汇总了C++中ofFbo::allocate方法的典型用法代码示例。如果您正苦于以下问题:C++ ofFbo::allocate方法的具体用法?C++ ofFbo::allocate怎么用?C++ ofFbo::allocate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofFbo
的用法示例。
在下文中一共展示了ofFbo::allocate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void setup(){
ofSetVerticalSync(false);
w=ofGetScreenWidth();
h=ofGetScreenHeight();
ofDisableArbTex();
img.load("1.jpg");
player.load("1.mp4");
player.play();
player.setLoopState(OF_LOOP_NORMAL);
gray = img;
gray.setImageType(OF_IMAGE_GRAYSCALE);
wc.load("wcolor.vert","wcolor.frag");
ofFbo::Settings s;
s.depthStencilAsTexture=true;
s.useDepth=true;
s.width=w;
s.height=h;
fboDepth.allocate(s);
fbo.allocate(w,h);
fbo.begin();
ofClear(0,0,100,255);
fbo.end();
gui.setup();
gui.add(stepGradient.set("step gradient", .0015, -1., 1.));
gui.add(advectStep.set("step advect", .0015, -.1, .1));
gui.add(flipHeightMap.set("flip height map", 0.7, 0., 2.));
gui.add(time.set("time", 0., 0., 1.));
gui.add(advectMatrix.set("advect matrix", ofVec4f(0.1), ofVec4f(-1.), ofVec4f(1.)));
gui.add(switchVideo.set("switch video", false));
}
示例2: setup
//--------------------------------------------------------------
void ofApp::setup() {
ofSetFrameRate(60);
BPStar::starImg.loadImage("particle32.png");
ofSetWindowPosition(2000, 0);
ofSetFullscreen(true);
sky.setupFromXml("mySettings.xml");
BPConstellation c;
c.loadFromXml();
constellations.push_back(c);
for (auto it = c.getStars()->begin(); it != c.getStars()->end(); it++) {
for (auto it2 = sky.getStars()->begin(); it2 != sky.getStars()->end(); it2++) {
if (it->getId() == it2->getId()) {
it2->isConstellation = true;
}
}
}
mode = Edge;
fbo.allocate(ofGetWidth(), ofGetHeight());
s.setup();
s.stars = sky.getStars();
int w = ofGetWidth();
int h = ofGetHeight();
int x = 0;
int y = 0;
warper.setSourceRect(ofRectangle(0, 0, w, h)); // this is the source rectangle which is the size of the image and located at ( 0, 0 )
warper.setTopLeftCornerPosition(ofPoint(x, y)); // this is position of the quad warp corners, centering the image on the screen.
warper.setTopRightCornerPosition(ofPoint(x + w, y)); // this is position of the quad warp corners, centering the image on the screen.
warper.setBottomLeftCornerPosition(ofPoint(x, y + h)); // this is position of the quad warp corners, centering the image on the screen.
warper.setBottomRightCornerPosition(ofPoint(x + w, y + h)); // this is position of the quad warp corners, centering the image on the screen.
warper.setup();
}
示例3: setup
void setup(){
w=ofGetScreenWidth();
h=ofGetScreenHeight();
touch.init("/dev/input/event0",w,h);
ofLog()<<touch.getName();
fbo.allocate(w,h);
}
示例4: setup
void setup() {
ofSetDataPathRoot("../../../../../SharedData/");
ofSetVerticalSync(true);
// ofSetLogLevel(OF_LOG_VERBOSE);
#ifdef USE_VIDEO
video.loadMovie("videos/melica.mp4");
video.play();
#else
video.setup();
#ifdef USE_EDSDK
video.setDeviceType(EDSDK_MKII);
#endif
#endif
ofFbo::Settings settings;
settings.width = video.getWidth();
settings.height = video.getHeight();
settings.useDepth = false;
buffer.allocate(settings);
ofSetBackgroundAuto(false);
contours.getTracker().setPersistence(100);
contours.getTracker().setMaximumDistance(100);
setupGui();
osc.setup("klaus.local", 7400);
}
示例5: setup
//--------------------------------------------------------------
void testApp::setup(){
light.setDirectional();
ofEnableArbTex();
fbo.allocate(ofGetWidth()*2, ofGetHeight()*2);
fxaa.load("v002.FXAA.vert","v002.FXAA.frag");
ofSetFrameRate(30);
}
示例6: setupedFbo
void setupedFbo()
{
if (!mFbo.isAllocated()) {
mFbo.allocate(getWidth(), getHeight(), GL_RGBA);
mGlitch.setup(&mFbo);
mGlitch.setFx(OFXPOSTGLITCH_TWIST, true);
}
}
示例7: init
void Buffer::init(ofFbo &b, const ofColor &bg) {
b.allocate();
b.begin();
ofFill();
ofSetColor(bg);
ofRect(0, 0, b.getWidth(), b.getHeight());
b.end();
}
示例8: setup
//--------------------------------------------------------------
void testApp::setup()
{
// ofSetFrameRate(60);
// ofSetVerticalSync(true);
ofBackground(0);
fbo.allocate(1920, 1080, GL_RGB);
}
示例9: setup
//--------------------------------------------------------------
void testApp::setup(){
font.loadFont("Arial.ttf", 300, true, true, true);
ofSetFrameRate(60);
ofSetVerticalSync(true);
fbo.allocate(ofGetWidth(), ofGetHeight());
fbo.begin();ofClear(0, 0, 0);fbo.end();
cnt = 0;
maxDraw = 5;
randomVal = 0;
}
示例10: setup
void setup()
{
ofSetLogLevel(OF_LOG_VERBOSE);
testImage.loadImage("of.png");
fbo.allocate(ofGetWidth(), ofGetHeight());
fbo.begin();
ofClear(0, 0, 0, 0);
fbo.end();
}
示例11: setup
void setup() {
ofBackground(255);
trail.allocate(ofGetWidth(), ofGetHeight(), GL_RGBA, 4);
trail.begin();
ofClear(255, 0);
trail.end();
derivatives.resize(3); // vel, acc, jer
magnitudes.resize(3, 0);
limits.resize(3, 0);
limits[0] = pow(100, 1./1.);
limits[1] = pow(1, 1./2.);
limits[2] = pow(10, 1./3.);
}
示例12: setup
void setup() {
ofSetFrameRate(60);
ofSetVerticalSync(false);
ledRing.setup();
fbo.allocate(512, 512);
fbo.begin();
ofClear(0);
fbo.end();
ofSetCircleResolution(64);
ofSetLineWidth(2);
ofLog() << "MIDI Ports: " << ofToString(midi.getPortList());
midi.openPort();
Pulse::midiWrapper = &midiWrapper;
pulses.push_back(Pulse(0, 0));
}
示例13: setup
void setup() {
ofSetFrameRate(60);
ofSetVerticalSync(true);
dw=ofGetScreenWidth();
dh=ofGetScreenHeight();
ofDisableArbTex();
fbo.allocate(dw,dh);
shader.load("shaders/fluid.vert","shaders/fluid.frag");
camera.setFarClip(100000);
camera.setNearClip(.1);
if ( !allocate_data () ){
cout<<"error allocate!"<<endl;
exit();
}
clear_data ();
gui.setup();
gui.setPosition(ofPoint(10,10));
gui.add(size_cube.setup("size box", 100.0f,0.0f,255.0f));
gui.add(dvel.setup("draw velocity", true));
gui.add(dden.setup("draw density", false));
gui.add(TaddSource.setup("add source",false));
gui.add(Bclear.setup("clear source",false));
gui.add(addX.setup("add x",false));
gui.add(addY.setup("add y",false));
gui.add(addZ.setup("add z",false));
gui.add(dt.setup("time delta", 0.9f,0.0f,25.0f));
gui.add(diff.setup("diffuse", 0.0f,0.0f,25.0f));
gui.add(visc.setup("viscosity", 0.0f,0.0f,25.0f));
gui.add(force.setup("add force",30.0f,0.0f,60.0f));
gui.add(source.setup("density", 200.0f,0.0f,600.0f));
gui.add(source_alpha.setup("alpha",0.05,0.0,1.0));
gui.add(drawAbstacle.setup("draw abstacle",false));
gui.add(drawAxis.setup("draw Axis",true));
gui.add(sourcePosX.setup("source posX", 0,-10,SIZE));
gui.add(sourcePosY.setup("source posY", 0,-10,SIZE));
gui.add(sourcePosZ.setup("source posZ", 0,-10,SIZE));
}
示例14: setupSpeakers
void setupSpeakers() {
ofVec3f speakers[n_speakers];
// maybe need to swap dimensions here?
// possibly change scale too
float eps = 0.001; // needed to avoid "== 0" check in shader
speakers[0] = ofVec3f(0,0,0)+eps; // front left
speakers[1] = ofVec3f(0,1,0)+eps; // front right
speakers[2] = ofVec3f(1,1,0)+eps; // rear right
speakers[3] = ofVec3f(1,0,0)+eps; // rear left
float speakerAreaSize = 0.02;
speakerXyzMap.allocate(n_samples, n_speakers, OF_IMAGE_COLOR_ALPHA);
speakerConfidenceMap.allocate(n_samples, n_speakers, OF_IMAGE_COLOR_ALPHA);
float* xyzPixels = speakerXyzMap.getPixels().getData();
float* confidencePixels = speakerConfidenceMap.getPixels().getData();
for(int i = 0; i < n_speakers; i++){
for(int j = 0; j < n_samples; j++){
// sample a spiral
float angle = j * TWO_PI / 20; // 20 samples per full rotation
float radius = ((float) j / n_samples) * speakerAreaSize; // 0 to speakerAreaSize
// might need to swap axes here too
xyzPixels[0] = speakers[i].x + sin(angle) * radius;
xyzPixels[1] = speakers[i].y + cos(angle) * radius;
xyzPixels[2] = speakers[i].z;
xyzPixels[3] = 1;
xyzPixels += 4;
confidencePixels[0] = 1;
confidencePixels[1] = 1;
confidencePixels[2] = 1;
confidencePixels[3] = 1;
confidencePixels += 4;
}
}
speakerXyzMap.update();
speakerConfidenceMap.update();
speakerFbo.allocate(n_samples, n_speakers);
speakerPixels.allocate(n_samples, n_speakers, OF_IMAGE_COLOR_ALPHA);
}
示例15: setup
//--------------------------------------------------------------
void ofApp::setup(){
ofSetFrameRate(60);
//Определяем графический буфер
int w = ofGetWidth();
int h = ofGetHeight();
fbo.allocate(w,h,GL_RGB32F_ARB);
//Заполняем буфер белым цветом
fbo.begin();
ofBackground(255,255,255);
fbo.end();
//Настраиваем параметры
param.setup();
history = 0.9;
time0 = ofGetElapsedTimef();
bornRate = 2500;
bornCount = 0;
}