本文整理汇总了C++中ofImage::loadImage方法的典型用法代码示例。如果您正苦于以下问题:C++ ofImage::loadImage方法的具体用法?C++ ofImage::loadImage怎么用?C++ ofImage::loadImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofImage
的用法示例。
在下文中一共展示了ofImage::loadImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
//--------------------------------------------------------------
void testApp::setup() {
screen.loadImage("bg.png");
death.loadImage("death.png");
ofSetVerticalSync(true);
ofSetLogLevel(OF_LOG_NOTICE);
ofBackground(0);
ofSetColor(255);
//SVG
svg.load("lay.svg");
for (int i = 0; i < svg.getNumPath(); i++){
ofPath p = svg.getPathAt(i);
p.setPolyWindingMode(OF_POLY_WINDING_ODD);
vector<ofPolyline>& lines = p.getOutline();
for(int j=0;j<(int)lines.size();j++){
outlines.push_back(lines[j].getResampledBySpacing(1));
}
}
shoot.loadSound("shoot.wav");
start.loadSound("boot.wav");
win.loadSound("startup.wav");
bMouseForce = false;
box2d.init();
box2d.enableEvents(); // <-- turn on the event listener
box2d.setGravity(0, 10);
box2d.createGround();
box2d.setFPS(30.0);
box2d.registerGrabbing();
ofAddListener(box2d.contactStartEvents, this, &testApp::contactStart);
ofAddListener(box2d.contactEndEvents, this, &testApp::contactEnd);
for (int i=0; i<N_SOUNDS; i++) {
sound[i].loadSound(ofToString(i)+".mp3");
sound[i].setMultiPlay(true);
sound[i].setLoop(false);
}
edgeLine.addVertex(ofGetWidth(), 0);
edgeLine.addVertex(0, 0);
edgeLine.addVertex(0, ofGetHeight()-30);
edgeLine.addVertex(ofGetWidth(), ofGetHeight()-30);
edgeLine.setPhysics(0.0, 0.5, 0.5);
edgeLine.create(box2d.getWorld());
}
示例2: setup
void setup() {
ofEnableDepthTest();
ofDisableArbTex();
img.loadImage("img1.jpg");
env.loadImage("env.jpg");
env1.loadImage("env1.jpg");
shader.load("material.vert","material.frag");
model.loadModel("wolf.dae", true);
}
示例3: setup
void setup(float x, float y, string path, string videoPath){
img.loadImage(path);
r.set(x,y,img.getWidth(),img.getHeight());
video = videoPath;
thumbPath = path;
loadPos();
}
示例4: setup
//--------------------------------------------------------------
void testApp::setup()
{
// setup pointsprite texture
// NOTES: the texture size must be Power of Two,
// and turn off arb texture option while loading
ofDisableArbTex();
sprite.loadImage("image.jpg");
ofEnableArbTex();
ofSetFrameRate(60);
ofSetVerticalSync(true);
ofBackground(0);
sys.setup();
group.setup(sys);
group.setColor(ofxSPK::RangeC(ofColor(255, 255), ofColor(255, 255)),
ofxSPK::RangeC(ofColor(0, 0), ofColor(255, 0)));
group.setLifeTime(0.5, 5);
group.setFriction(0.1);
group.setSize(0, ofxSPK::RangeF(30, 250));
group.setGravity(ofVec3f(0, -10, 0));
group.setMass(0.1, 1);
rot.setup(SPK::Vortex::create(SPK::Vector3D(ofGetWidth()/2, ofGetHeight()/2),
SPK::Vector3D(0, 1, 0),
200,
10), group);
group.reserve(10000);
}
示例5: setup
//--------------------------------------------------------------
void testApp::setup(){
img.loadImage("image.jpg");
w = img.width;
h = img.height;
imgPos.x = (ofGetWidth()-w)/2;
imgPos.y = (ofGetHeight()-h)/2;
}
示例6: setup
//--------------------------------------------------------------
void testApp::setup(){
quadmesh.create(150, 50, 400, 300, 8);
quadimage.loadImage("1.jpg");
quadtexture = genTex(quadimage.getWidth(), quadimage.getHeight(), quadimage.getPixels());
// if use GL_TEXTURE_RECTANGLE, change texture coord from [1,1] to [width, height]
//quadmesh.ResetTextureCoords(quadimage.getWidth(), quadimage.getHeight());
}
示例7: setup
void setup()
{
ofSetLogLevel(OF_LOG_VERBOSE);
testImage.loadImage("of.png");
fbo.allocate(ofGetWidth(), ofGetHeight());
fbo.begin();
ofClear(0, 0, 0, 0);
fbo.end();
}
示例8: setup
//--------------------------------------------------------------
void ofApp::setup(){
ofSetWindowShape(1024,1024);
ofSetBackgroundAuto(true);
//ofBackground(0,0,0); // background
ofBackground(128,128,128); // background
imageCrystal.loadImage("crystal.jpg"); //load initial image
point.set(10,10);
ofEnableBlendMode(OF_BLENDMODE_SUBTRACT);
}
示例9: setup
//--------------------------------------------------------------
void testApp::setup(){
ofEnableAlphaBlending();
//load image file
string path = ofToDataPath("logo.png");
of_image.loadImage( path );
ci_surface = ci::loadImage( path );
//convert images
ci_texture = ci::gl::Texture( ofxCi::toCi(of_image), GL_RGBA, of_image.getWidth(), of_image.getHeight() );
of_image.setFromPixels(ofxCi::toOf(ci_surface), ci_surface.getWidth(), ci_surface.getHeight(), OF_IMAGE_COLOR_ALPHA);
}
示例10: setup
//--------------------------------------------------------------
void testApp::setup(){
vidGrabber.setVerbose(true);
vidGrabber.initGrabber(640, 480);
colorImg.allocate(vidGrabber.getWidth(), vidGrabber.getHeight());
greyImage.allocate(vidGrabber.getWidth(), vidGrabber.getHeight());
greyImageSmall.allocate(120, 90);
haarFinder.setup("haarcascade_frontalface_alt2.xml");
img.loadImage("stevejobs.png");
img.setAnchorPercent(0.5, 0.5);
ofEnableAlphaBlending();
}
示例11: loadImage
void loadImage(string filePath)
{
vector<string>hierarchy = ofSplitString(filePath, "/");
if (hierarchy.size() > 1)
cur_file = hierarchy.back();
else
cur_file = filePath;
img1.loadImage(filePath);
img1.resize(w, h);
img1.setImageType(OF_IMAGE_GRAYSCALE);
synthImage();
}
示例12: setup
//--------------------------------------------------------------
void testApp::setup(){
site.loadImage("site.png");
site.setAnchorPercent(0.5, 0.5);
// zg.load("patches/mouth1.pd", 0, 2, 44100, 256);
ofSetVerticalSync(true);
ofSetFrameRate(60.f);
play = false;
WIDTH = 320;
HEIGHT = 240;
useLiveVideo = false;
int sourceWidth = 320;
int sourceHeight = 240;
vidGrabber.setVerbose(true);
sourceWidth = WIDTH;
sourceHeight = HEIGHT;
vidGrabber.initGrabber(WIDTH, HEIGHT);
/*
vidPlayer.loadMovie("mouth0.mov");
vidPlayer.play();
vidPlayer.setLoopState(OF_LOOP_NORMAL);
sourceWidth = vidPlayer.width;
sourceHeight = vidPlayer.height;
*/
colorImg.allocate(sourceWidth, sourceHeight);
bigGrayImage.allocate(sourceWidth, sourceHeight);
grayImage.allocate(WIDTH, HEIGHT);
grayBg.allocate(WIDTH, HEIGHT);
grayDiff.allocate(WIDTH, HEIGHT);
mouths.setup();
threshold = 80;
gui.addButton("rewind", rewind);
gui.addButton("pause", paused);
gui.addButton("play", play);
gui.addToggle("Use Camera", useLiveVideo);
gui.addContent("Source Image", colorImg);
gui.loadFromXML();
gui.setAutoSave(true);
ofSoundStreamSetup(2,0,this, 44100,256, 1);
}
示例13: setup
//--------------------------------------------------------------
void ofApp::setup(){
arraySounds = new ofSoundPlayer[numberOfSounds];
for(int i=0;i<numberOfSounds;++i){
arraySounds[i].loadSound("sounds/TheWhole"+ofToString(i+1)+".mp3");
arraySounds[i].setVolume(0.9f);
}
currentSoundIndex = 0;
ofSetWindowShape(1000, 1000);
image.loadImage("output_croped.png");
image.resize(700, 600);
zoomFactor = 2.0;
radius = 180;
imgPos.x = 100;
imgPos.y = 30;
}
示例14: setup
void gameOfLife::setup() {
fullScreen = false;
highlight = false;
active = false;
ofSetFullscreen(false);
ofSetWindowShape(WIDTH, HEIGHT);
init(WIDTH, HEIGHT, CELLSIZE);
ofBackground(ofColor::white);
ofSetBackgroundAuto(true);
ofSetWindowTitle("Conway's Game of Life");
ofSetFrameRate(FRAMERATE);
myImage.loadImage("circleAlpha.tif");
sender.setup(HOST, PORT);
}
示例15: setup
//--------------------------------------------------------------
void testApp::setup(){
ofBackground(0,0,0);
for(int i=0; i<MAX_PARTICLES; i++) {
pos[i][0] = ofRandom(-ofGetWidth(), ofGetWidth());
pos[i][1] = ofRandom(-ofGetHeight(), 2 * ofGetHeight());
pos[i][2] = ofRandom(-ofGetWidth(), ofGetWidth());
vel[i][0] = ofRandom(-1, 1);
vel[i][1] = ofRandom(-1, 1);
vel[i][2] = ofRandom(-1, 1);
col[i][0] = 1;//ofRandom(0, 1);
col[i][1] = 1;//ofRandom(0, 1);
col[i][2] = 1;//ofRandom(0, 1);
col[i][3] = 1;//ofRandom(0, 1);
}
ofDisableArbTex(); // new in OF006, force any texture created from this point on, to be GL_TEXTURE_2D (normalized uv coords)
image.loadImage("grad.png");
}