Anaglyphic 3D

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
bob
Posts: 57
Joined: Fri Jun 08, 2007 4:17 am
Location: Jacksonville, Fl (USA)
Contact:

Anaglyphic 3D

Post by bob »

Well, the super bowl left me with a bunch of cheap 3D glasses, so I thought I would include an anaglyph function. There's lot's of talk on the board about how to do this, but doesn't seem to be a straight forward function anywhere, so here it is.

Of course, I'm not smart enough to come up with this, so thanks to the many that provided the smart stuff, I humbly bring it together into a function.

The super bowl glasses are blue and orange instead of the more traditional cyan/red. Try passing ulREyeKey = 0x000000ff, ulLEyeKey = 0x00ffff00, for those glasses. You'll have to change the key if you have different color lenses. 2 and 1000 are good starting points for fWidth and fFocus respectively. (That's the width between the eyes and the focal point).


Code: Select all

static BOOL DrawAnaglyph( irr::video::IVideoDriver *pDriver,
						  irr::scene::ISceneManager *pSm,
						  irr::scene::ICameraSceneNode *pCamera,
						  irr::video::SColor colBackground,
						  float fWidth, float fFocus, int nDriverType,
						  unsigned long ulREyeKey, unsigned long ulLEyeKey )
{
	// Right eye
    irr::core::vector3df reye = pCamera->getPosition();

	// Left eye
	irr::core::vector3df v( fWidth, 0, 0 );
	irr::core::matrix4 m;
	m.setRotationDegrees( pCamera->getRotation() + irr::core::vector3df( 90.f, 0, 0 ) );
	m.transformVect( v );
	irr::core::vector3df leye = reye + v;

	// Eye target
	irr::core::vector3df oldt = pCamera->getTarget();
	irr::core::vector3df eyet = ( oldt - reye ).normalize() * fFocus;
    pCamera->setTarget( eyet );

	IDirect3DDevice9 *pDdx9 = NULL;
	if ( nDriverType == irr::video::EDT_DIRECT3D9
		        && pDriver->getExposedVideoData().D3D9.D3DDev9 )
		pDdx9 = pDriver->getExposedVideoData().D3D9.D3DDev9;

	// Setup right eye
	if ( nDriverType == irr::video::EDT_OPENGL )
	{	glMatrixMode( GL_MODELVIEW );
		glLoadIdentity();
		glColorMask( 0 != ( ulREyeKey & 0x00ff0000 ), 
				     0 != ( ulREyeKey & 0x0000ff00 ), 
				     0 != ( ulREyeKey & 0x000000ff ), 
					 0 != ( ulREyeKey & 0xff000000 ) );
	} // end if
	else if ( pDdx9 )
		pDdx9->SetRenderState( D3DRS_COLORWRITEENABLE, 
							   ( ulREyeKey & 0x00ff0000 ? D3DCOLORWRITEENABLE_RED : 0 )
							   | ( ulREyeKey & 0x0000ff00 ? D3DCOLORWRITEENABLE_GREEN : 0 )
							   | ( ulREyeKey & 0x000000ff ? D3DCOLORWRITEENABLE_BLUE : 0 )
							   | ( ulREyeKey & 0xff000000 ? D3DCOLORWRITEENABLE_ALPHA : 0 ) );

    pDriver->beginScene( true, true, colBackground );
    pSm->drawAll();

	// Left Eye
	if ( nDriverType == irr::video::EDT_OPENGL )
	{	glClear( GL_DEPTH_BUFFER_BIT );
		glMatrixMode( GL_MODELVIEW );
		glLoadIdentity();
		glColorMask( 0 != ( ulLEyeKey & 0x00ff0000 ), 
				     0 != ( ulLEyeKey & 0x0000ff00 ), 
				     0 != ( ulLEyeKey & 0x000000ff ), 
					 0 != ( ulLEyeKey & 0xff000000 ) );
	} // end if
	else if ( pDdx9 )
	{	pDdx9->Clear(0 , 0 , D3DCLEAR_ZBUFFER, 0x000000 , 1.0f , 0);
		pDdx9->SetRenderState( D3DRS_COLORWRITEENABLE, 
							   ( ulLEyeKey & 0x00ff0000 ? D3DCOLORWRITEENABLE_RED : 0 )
							   | ( ulLEyeKey & 0x0000ff00 ? D3DCOLORWRITEENABLE_GREEN : 0 )
							   | ( ulLEyeKey & 0x000000ff ? D3DCOLORWRITEENABLE_BLUE : 0 )
							   | ( ulLEyeKey & 0xff000000 ? D3DCOLORWRITEENABLE_ALPHA : 0 ) );
	} // end else if
    pCamera->setPosition( leye );
	pCamera->OnRegisterSceneNode();

    pSm->drawAll();
    pDriver->endScene();

	if ( nDriverType == irr::video::EDT_OPENGL )
		glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
	else if ( pDdx9 )
	if ( pDdx9 )
		pDdx9->SetRenderState( D3DRS_COLORWRITEENABLE, 
							   D3DCOLORWRITEENABLE_BLUE 
							   | D3DCOLORWRITEENABLE_GREEN 
							   | D3DCOLORWRITEENABLE_RED 
							   | D3DCOLORWRITEENABLE_ALPHA );

	// Restore original position
    pCamera->setPosition( reye );
	pCamera->setTarget( oldt );

	return TRUE;
}
*edit*

