DzPBufferView usage?
shoei321
Posts: 113
Hi, I'm trying to render a part of the scene using DzPBufferView. When I call ::hardwareRender() I am not getting what I expect -- most likely I am not using these classes correctly, and I'm not turning up any usage guidance in the docs or forum.
Below is my setup and render sequence. The resulting image data is empty.
int dim = 512; QSize size = QSize(dim, dim); DzPBufferView* pv = new DzPBufferView(size); DzPBuffer* pb = dzOGL->getPBuffer(); pb->setEnabled(true); pb->initBuffer(); pb->makeCurrent(); log("pbuffer isSupported " + QString::number(pb->isSupported())); // return true log("pbuffer isValid " + QString::number(pb->isValid())); // returns true log("pb maxSize " + QString::number(pb->getMaxSize())); DzDrawStyle* ds = new DzTexturedStyle(); pv->setDrawStyle(ds); pv->setBackground(QColor(128, 128, 128, 255)); DzBasicCamera* cam = new DzBasicCamera(DzCamera::CameraType::ORTHO_CAMERA, false); cam->setName("rfCam"); cam->setLabel("rfCam"); dzScene->addNode(cam); cam->setWSPos(DzVec3(0, 120, -20)); cam->aimAt(DzVec3(0, 120, 0)); pv->setCamera(cam); DzViewRenderHandler * rh = new DzViewRenderHandler(size, dzScene->getTime(), "renderOutputFile", false); //rh->beginRender(); rh->beginRender(); rh->beginFrame(0); bool renderSuccess = pv->hardwareRender(rh); log("render Success " + QString::number(renderSuccess)); // returns true rh->finishFrame(); rh->finishRender(); QImage image = pv->getImage(); image.save("c:/tmp/asdf.jpg", "PNG", 100); // image data is zeroed out