示例#1
0
void FBO_TestApp::draw() {
	if(fancyDraw) {
		std::vector<poPoint> grid;
		std::vector<poPoint> coords;
		std::vector<unsigned short> indices;
		
		int dim = 10;
		
		for(int i=0; i<=dim; i++) {
			for(int j=0; j<=dim; j++) {
				float pctj = j / float(dim);
				float pcti = i / float(dim);
				
				grid.push_back(poPoint(pctj*500.f, pcti*500.f, 0.f) + poPoint(50,50));
				coords.push_back(poPoint(pctj, 1.0-pcti, 0.f));
				
				indices.push_back(i*10 + j);
				indices.push_back((i+1)*10 + j);
				indices.push_back((i+1)*10 + j+1);
				indices.push_back(i*10 + j+1);
			}
		}
		
		for(int i=0; i<grid.size(); i++) {
			float r = poRand(0,6);
			grid[i].x += r;
			grid[i].y += r;
		}

		po::drawPoints(grid, indices, fbo->colorTexture(), coords, GL_QUADS);
	}
}
示例#2
0
Title::Title(std::string _text){
    
    std::string text = _text;
    
    titleText = new poTextBox(100,100);
    titleText->setText( text );						// Set the text based on the value of the node
    titleText->setFont( poGetFont("Times New Roman", "Regular") );
    titleText->setTextSize(13);
    titleText->textColor = poColor::white;
    titleText->doLayout();
    
    //give our text a random position
    float posX = poRand(0,300);
    float posY = poRand(-300,0);
    titleText->position.set(posX, posY, 0);
    addChild(titleText);

}