Drawing a Bounding Box (Noob's corner)


#1

Hi all,

I’d like to draw a bounding box for my scene.

void BasicApp::setup()
{
[…]

auto lambert = gl::ShaderDef().lambert().color();
gl::GlslProgRef shader = gl::getStockShader(lambert);


auto cube = geom::Cube().size(20, 20, 20);
m_boundingBoxRef = gl::Batch::create(cube, shader);

}

This draws a solid shaded box.
What I’d like to draw is just the edges, I’m guessing that there’re might be a different shader I should use but I’m not sure.

Your help is appreciated.


#2

Hi Allo.

have you tried

geom::WireCube() ?

Best.


#3

Thanks @felixfaire.
So I replaced my geom::Cube() with geom::WireCube() like you suggested, but now it draws nothing.
I looked to see if I could set set wires’s thickness, but no luck.

Cheers.


#4

Mmm. Perhaps using

gl::bindStockShader( gl::ShaderDef().color() );

instead of the lambert shader might help. Are you also setting a color / alpha before the draw call?