Anaglyph rendering.
very cool
Worlds at War (Current Project) - http://www.awkward-games.com
Ganadu'r, The Eternal Sage (Other Current Project) - http://rpg.naget.com
Ganadu'r, The Eternal Sage (Other Current Project) - http://rpg.naget.com
Re: Anaglyph rendering.
this work??? I have svn version a don´t see any change in the render.Luke wrote:hey, though I should post a bit of code I did lately for anaglyph rendering.
similar to the code by bob, here: http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=32209Code: Select all
void CGameEngine::drawAnaglyph() { vector3df oldPosition=camera->getPosition(); vector3df oldTarget=camera->getTarget(); matrix4 startMatrix=camera->getAbsoluteTransformation(); vector3df focusPoint= (camera->getTarget()-camera->getAbsolutePosition()).setLength(1) + camera->getAbsolutePosition() ; //Left eye... vector3df leftEye; matrix4 leftMove; leftMove.setTranslation( vector3df(-0.01f,0.0f,0.0f) ); leftEye=(startMatrix*leftMove).getTranslation(); //clear the depth buffer, and color driver->beginScene( true, true, SColor(0,200,200,255) ); driver->getOverrideMaterial().Material.ColorMask=ECP_RED; driver->getOverrideMaterial().EnableFlags=EMF_COLOR_MASK; driver->getOverrideMaterial().EnablePasses=ESNRP_SKY_BOX+ESNRP_SOLID+ESNRP_TRANSPARENT+ESNRP_TRANSPARENT_EFFECT+ESNRP_SHADOW; camera->setPosition( leftEye ); camera->setTarget( focusPoint ); draw(); // 'smgr->drawAll();' may go here //Right eye... vector3df rightEye; matrix4 rightMove; rightMove.setTranslation( vector3df(0.01f,0.0f,0.0f) ); rightEye=(startMatrix*rightMove).getTranslation(); //clear the depth buffer driver->clearZBuffer(); driver->getOverrideMaterial().Material.ColorMask=ECP_GREEN+ECP_BLUE; driver->getOverrideMaterial().EnableFlags=EMF_COLOR_MASK; driver->getOverrideMaterial().EnablePasses=ESNRP_SKY_BOX+ESNRP_SOLID+ESNRP_TRANSPARENT+ESNRP_TRANSPARENT_EFFECT+ESNRP_SHADOW; camera->setPosition( rightEye ); camera->setTarget( focusPoint ); draw(); // 'smgr->drawAll();' may go here driver->endScene(); driver->getOverrideMaterial().Material.ColorMask=ECP_ALL; driver->getOverrideMaterial().EnableFlags=0; driver->getOverrideMaterial().EnablePasses=0; camera->setPosition( oldPosition ); camera->setTarget( oldTarget ); }
but fixes a few problems, and more irrlicht friendly.
more images here
using a secondary camera for anaglyph rendering
In my mac osx 10.6 + irrlicht 1.6 installation this code (as well as the code posted by Bob) does not allow me to change the location and the orientation of the FPS camera. My 'solution' is to add an additional 'anaglyph' camera that is disabled by default. This secondary camera is only used for rendering without altering the primary camera settings.
Here is the header file (anaglyph.h):
and the c++ source code file (anaglyph.cpp):
Usage:
(1) Setup before the rendering loop:
where pFpsCamera is a pointer to the main camera (usually the player camera in a FPS game).
(2) Rendering loop must call:
instead of the 'traditional' code:
Hope this helps!
msxfan
Here is the header file (anaglyph.h):
Code: Select all
#ifndef _ANAGLYPH_IRRLICHT_H_
#define _ANAGLYPH_IRRLICHT_H_
#include <irrlicht.h>
using namespace irr;
scene::ICameraSceneNode* CreateAnaglyphCamera (scene::ISceneManager* smgr ,
scene::ICameraSceneNode* pPlayerCamera);
void RenderSceneAnaglyphMac (scene::ICameraSceneNode* pAnaglyphCamera, video::IVideoDriver* driver, scene::ISceneManager* smgr , video::SColor backgroundColor, float eyeDist = 0.01, bool endScene= true);
#endif
Code: Select all
#include "anaglyph.h"
#include <Irrlicht/os.h>
scene::ICameraSceneNode* CreateAnaglyphCamera (scene::ISceneManager* smgr ,
scene::ICameraSceneNode* pPlayerCamera)
{
scene::ICameraSceneNode* pAnaglyphCamera;
pAnaglyphCamera = smgr->addCameraSceneNode();
pAnaglyphCamera->setInputReceiverEnabled(false);
pAnaglyphCamera->setScale( pPlayerCamera->getScale());
pAnaglyphCamera->setNearValue( pPlayerCamera->getNearValue());
pAnaglyphCamera->setFarValue( pPlayerCamera->getFarValue());
pAnaglyphCamera->setAspectRatio( pPlayerCamera->getAspectRatio());
return pAnaglyphCamera;
}
void RenderSceneAnaglyphMac (scene::ICameraSceneNode* pAnaglyphCamera , video::IVideoDriver* driver, scene::ISceneManager* smgr, video::SColor backgroundColor, float eyeDist, bool endScene)
{
scene::ICameraSceneNode* pCamera = smgr->getActiveCamera();
// explicitly update attached camera animators
pCamera->OnAnimate(os::Timer::getTime());
pCamera->OnRegisterSceneNode();
core::matrix4 startMatrix=pCamera->getAbsoluteTransformation();
core:: vector3df focusPoint=
(pCamera->getTarget()-pCamera->getAbsolutePosition()).setLength(1) + pCamera->getAbsolutePosition() ;
//Left eye...
core::vector3df leftEye;
core::matrix4 leftMove;
leftMove.setTranslation( core::vector3df(-eyeDist,0.0f,0.0f) );
leftEye=(startMatrix*leftMove).getTranslation();
//Right eye...
core::vector3df rightEye;
core::matrix4 rightMove;
rightMove.setTranslation( core::vector3df(eyeDist,0.0f,0.0f) );
rightEye=(startMatrix*rightMove).getTranslation();
// enable secondary camera for anaglyph rendering
smgr->setActiveCamera(pAnaglyphCamera);
// ------- RENDER LEFT EYE ----------
driver->beginScene( true, true, backgroundColor );
driver->getOverrideMaterial().Material.ColorMask= video::ECP_RED;
driver->getOverrideMaterial().EnableFlags= video::EMF_COLOR_MASK;
driver->getOverrideMaterial().EnablePasses= scene::ESNRP_SKY_BOX+ scene::ESNRP_SOLID +
scene::ESNRP_TRANSPARENT+ scene::ESNRP_TRANSPARENT_EFFECT+ scene::ESNRP_SHADOW;
pAnaglyphCamera->setTarget( focusPoint );
pAnaglyphCamera->setPosition( leftEye );
pAnaglyphCamera->OnRegisterSceneNode();
smgr->drawAll();
// ------- RENDER RIGHT EYE ----------
driver->clearZBuffer();
driver->getOverrideMaterial().Material.ColorMask= video::ECP_GREEN + video::ECP_BLUE;
driver->getOverrideMaterial().EnableFlags= video::EMF_COLOR_MASK;
driver->getOverrideMaterial().EnablePasses= scene::ESNRP_SKY_BOX+ scene::ESNRP_SOLID+
scene::ESNRP_TRANSPARENT+ scene::ESNRP_TRANSPARENT_EFFECT+ scene::ESNRP_SHADOW;
pAnaglyphCamera->setTarget( focusPoint );
pAnaglyphCamera->setPosition( rightEye );
pAnaglyphCamera->OnRegisterSceneNode();
smgr->drawAll();
driver->getOverrideMaterial().Material.ColorMask= video::ECP_ALL;
driver->getOverrideMaterial().EnableFlags=0;
driver->getOverrideMaterial().EnablePasses=0;
if (endScene) driver->endScene();
// restore active camera
smgr->setActiveCamera(pCamera);
}
(1) Setup before the rendering loop:
Code: Select all
scene::ICameraSceneNode* pAnaglyphCamera =CreateAnaglyphCamera( smgr, pFpsCamera );
smgr->setActiveCamera(pFpsCamera);
(2) Rendering loop must call:
Code: Select all
RenderSceneAnaglyphMac ( pAnaglyphCamera, driver, smgr );
instead of the 'traditional' code:
Code: Select all
driver->beginScene(true, true, video::SColor(255,200,200,200));
smgr->drawAll();
driver->endScene();
msxfan
http://www.xup.in/dl,18161740/anaglyph.7z/
your code is segfaulting , bobs is sortof working. perhaps someone knows how to fix this demo. it includes both versions as a define.
http://cgi.ebay.ca/50-Pair-Red-Green-3D ... 1c125b6c70
your code is segfaulting , bobs is sortof working. perhaps someone knows how to fix this demo. it includes both versions as a define.
http://cgi.ebay.ca/50-Pair-Red-Green-3D ... 1c125b6c70
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
-- https://github.com/netpipe/Luna Game Engine Status 95%
the link dosn'nt work
the mac code is
so you need bacjgroung color, eyedist and endscene (i try this on pc : os::Timer::getTime() error , erase this fix the problem)?
and the first code crash on my pc
so, this only work with irrlicht 1.4, it is out of date. i propose a version (based on the original version by the author of this post) that work with irrlicht 1.6 and 1.7, it is terrain rendering exemple, but the caùera is buggy, i try to fix the problem.analygriph work , but not the fps camera, - maybe with a modified fps camera, or a big research in the doc and internet.others code don't work.but, finaly , i don't need a fps camera for my application, so, this code work, and i want to said a VERY BIG THANK to the author
the mac code is
Code: Select all
scene::ICameraSceneNode* pAnaglyphCamera, video::IVideoDriver* driver, scene::ISceneManager* smgr , video::SColor backgroundColor, float eyeDist = 0.01, bool endScene= true
and the first code crash on my pc
so, this only work with irrlicht 1.4, it is out of date. i propose a version (based on the original version by the author of this post) that work with irrlicht 1.6 and 1.7, it is terrain rendering exemple, but the caùera is buggy, i try to fix the problem.analygriph work , but not the fps camera, - maybe with a modified fps camera, or a big research in the doc and internet.others code don't work.but, finaly , i don't need a fps camera for my application, so, this code work, and i want to said a VERY BIG THANK to the author
Code: Select all
/** Example 012 Terrain Rendering
This tutorial will briefly show how to use the terrain renderer of Irrlicht. It
will also show the terrain renderer triangle selector to be able to do
collision detection with terrain.
Note that the Terrain Renderer in Irrlicht is based on Spintz'
GeoMipMapSceneNode, lots of thanks go to him. DeusXL provided a new elegant
simple solution for building larger area on small heightmaps -> terrain
smoothing.
In the beginning there is nothing special. We include the needed header files
and create an event listener to listen if the user presses a key: The 'W' key
switches to wireframe mode, the 'P' key to pointcloud mode, and the 'D' key
toggles between solid and detail mapped material.
*/
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace video;
using namespace io;
using namespace gui;
using namespace std;
using namespace scene;
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
class MyEventReceiver : public IEventReceiver
{
public:
MyEventReceiver(scene::ISceneNode* terrain, scene::ISceneNode* skybox, scene::ISceneNode* skydome) :
Terrain(terrain), Skybox(skybox), Skydome(skydome), showBox(true)
{
Skybox->setVisible(true);
Skydome->setVisible(false);
}
bool OnEvent(const SEvent& event)
{
// check if user presses the key 'W' or 'D'
if (event.EventType == irr::EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown)
{
switch (event.KeyInput.Key)
{
case irr::KEY_KEY_W: // switch wire frame mode
Terrain->setMaterialFlag(video::EMF_WIREFRAME,
!Terrain->getMaterial(0).Wireframe);
Terrain->setMaterialFlag(video::EMF_POINTCLOUD, false);
return true;
case irr::KEY_KEY_P: // switch wire frame mode
Terrain->setMaterialFlag(video::EMF_POINTCLOUD,
!Terrain->getMaterial(0).PointCloud);
Terrain->setMaterialFlag(video::EMF_WIREFRAME, false);
return true;
case irr::KEY_KEY_D: // toggle detail map
Terrain->setMaterialType(
Terrain->getMaterial(0).MaterialType == video::EMT_SOLID ?
video::EMT_DETAIL_MAP : video::EMT_SOLID);
return true;
case irr::KEY_KEY_S: // toggle skies
showBox=!showBox;
Skybox->setVisible(showBox);
Skydome->setVisible(!showBox);
return true;
default:
break;
}
}
return false;
}
private:
scene::ISceneNode* Terrain;
scene::ISceneNode* Skybox;
scene::ISceneNode* Skydome;
bool showBox;
};
/*
The start of the main function starts like in most other example. We ask the
user for the desired renderer and start it up. This time with the advanced
parameter handling.
*/
int main()
{
// ask user for driver
// create device with full flexibility over creation parameters
// you can add more parameters if desired, check irr::SIrrlichtCreationParameters
irr::SIrrlichtCreationParameters params;
params.DriverType= video::EDT_OPENGL;
params.WindowSize=core::dimension2d<u32>(640, 480);
IrrlichtDevice* device = createDeviceEx(params);
if (device == 0)
return 1; // could not create selected driver.
/*
First, we add standard stuff to the scene: A nice irrlicht engine
logo, a small help text, a user controlled camera, and we disable
the mouse cursor.
*/
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
gui::IGUIEnvironment* env = device->getGUIEnvironment();
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
// add irrlicht logo
env->addImage(driver->getTexture("../../media/irrlichtlogo2.png"),
core::position2d<s32>(10,10));
//set other font
env->getSkin()->setFont(env->getFont("../../media/fontlucida.png"));
// add some help text
env->addStaticText(
L"Press 'W' to change wireframe mode\nPress 'D' to toggle detail map\nPress 'S' to toggle skybox/skydome",
core::rect<s32>(10,421,250,475), true, true, 0, -1, true);
// add camera
scene::ICameraSceneNode* camera =
smgr->addCameraSceneNode();
camera->setPosition(core::vector3df(2700*2,255*2,2600*2));
camera->setTarget(core::vector3df(2397*2,343*2,2700*2));
camera->setFarValue(42000.0f);
scene::ICameraSceneNode* pcamera =
smgr->addCameraSceneNodeFPS(0,100.0f,1.2f);
pcamera->setPosition(core::vector3df(2700*2,255*2,2600*2));
pcamera->setTarget(core::vector3df(2397*2,343*2,2700*2));
pcamera->setFarValue(42000.0f);
// disable mouse cursor
device->getCursorControl()->setVisible(false);
/*
Here comes the terrain renderer scene node: We add it just like any
other scene node to the scene using
ISceneManager::addTerrainSceneNode(). The only parameter we use is a
file name to the heightmap we use. A heightmap is simply a gray scale
texture. The terrain renderer loads it and creates the 3D terrain from
it.
To make the terrain look more big, we change the scale factor of
it to (40, 4.4, 40). Because we don't have any dynamic lights in the
scene, we switch off the lighting, and we set the file
terrain-texture.jpg as texture for the terrain and detailmap3.jpg as
second texture, called detail map. At last, we set the scale values for
the texture: The first texture will be repeated only one time over the
whole terrain, and the second one (detail map) 20 times.
*/
// add terrain scene node
scene::ITerrainSceneNode* terrain = smgr->addTerrainSceneNode(
"../../media/terrain-heightmap.bmp",
0, // parent node
-1, // node id
core::vector3df(0.f, 0.f, 0.f), // position
core::vector3df(0.f, 0.f, 0.f), // rotation
core::vector3df(40.f, 4.4f, 40.f), // scale
video::SColor ( 255, 255, 255, 255 ), // vertexColor
5, // maxLOD
scene::ETPS_17, // patchSize
4 // smoothFactor
);
terrain->setMaterialFlag(video::EMF_LIGHTING, false);
terrain->setMaterialTexture(0,
driver->getTexture("../../media/terrain-texture.jpg"));
terrain->setMaterialTexture(1,
driver->getTexture("../../media/detailmap3.jpg"));
terrain->setMaterialType(video::EMT_DETAIL_MAP);
terrain->scaleTexture(1.0f, 20.0f);
//terrain->setDebugDataVisible ( true );
/*
To be able to do collision with the terrain, we create a triangle selector.
If you want to know what triangle selectors do, just take a look into the
collision tutorial. The terrain triangle selector works together with the
terrain. To demonstrate this, we create a collision response animator
and attach it to the camera, so that the camera will not be able to fly
through the terrain.
*/
// create triangle selector for the terrain
scene::ITriangleSelector* selector
= smgr->createTerrainTriangleSelector(terrain, 0);
terrain->setTriangleSelector(selector);
// create collision response animator and attach it to the camera
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, pcamera, core::vector3df(60,100,60),
core::vector3df(0,0,0),
core::vector3df(0,50,0));
selector->drop();
pcamera->addAnimator(anim);
anim->drop();
/* If you need access to the terrain data you can also do this directly via the following code fragment.
*/
scene::CDynamicMeshBuffer* buffer = new scene::CDynamicMeshBuffer(video::EVT_2TCOORDS, video::EIT_16BIT);
terrain->getMeshBufferForLOD(*buffer, 0);
video::S3DVertex2TCoords* data = (video::S3DVertex2TCoords*)buffer->getVertexBuffer().getData();
// Work on data or get the IndexBuffer with a similar call.
buffer->drop(); // When done drop the buffer again.
/*
To make the user be able to switch between normal and wireframe mode,
we create an instance of the event reciever from above and let Irrlicht
know about it. In addition, we add the skybox which we already used in
lots of Irrlicht examples and a skydome, which is shown mutually
exclusive with the skybox by pressing 'S'.
*/
// create skybox and skydome
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
scene::ISceneNode* skybox=smgr->addSkyBoxSceneNode(
driver->getTexture("../../media/irrlicht2_up.jpg"),
driver->getTexture("../../media/irrlicht2_dn.jpg"),
driver->getTexture("../../media/irrlicht2_lf.jpg"),
driver->getTexture("../../media/irrlicht2_rt.jpg"),
driver->getTexture("../../media/irrlicht2_ft.jpg"),
driver->getTexture("../../media/irrlicht2_bk.jpg"));
scene::ISceneNode* skydome=smgr->addSkyDomeSceneNode(driver->getTexture("../../media/skydome.jpg"),16,8,0.95f,2.0f);
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);
// create event receiver
MyEventReceiver receiver(terrain, skybox, skydome);
device->setEventReceiver(&receiver);
/*
That's it, draw everything.
*/
int lastFPS = -1;
while(device->run())
if (device->isWindowActive())
{
core::vector3df oldPosition = pcamera->getPosition();
core::vector3df oldTarget = pcamera->getTarget();
core::matrix4 startMatrix= pcamera->getAbsoluteTransformation();
core::vector3df focusPoint= (pcamera->getTarget()-pcamera->getAbsolutePosition()).setLength(1) + pcamera->getAbsolutePosition() ;
//Left eye...
smgr->setActiveCamera(camera);
core::vector3df leftEye;
core::matrix4 leftMove;
leftMove.setTranslation( core::vector3df(-0.01f,0.0f,0.0f) );
leftEye=(startMatrix*leftMove).getTranslation();
//clear the depth buffer, and color
driver->beginScene( true, true, SColor(0,200,200,255) );
driver->getOverrideMaterial().Material.ColorMask=ECP_RED;
driver->getOverrideMaterial().EnableFlags=EMF_COLOR_MASK;
driver->getOverrideMaterial().EnablePasses=ESNRP_SKY_BOX+ESNRP_SOLID+ESNRP_TRANSPARENT+ESNRP_TRANSPARENT_EFFECT+ESNRP_SHADOW;
camera->setPosition( leftEye );
camera->setTarget( focusPoint );
smgr->drawAll();
//Right eye...
core::vector3df rightEye;
core::matrix4 rightMove;
rightMove.setTranslation( core::vector3df(0.01f,0.0f,0.0f) );
rightEye=(startMatrix*rightMove).getTranslation();
//clear the depth buffer
driver->clearZBuffer();
driver->getOverrideMaterial().Material.ColorMask=ECP_GREEN+ECP_BLUE;
driver->getOverrideMaterial().EnableFlags=EMF_COLOR_MASK;
driver->getOverrideMaterial().EnablePasses=ESNRP_SKY_BOX+ESNRP_SOLID+ESNRP_TRANSPARENT+ESNRP_TRANSPARENT_EFFECT+ESNRP_SHADOW;
camera->setPosition( rightEye );
camera->setTarget( focusPoint );
smgr->drawAll();
driver->endScene();
smgr->setActiveCamera(pcamera);
driver->getOverrideMaterial().Material.ColorMask=ECP_ALL;
driver->getOverrideMaterial().EnableFlags=0;
driver->getOverrideMaterial().EnablePasses=0;
camera->setPosition( oldPosition );
camera->setTarget( oldTarget );
// display frames per second in window title
int fps = driver->getFPS();
if (lastFPS != fps)
{
core::stringw str = L"Terrain Renderer - Irrlicht Engine [";
str += driver->getName();
str += "] FPS:";
str += fps;
// Also print terrain height of current camera position
// We can use camera position because terrain is located at coordinate origin
str += " Height: ";
str += terrain->getHeight(camera->getAbsolutePosition().X,
camera->getAbsolutePosition().Z);
device->setWindowCaption(str.c_str());
lastFPS = fps;
}
}
device->drop();
return 0;
}
/*
Now you know how to use terrain in Irrlicht.
**/
Hello
Hi
I look at your code and I try to do something similar
I try somes things but I'm always stuck wioth the fps not moving,
if the main camera (in your program its pcamera) is not draw, the software seems to not move, maybe the receiver not sending the information?
did you succeed with that (its just that I try your code and its seems to be the same problem)
I'm nooby with triliant (and maybe in c++ ) and your help can be very valuable
tank you
I look at your code and I try to do something similar
I try somes things but I'm always stuck wioth the fps not moving,
if the main camera (in your program its pcamera) is not draw, the software seems to not move, maybe the receiver not sending the information?
did you succeed with that (its just that I try your code and its seems to be the same problem)
I'm nooby with triliant (and maybe in c++ ) and your help can be very valuable
tank you
did the code working, for me the window is freeze
the winProc need to be the win32 version (I work on windows)
how to create that
I use a standard winProc for the moment but we need the processing of the win32 but I dont know how to use it because CIrrDeviceWin32 is not in irr, I dont know how to use that kind of object
maybe I'm noob
the winProc need to be the win32 version (I work on windows)
how to create that
I use a standard winProc for the moment but we need the processing of the win32 but I dont know how to use it because CIrrDeviceWin32 is not in irr, I dont know how to use that kind of object
maybe I'm noob
const c8* ClassName = "CIrrDeviceWin32";
HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL);
MSG msg; // Message Structure
WNDCLASS wc; // Window Class structure
HWND hWnd1,hWnd2; // Window handle of main window
// Register Window style
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = hBlueBrush; // Use blue brush for background
wc.lpszMenuName = NULL;
wc.lpszClassName = ClassName;
if(RegisterClass(&wc) == 0)
return FALSE;
// Create the main application window
hWnd1 = CreateWindow(
//lpszAppName,
ClassName,
lpszAppName,
WS_OVERLAPPEDWINDOW,
100, 100, // Size and dimensions of window
250, 250,
NULL,
NULL,
hInstance,
NULL);
// If window was not created, quit
if(hWnd1 == NULL)
return FALSE;
// Display the window
ShowWindow(hWnd1,SW_SHOW);
UpdateWindow(hWnd1);
did u succed on a dual screen or only the anaglyph with a simple device?
-----------------------------------------------------------------------------------
I have some issues all the time, I try to create window with irrlitch winproc fct but...
I try :
My error
dont know what to do
-----------------------------------------------------------------------------------
I have some issues all the time, I try to create window with irrlitch winproc fct but...
I try :
Code: Select all
wc.lpfnWndProc = (WNDPROC)(irr::CIrrDeviceWin32::WndProc);
Code: Select all
Error 6 error C2440: 'type cast' : cannot convert from 'LRESULT (__stdcall irr::CIrrDeviceWin32::* )(HWND,UINT,WPARAM,LPARAM)' to 'WNDPROC'
so I duplicate the wndProc, I change somes things but I have somethings that I ... I dont know what to do
we have here 2 camera,
[0] is a fps cam
[2] is a modification of the cam
but that make each cam show each time, like in stereo but its not.
how stop using the drawAll(), because now I need it for the movement of the camera[0].
can I edit the code of drawAll(), its on ISceneManager.h, but I dont have .cpp
any Idea?
Code: Select all
driver->setViewPort(rect<s32>(0,0,ResX,ResY)); driver->beginScene(true,true,SColor(255,100,100,100),hWnd1); smgr->setActiveCamera(camera[0]);
smgr->drawAll();
driver->endScene();
driver->beginScene(true,true,SColor(255,100,100,100),hWnd1);
smgr->setActiveCamera(camera[2]);
smgr->drawAll();
driver->endScene();
[0] is a fps cam
[2] is a modification of the cam
but that make each cam show each time, like in stereo but its not.
how stop using the drawAll(), because now I need it for the movement of the camera[0].
can I edit the code of drawAll(), its on ISceneManager.h, but I dont have .cpp
any Idea?
Re: Anaglyph rendering.
Hi,
I'm currently trying to make Anaglyph Rendering work with Irrlicht 1.8.
I didn't manage to make it work properly yet, but i'd like to share a first correction to the source code proposed by Luke:
must be added before calling:
Then, the code snippets should be corrected:
http://irrlicht3d.org/wiki/index.php?n= ... hRendering
Final code:
I'm currently trying to make Anaglyph Rendering work with Irrlicht 1.8.
I didn't manage to make it work properly yet, but i'd like to share a first correction to the source code proposed by Luke:
The following call :Luke wrote:hey, though I should post a bit of code I did lately for anaglyph rendering.Code: Select all
void CGameEngine::drawAnaglyph() { vector3df oldPosition=camera->getPosition(); vector3df oldTarget=camera->getTarget(); matrix4 startMatrix=camera->getAbsoluteTransformation(); [......]
Code: Select all
camera->updateAbsolutePosition();
Code: Select all
matrix4 startMatrix=camera->getAbsoluteTransformation();
http://irrlicht3d.org/wiki/index.php?n= ... hRendering
Final code:
Code: Select all
void CGameEngine::drawAnaglyph()
{
vector3df oldPosition=camera->getPosition();
vector3df oldTarget=camera->getTarget();
camera->updateAbsolutePosition();
matrix4 startMatrix=camera->getAbsoluteTransformation();
[......]