QCPlugInContext get bounds in pixel dimensions

franz's picture

Hi, I'm trying to get the QC context dimensions in pixels. So far [context bounds] returns values in QCunits. That's not so convenient to me as I'm trying to set a FBO according to QC viewport size in pixel.

Is there an elegant way to retrieve these values ?

Note that I can still publish some inputs from within my patch and hook then to a Rendering Destination Dimensions patch, but that's rather a cowboy way of doing things...

Regards.

vade's picture
Re: QCPlugInContext get bounds in pixel dimensions

glGetIntegerv(GL_VIEWPORT, viewport); where viewport is a GLint *

cwright's picture
Re: QCPlugInContext get bounds in pixel dimensions

make that a GLint[4] (don't want to smash the stack there).

this isn't quite reliable - it's entirely possible for a patch to make the viewport a subset of the available context (there's a GLTools patch that does that, for example). that may or may not be a deal breaker, but it's something to be aware of.

franz's picture
Re: QCPlugInContext get bounds in pixel dimensions

thanks for the fast reply !

dust's picture
Re: QCPlugInContext get bounds in pixel dimensions

good question franz. kind of difficult to convert your units to pixels without knowing the viewer size.