Trouble using Batch - other render paths work


#1

For context, I’m making a game and VboMesh, GlslProg, etc all are working great. My issue is that I’m rendering a simple screen-aligned background quad with a fragment shader to draw a debug coordinate system.

Ignoring the model matrix setup and uniform bindings, the following draw call works great:

gl::ScopedGlslProg sglp(_shader);
gl::drawSolidRect(Rectf(-1,-1,1,1));

On the other hand, if I make a batch:

_batch = gl::Batch::create(geom::Plane().size(vec2(2,2)), _shader); // plane of size 2,2 centered on 0

And in my draw loop draw it:

_batch->draw()

Using Batch instead of the gl::drawSolidRect I get no output. I’ve put in tests in my fragment shader to simply output a solid color and, nada.

I don’t know exactly what state is encapsulated in Batch. I did the tutorials, Batch seems nice. I know the overhead of drawing a single quad in “immediate mode” via gl::drawSolidRect is essentially nil, but if I can fast path anything I will.

Any pointers are appreciated,


#2

A geom::Plane() is a 3d plane, which I believe is facing up by default. You can manipulate the normal with geom::Plane().normal ( vec3 ( ... ) ), but to draw analogous geometry to gl::drawSolidRect() you want to create your batch with a geom::Rect().rect ( Rectf ( ... ) )


#3

That worked! Thanks so much.