As to how to use this function, you could replace the following lines in your code with a call to this function.

Code: Select all

    pDriver->beginScene( true, true, colBackground );
    pSm->drawAll();
    pDriver->endScene();
Last edited by bob on Tue Feb 03, 2009 3:59 pm, edited 1 time in total.
tewe76
Posts: 42
Joined: Wed Jan 21, 2009 10:56 am
Location: Spain
Contact:

Post by tewe76 »

Question from a newby: and example of use? how and where have i to call it?
Also, a downloadable example would be fantastic :)
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

read the code and you'll see it basically replaces the contents of your while (device->run()) loop
Image Image Image
bob
Posts: 57
Joined: Fri Jun 08, 2007 4:17 am
Location: Jacksonville, Fl (USA)
Contact:

Post by bob »

Thanks JP, I added an edit. Which will probably just confuse things further. :)
As to an example, it would be cool, I wanted to, but I don't have the time now, this just took a few minutes. It should be pretty simple to use.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yeah, exactly the thing I also inteded to do in the next days. One thing Irrlicht is currently missing is a global material override. This will come in the next days. Afterwards, the whole process will just be a change in the global material override's colormask (yes, current trunk can already toggle those values) and render the scene twice. I just don't have the red/green glasses :roll:
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

hybrid wrote:One thing Irrlicht is currently missing is a global material override. This will come in the next days.
Image
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
tewe76
Posts: 42
Joined: Wed Jan 21, 2009 10:56 am
Location: Spain
Contact:

Post by tewe76 »

bob, thanks for the edit :D
Unfortunately i can't get it working. It gives me a lot of errors when compiling :( But forget me, this is probably due to my bad level in C++ :roll:

rogerborg: :lol:
bob
Posts: 57
Joined: Fri Jun 08, 2007 4:17 am
Location: Jacksonville, Fl (USA)
Contact:

Post by bob »

Oh yeah? What kinds of errors? :P
zeroZshadow
Posts: 43
Joined: Mon Dec 01, 2008 6:35 pm

Post by zeroZshadow »

i kindly suggest you make a version that does not include begin and end scene.

else the gui is screwed :P
maby chop it in 3 functions ? prerender, render, postrender ?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, overrideMaterial is functional and commited. You can now just change the colorMask in the global material and call drawAll which will render everything with the new colormask.
The depthbuffer clear has a method in IVideoDriver, so there's probably no need for the driver check anymore.
I *DO* need red/green goggles now :twisted:
tewe76
Posts: 42
Joined: Wed Jan 21, 2009 10:56 am
Location: Spain
Contact:

Post by tewe76 »

Oh yeah? What kinds of errors?
Well, first the code. It's a slightly modified version of the Quake3Map example:

Code: Select all

/** Example 002 Quake3Map

This Tutorial shows how to load a Quake 3 map into the engine, create a
SceneNode for optimizing the speed of rendering, and how to create a user
controlled camera.

Please note that you should know the basics of the engine before starting this
tutorial. Just take a short look at the first tutorial, if you haven't done
this yet: http://irrlicht.sourceforge.net/tut001.html 

Lets start like the HelloWorld example: We include the irrlicht header files
and an additional file to be able to ask the user for a driver type using the
console.
*/
#include <irrlicht.h>
#include <iostream>

