[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nel] Custom screenshot
From: |
Cyril 'Hulud' Corvazier |
Subject: |
Re: [Nel] Custom screenshot |
Date: |
Thu, 27 Feb 2003 13:43:08 +0100 |
Hi Stéphane,
In NeL it is not possible to change the scene driver for another one if the
first driver has not been deleted. The main reason is
the driver resources (like textures id, vertex buffers id or vertex programs
id) are keeped inside the scene shapes, and the shapes
don't check if the driver is the same or not.
In theory, it is possible to delete a driver and set a new driver. Each driver
resources are pointed by a CRefPointer that will be
set to NULL after the driver release. Then, at the first render with the new
driver, each shape will allocate its new resources in
the new driver (and reloading the textures...). I say "in theory" because it
works on the paper, but we don't have tested it yet.
Soon, we will use this feature to erase the driver on the fly in Ryzom to
toggle between fullscreen / windowed mode without restart.
For your problem, i have just add an option in OV to shoot a movie with the
current scene. This option ask you for the resolution of
the movie. It may help you.
Hld.
> Hi,
>
> I would like to save a screenshot in a different resolution than what appears
> the screen.I've tried to create a dummy driver and
render in it but the screenshot stays black. Here's my sample code :
>
> if (CNELU::AsyncListener.isKeyPushed(KeyS))
> {
> NLMISC::CBitmap btm;
> IDriver *driver= CDRU::createGlDriver();
> driver->init();
> CWnd *wnd = new CWnd();
> driver->setDisplay(wnd->m_hWnd,GfxMode(1024, 768, 16));
> driver->activate();
> // Set up the dummy driver
> CNELU::Scene.setDriver(driver);
> // Clear buffers and render
> CNELU::clearBuffers (CRGBA (0, 0, 0));
> CNELU::Scene.render();
> driver->swapBuffers();
> // Get the screenshot
> driver->getBuffer (btm);
> // Set up the old driver
> CNELU::Scene.setDriver(CNELU::Driver);
> CNELU::Scene.render();
> string filename = NLMISC::CFile::findNewFile ("screenshot.tga");
> COFile fs (filename);
> btm.writeTGA (fs,24,true);
> delete driver;
> }
>
> My sample is based on object_viewer code. Can anyone see what's wrong?
> Thanks
> Stephane