I'm trying to learn how to use AGG to create vector based textures, but I want to be able to animate them...
Here's my method that runs every frame when I hold z down (for learning/testing purposes) :
Code: Select all
//////////////////////
// CedenApp testAGG //
//////////////////////
void CedenApp::testAGG(){
// this method runs every frame //
agg::rendering_buffer test_agg_rbuf(test_agg_buffer, test_agg_frame_width, test_agg_frame_height, test_agg_frame_width * test_agg_bytes_per_pixel);
pixfmt_type test_agg_pixf(test_agg_rbuf);
renbase_type test_agg_rbase(test_agg_pixf);
// set default fill color (B, G, R - why the frak for when it says rgba I don't know)
test_agg_rbase.clear(agg::rgba(0.5, 0.05, 0.05));
// rasterizer
agg::rasterizer_scanline_aa<> agg_ras;
agg::scanline_u8 agg_sl;
// clear out any vectors in agg_ras from the last texture request
agg_ras.reset();
// draw test texture (square)
agg_ras.add_vertex(((rand() % 5) - 1),((rand() % 5) - 1),1); // 1 = start a new shape
agg_ras.add_vertex(10,5,2); // 2 = continue current shape
agg_ras.add_vertex(10,10,2);
agg_ras.add_vertex(5,10,2);
agg_ras.add_vertex(0,0,79); // 79 = close current shape (so x,y don't matter)
// rasterize the vector shapes
agg::render_scanlines_aa_solid(agg_ras, agg_sl, test_agg_rbase, agg::rgba(0,(rand()%100)/100.0,0,1));
// so now I have a new randomly different (slightly) vector shape rasterised into test_agg_buffer (unsigned char*)
// but I can't figure out the right way to get it into a GUI image (i.e. for a radar map) or a meshes material :(
}