/*
As already written in the HelloWorld example, in the Irrlicht Engine everything
can be found in the namespace 'irr'. To get rid of the irr:: in front of the
name of every class, we tell the compiler that we use that namespace from now
on, and we will not have to write that 'irr::'. There are 5 other sub
namespaces 'core', 'scene', 'video', 'io' and 'gui'. Unlike in the HelloWorld
example, we do not call 'using namespace' for these 5 other namespaces, because
in this way you will see what can be found in which namespace. But if you like,
you can also include the namespaces like in the previous example.
*/
using namespace irr;

/*
Again, to be able to use the Irrlicht.DLL file, we need to link with the
Irrlicht.lib. We could set this option in the project settings, but to make it
easy, we use a pragma comment lib:
*/
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif

static bool DrawAnaglyph( irr::video::IVideoDriver *pDriver, 
                    irr::scene::ISceneManager *pSm, 
                    irr::scene::ICameraSceneNode *pCamera, 
                    irr::video::SColor colBackground, 
                    float fWidth, float fFocus, int nDriverType, 
                    unsigned long ulREyeKey, unsigned long ulLEyeKey ) 
{ 
   // Right eye 
    irr::core::vector3df reye = pCamera->getPosition(); 

   // Left eye 
   irr::core::vector3df v( fWidth, 0, 0 ); 
   irr::core::matrix4 m; 
   m.setRotationDegrees( pCamera->getRotation() + irr::core::vector3df( 90.f, 0, 0 ) ); 
   m.transformVect( v ); 
   irr::core::vector3df leye = reye + v; 

   // Eye target 
   irr::core::vector3df oldt = pCamera->getTarget(); 
   irr::core::vector3df eyet = ( oldt - reye ).normalize() * fFocus; 
    pCamera->setTarget( eyet ); 

   IDirect3DDevice9 *pDdx9 = NULL; 
   if ( nDriverType == irr::video::EDT_DIRECT3D9 
              && pDriver->getExposedVideoData().D3D9.D3DDev9 ) 
      pDdx9 = pDriver->getExposedVideoData().D3D9.D3DDev9; 

   // Setup right eye 
   if ( nDriverType == irr::video::EDT_OPENGL ) 
   {   glMatrixMode( GL_MODELVIEW ); 
      glLoadIdentity(); 
      glColorMask( 0 != ( ulREyeKey & 0x00ff0000 ), 
                 0 != ( ulREyeKey & 0x0000ff00 ), 
                 0 != ( ulREyeKey & 0x000000ff ), 
                0 != ( ulREyeKey & 0xff000000 ) ); 
   } // end if 
   else if ( pDdx9 ) 
      pDdx9->SetRenderState( D3DRS_COLORWRITEENABLE, 
                        ( ulREyeKey & 0x00ff0000 ? D3DCOLORWRITEENABLE_RED : 0 ) 
                        | ( ulREyeKey & 0x0000ff00 ? D3DCOLORWRITEENABLE_GREEN : 0 ) 
                        | ( ulREyeKey & 0x000000ff ? D3DCOLORWRITEENABLE_BLUE : 0 ) 
                        | ( ulREyeKey & 0xff000000 ? D3DCOLORWRITEENABLE_ALPHA : 0 ) ); 

    pDriver->beginScene( true, true, colBackground ); 
    pSm->drawAll(); 

   // Left Eye 
   if ( nDriverType == irr::video::EDT_OPENGL ) 
   {   glClear( GL_DEPTH_BUFFER_BIT ); 
      glMatrixMode( GL_MODELVIEW ); 
      glLoadIdentity(); 
      glColorMask( 0 != ( ulLEyeKey & 0x00ff0000 ), 
                 0 != ( ulLEyeKey & 0x0000ff00 ), 
                 0 != ( ulLEyeKey & 0x000000ff ), 
                0 != ( ulLEyeKey & 0xff000000 ) ); 
   } // end if 
   else if ( pDdx9 ) 
   {   pDdx9->Clear(0 , 0 , D3DCLEAR_ZBUFFER, 0x000000 , 1.0f , 0); 
      pDdx9->SetRenderState( D3DRS_COLORWRITEENABLE, 
                        ( ulLEyeKey & 0x00ff0000 ? D3DCOLORWRITEENABLE_RED : 0 ) 
                        | ( ulLEyeKey & 0x0000ff00 ? D3DCOLORWRITEENABLE_GREEN : 0 ) 
                        | ( ulLEyeKey & 0x000000ff ? D3DCOLORWRITEENABLE_BLUE : 0 ) 
                        | ( ulLEyeKey & 0xff000000 ? D3DCOLORWRITEENABLE_ALPHA : 0 ) ); 
   } // end else if 
    pCamera->setPosition( leye ); 
   pCamera->OnRegisterSceneNode(); 

    pSm->drawAll(); 
    pDriver->endScene(); 

   if ( nDriverType == irr::video::EDT_OPENGL ) 
      glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); 
   else if ( pDdx9 ) 
   if ( pDdx9 ) 
      pDdx9->SetRenderState( D3DRS_COLORWRITEENABLE, 
                        D3DCOLORWRITEENABLE_BLUE 
                        | D3DCOLORWRITEENABLE_GREEN 
                        | D3DCOLORWRITEENABLE_RED 
                        | D3DCOLORWRITEENABLE_ALPHA ); 

   // Restore original position 
    pCamera->setPosition( reye ); 
   pCamera->setTarget( oldt ); 

   return TRUE; 
} 



/*
Ok, lets start. Again, we use the main() method as start, not the WinMain().
*/
int main()
{
	/*
	Like in the HelloWorld example, we create an IrrlichtDevice with
	createDevice(). The difference now is that we ask the user to select
	which video driver to use. The Software device might be
	too slow to draw a huge Quake 3 map, but just for the fun of it, we make
	this decision possible, too.
	*/

	// ask user for driver

	video::E_DRIVER_TYPE driverType;

	printf("Please select the driver you want for this example:\n"\
		" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
		" (d) Software Renderer\n (e) Burning's Software Renderer\n"\
		" (f) NullDevice\n (otherKey) exit\n\n");

	char i;
	std::cin >> i;

	switch(i)
	{
		case 'a': driverType = video::EDT_DIRECT3D9;break;
		case 'b': driverType = video::EDT_DIRECT3D8;break;
		case 'c': driverType = video::EDT_OPENGL;   break;
		case 'd': driverType = video::EDT_SOFTWARE; break;
		case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
		case 'f': driverType = video::EDT_NULL;     break;
		default: return 1;
	}	

	// create device and exit if creation failed

	IrrlichtDevice *device =
		createDevice(driverType, core::dimension2d<s32>(640, 480));

	if (device == 0)
		return 1; // could not create selected driver.

	/*
	Get a pointer to the video driver and the SceneManager so that
	we do not always have to call irr::IrrlichtDevice::getVideoDriver() and
	irr::IrrlichtDevice::getSceneManager().
	*/
	video::IVideoDriver* driver = device->getVideoDriver();
	scene::ISceneManager* smgr = device->getSceneManager();

	/*
	To display the Quake 3 map, we first need to load it. Quake 3 maps
	are packed into .pk3 files which are nothing else than .zip files.
	So we add the .pk3 file to our irr::io::IFileSystem. After it was added,
	we are able to read from the files in that archive as if they are
	directly stored on the disk.
	*/
	device->getFileSystem()->addZipFileArchive("../../media/map-20kdm2.pk3");

	/*
	Now we can load the mesh by calling
	irr::scene::ISceneManager::getMesh(). We get a pointer returned to an
	irr::scene::IAnimatedMesh. As you might know, Quake 3 maps are not
	really animated, they are only a huge chunk of static geometry with
	some materials attached. Hence the IAnimatedMesh consists of only one
	frame, so we get the "first frame" of the "animation", which is our
	quake level and create an OctTree scene node with it, using
	irr::scene::ISceneManager::addOctTreeSceneNode().
	The OctTree optimizes the scene a little bit, trying to draw only geometry
	which is currently visible. An alternative to the OctTree would be a
	irr::scene::IMeshSceneNode, which would always draw the complete
	geometry of the mesh, without optimization. Try it: Use
	irr::scene::ISceneManager::addMeshSceneNode() instead of
	addOctTreeSceneNode() and compare the primitives drawn by the video
	driver. (There is a irr::video::IVideoDriver::getPrimitiveCountDrawn()
	method in the irr::video::IVideoDriver class). Note that this
	optimization with the OctTree is only useful when drawing huge meshes
	consisting of lots of geometry.
	*/
	scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp");
	scene::ISceneNode* node = 0;
	
	if (mesh)
//		node = smgr->addOctTreeSceneNode(mesh->getMesh(0), 0, -1, 1024);
		node = smgr->addMeshSceneNode(mesh->getMesh(0));

	/*
	Because the level was not modelled around the origin (0,0,0), we
	translate the whole level a little bit. This is done on
	irr::scene::ISceneNode level using the methods
	irr::scene::ISceneNode::setPosition() (in this case),
	irr::scene::ISceneNode::setRotation(), and
	irr::scene::ISceneNode::setScale().
	*/
	if (node)
		node->setPosition(core::vector3df(-1300,-144,-1249));

	/*
	Now we only need a camera to look at the Quake 3 map.
	We want to create a user controlled camera. There are some
	cameras available in the Irrlicht engine. For example the
	MayaCamera which can be controlled like the camera in Maya:
	Rotate with left mouse button pressed, Zoom with both buttons pressed,
	translate with right mouse button pressed. This could be created with
	irr::scene::ISceneManager::addCameraSceneNodeMaya(). But for this
	example, we want to create a camera which behaves like the ones in
	first person shooter games (FPS) and hence use
	irr::scene::ISceneManager::addCameraSceneNodeFPS().
	*/
	scene::ICameraSceneNode* Cam = smgr->addCameraSceneNodeFPS();

	/*
	The mouse cursor needs not be visible, so we hide it via the
	irr::IrrlichtDevice::ICursorControl.
	*/
	device->getCursorControl()->setVisible(false);

	/*
	We have done everything, so lets draw it. We also write the current
	frames per second and the primitives drawn into the caption of the
	window. The test for irr::IrrlichtDevice::isWindowActive() is optional,
	but prevents the engine to grab the mouse cursor after task switching
	when other programs are active. The call to
	irr::IrrlichtDevice::yield() will avoid the busy loop to eat up all CPU
	cycles when the window is not active.
	*/
	int lastFPS = -1;

	while(device->run())
	{
		if (device->isWindowActive())
		{

			DrawAnaglyph(driver,smgr,Cam,video::SColor(255,200,200,200),2,1000,video::EDT_OPENGL ,0x000000ff,0x00ffff00);
			//driver->beginScene(true, true, video::SColor(255,200,200,200));
			//smgr->drawAll();
			//driver->endScene();

			int fps = driver->getFPS();

			if (lastFPS != fps)
			{
				core::stringw str = L"Irrlicht Engine - Quake 3 Map example [";
				str += driver->getName();
				str += "] FPS:";
				str += fps;

				device->setWindowCaption(str.c_str());
				lastFPS = fps;
			}
		}
		else
			device->yield();
	}

	/*
	In the end, delete the Irrlicht device.
	*/
	device->drop();
	return 0;
}

/*
That's it. Compile and play around with the program.
**/
Now the errors when compiling (i have the VC++ in spanish, sorry :roll: ) :

Code: Select all

1>------ Operación Generar iniciada: proyecto: 02.Quake3Map_vc9, configuración: Debug Win32 ------
1>Compilando...
1>main.cpp
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(68) : error C2065: 'GL_MODELVIEW' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(68) : error C3861: 'glMatrixMode': no se encontró el identificador
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(69) : error C3861: 'glLoadIdentity': no se encontró el identificador
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(70) : error C3861: 'glColorMask': no se encontró el identificador
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(76) : error C2027: uso del tipo 'IDirect3DDevice9' sin definir
1>        c:\app\noinstalables\irrlicht-engine-1.5\include\sexposedvideodata.h(10) : vea la declaración de 'IDirect3DDevice9'
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(76) : error C2227: el operando izquierdo de '->SetRenderState' debe señalar al tipo class/struct/union/generic
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(76) : error C2065: 'D3DRS_COLORWRITEENABLE' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(77) : error C2065: 'D3DCOLORWRITEENABLE_RED' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(78) : error C2065: 'D3DCOLORWRITEENABLE_GREEN' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(79) : error C2065: 'D3DCOLORWRITEENABLE_BLUE' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(80) : error C2065: 'D3DCOLORWRITEENABLE_ALPHA' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(87) : error C2065: 'GL_DEPTH_BUFFER_BIT' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(87) : error C3861: 'glClear': no se encontró el identificador
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(88) : error C2065: 'GL_MODELVIEW' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(88) : error C3861: 'glMatrixMode': no se encontró el identificador
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(89) : error C3861: 'glLoadIdentity': no se encontró el identificador
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(90) : error C3861: 'glColorMask': no se encontró el identificador
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(96) : error C2027: uso del tipo 'IDirect3DDevice9' sin definir
1>        c:\app\noinstalables\irrlicht-engine-1.5\include\sexposedvideodata.h(10) : vea la declaración de 'IDirect3DDevice9'
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(96) : error C2227: el operando izquierdo de '->Clear' debe señalar al tipo class/struct/union/generic
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(96) : error C2065: 'D3DCLEAR_ZBUFFER' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(97) : error C2027: uso del tipo 'IDirect3DDevice9' sin definir
1>        c:\app\noinstalables\irrlicht-engine-1.5\include\sexposedvideodata.h(10) : vea la declaración de 'IDirect3DDevice9'
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(97) : error C2227: el operando izquierdo de '->SetRenderState' debe señalar al tipo class/struct/union/generic
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(97) : error C2065: 'D3DRS_COLORWRITEENABLE' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(98) : error C2065: 'D3DCOLORWRITEENABLE_RED' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(99) : error C2065: 'D3DCOLORWRITEENABLE_GREEN' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(100) : error C2065: 'D3DCOLORWRITEENABLE_BLUE' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(101) : error C2065: 'D3DCOLORWRITEENABLE_ALPHA' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(110) : error C2065: 'GL_TRUE' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(110) : error C2065: 'GL_TRUE' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(110) : error C2065: 'GL_TRUE' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(110) : error C2065: 'GL_TRUE' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(110) : error C3861: 'glColorMask': no se encontró el identificador
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(113) : error C2027: uso del tipo 'IDirect3DDevice9' sin definir
1>        c:\app\noinstalables\irrlicht-engine-1.5\include\sexposedvideodata.h(10) : vea la declaración de 'IDirect3DDevice9'
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(113) : error C2227: el operando izquierdo de '->SetRenderState' debe señalar al tipo class/struct/union/generic
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(113) : error C2065: 'D3DRS_COLORWRITEENABLE' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(115) : error C2065: 'D3DCOLORWRITEENABLE_BLUE' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(116) : error C2065: 'D3DCOLORWRITEENABLE_GREEN' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(117) : error C2065: 'D3DCOLORWRITEENABLE_RED' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(117) : error C2065: 'D3DCOLORWRITEENABLE_ALPHA' : identificador no declarado
1>c:\app\noinstalables\irrlicht-engine-1.5\examples\xquake3map\main.cpp(123) : error C2065: 'TRUE' : identificador no declarado
1>El registro de compilación se guardó en el "file://c:\App\NoInstalables\irrlicht-Engine-1.5\examples\xQuake3Map\Debug\BuildLog.htm"
1>02.Quake3Map_vc9 - 40 errores, 0 advertencias
========== Generar: 0 correctos, 1 incorrectos, 0 actualizados, 0 omitidos ==========
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

You have to include the opengl and directx headers.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
tewe76
Posts: 42
Joined: Wed Jan 21, 2009 10:56 am
Location: Spain
Contact:

Post by tewe76 »

I see... thanks :)
Rob
Posts: 15
Joined: Wed Jan 28, 2009 4:24 pm

Camera origin is shifting slightly each frame, though reposd

Post by Rob »

I´m getting the camera from-position shifting around to the left using this code, although the camera position and target are being reset correct at the end of the call. Anyone any idea why this would happen? I´m using the exact code, restting the camera position, but its scrawling left!

As soon as I do a standand begin-draw cycle, the camera position correctly sets, but with this code although the exact correct coords are set in the pos camera call, its scrawling!!
xyzzy
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

I think you can give a rest to this method... it requires you to draw the scene entirely twice. get a depth pass and just use a parallax occlusion shader to achieve the second perspective.
Post Reply