How to use the terrain engine libmini with Irrlicht

A forum to store posts deemed exceptionally wise and useful
ZDimitor
Posts: 202
Joined: Fri Jul 16, 2004 3:27 am
Location: Russia

Post by ZDimitor »

No!
I told about that:
LibMini terrain scene node generating geometry on a fly (each frame it updates according to the cameras position and rotation) and the snenenodes meshbuffer contain not all geom data of the terrain (just viewable sector of it), neded to collision detection.
zola
Posts: 52
Joined: Thu Jul 15, 2004 2:31 pm
Location: switzerland
Contact:

Post by zola »

:D Collision rescue at hand.

// new header

Code: Select all

#ifndef __CLMTerrainSceneNode_h__
#define __CLMTerrainSceneNode_h__

#include <irrlicht.h>
#include <ministub.hpp>

#pragma comment(lib, "libMini.lib")

namespace irr
{
	namespace scene
	{

		using namespace irr;
		using namespace scene;
		using namespace core;
		using namespace video;

		class CLMTerrainSceneNode : public ISceneNode
		{

		protected:

			//////////////////////////////////////////////////////////////////
			// globals for libMini callbacks
			//////////////////////////////////////////////////////////////////

			// prepares a buffer if the buffer is nonempty draws and then empties the buffer
			// this function needs to be called after stub->draw one more time
			static void _BeginFan();

			// fills the buffer with vertecis
			static void _FanVertex(float i,float y,float j);

			// pointer to the scenenode
			static CLMTerrainSceneNode* _self;

			//////////////////////////////////////////////////////////////////
			
			ministub *stub;
			irr::video::IVideoDriver* driver;
			
			SMesh* mesh;			// a mesh that stores the landscape mesh for a collosion proxy
			SMeshBuffer buffer;		// a buffer for fan vertecis
			S3DVertex vertex;		// a default vertex

			// true iff we want to draw to the mesh and not to the screen
			bool bDrawToMesh;

			// adds the meshbuffer to the mesh when drawing to mesh is enabled
			void addMeshBufferToMesh();

			// draw the meshbuffer
			void BeginFan();
			// add point (i,y,j) to the meshbuffer
			void FanVertex(float i,float y,float j);

			// point spacing
			float dim;
			// height scaling factor
			float scale;
			// pixel width of the heightmap
			s32 size; 
			// resolution
			float res;
			// field of view
			float fovy;
			// aspect ratio
			float aspect;
			// near value
			float nearp;
			// far value
			float farp;

			// the height field
			float *hfield;
			// material
			SMaterial Material;
			// invere of absolute transform to calculate hf coordinates from world coordinates
			matrix4 invAbsoluteTransform;
			// current camera pos in heightfield coordinate
			vector3df pos;
			// current camera target in heightfield coordinate
			vector3df tgt;
			// current camer up in heightfield coordinate
			vector3df up;

			// Bounding box of the heightfield
			mutable aabbox3df Box;

		public:

			// constructor
			CLMTerrainSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id);

			// destructor
			virtual ~CLMTerrainSceneNode();

			/*!
			\brief create the terrain
			\param heightmap, image with height values
			\param texture, texture used for texturing the terrain
			\param detailmap, not used
			\param gridPointSpacing, spacing between the gridpoints of the heightfield
			\param heightScale, scaling value for image height values
			\param resolution, 1000.0f ... 1000000.0f
			*/
			bool create(IImage* heightmap, ITexture* texture, ITexture* detailmap, 
				f32 gridPointSpacing, f32 heightScale, f32 resolution);

			// prerender register node for rendering and call child nodes for registering
			virtual void OnPreRender();

			// render the node
			virtual void render() ;

			// post render, animation etc.
			virtual void OnPostRender(u32 timeMs);

			// get the material with given number
			virtual SMaterial& getMaterial(s32 i)
			{
				return Material;
			}

			// get the boundingbox of the node
			const aabbox3df& getBoundingBox() const
			{
				AbsoluteTransformation.transformBox(Box);
				return Box;
			}

			// get a mesh of the whole terrain for collision detection etc.
			IMesh* getMesh();

			// get the inverse of the absolute transformation
			matrix4& getInvAbsoluteTransformation(){ return invAbsoluteTransform; }

			// get the heightfield data
			f32* getHeightField() { return hfield; }

			// get the length of the square size of the heightfield
			s32 getHeightFieldSize() { return size; }

			// spacing between the sample points
			f32 getPointSpacing() { return dim; }

			// scaling factor to modify the height values
			f32 getHeightScale() { return scale; }

			// get height at grid point (i,j)
			f32 getHeight(int i,int j);

			// get height at heightfield coordinate (x,z) 
			// transformation is inv=AbsoluteTransform.getInverse();
			// inv.transformVect(pos);
			f32 getHeight(float x,float z);

			// get fog height at heightfield coordinate (x,z) 
			// transformation is inv=AbsoluteTransform.getInverse();
			// inv.transformVect(pos);
			f32 getFogHeight(float x,float z);

			// get normal at heightfield coordinate (x,z) 
			// transformation is inv=AbsoluteTransform.getInverse();
			// inv.transformVect(pos);
			vector3df getNormal(float x,float z);

		};

	}

}


#endif
new impl.

Code: Select all

#include "CLMTerrainSceneNode.h"

namespace irr
{

	namespace scene
	{

		using namespace irr;
		using namespace scene;
		using namespace core;
		using namespace video;

		// self pointer for callback
		CLMTerrainSceneNode* CLMTerrainSceneNode::_self=0;
		// prepares a buffer if the buffer is nonempty draws and then empties the buffer
		// this function needs to be called after stub->draw one more time
		void CLMTerrainSceneNode::_BeginFan()
		{
			if(_self) _self->BeginFan();
		}
		// fills the buffer with vertecis
		void CLMTerrainSceneNode::_FanVertex(float i,float y,float j)
		{
			if(_self) _self->FanVertex(i,y,j);
		}

	//////////////////////////////////////////////////////////////////////////


		// constructor
		CLMTerrainSceneNode::CLMTerrainSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id):
		ISceneNode(parent,mgr,id),mesh(0),driver(0)
		{
			driver=SceneManager->getVideoDriver();
			stub=0;
			hfield=0;
			AbsoluteTransformation.getInverse(invAbsoluteTransform);
			AutomaticCullingEnabled=false;
		}

		CLMTerrainSceneNode::~CLMTerrainSceneNode()
		{
			if(stub) delete stub;
			if(hfield) delete [] hfield;
			if(mesh) mesh->drop();
		}

		//! loads the terrain
		bool CLMTerrainSceneNode::create(IImage* heightmap, ITexture* texture, ITexture* detailmap, 
			f32 gridPointSpacing, f32 heightScale, f32 resolution)
		{
			if(stub) delete stub;
			if(hfield) delete [] hfield;

			res=resolution;
			dim=gridPointSpacing;
			scale=heightScale;
			size = heightmap->getDimension().Width;
			hfield = new float[size*size];

			vector3df ext(size*dim,0,size*dim);
			f32 hmin=10000000;
			f32 hmax=-10000000;
			for (int i=0; i<size; i++)
				for (int j=0; j<size; j++)
				{
					hfield[i+j*size] = heightmap->getPixel(i,size-1-j).getRed()*scale;
					if(hmin>hfield[i+j*size]) hmin=hfield[i+j*size];
					if(hmax<hfield[i+j*size]) hmax=hfield[i+j*size];
				}

			//getMesh();

			Box.MinEdge.set(-ext.X/2.0f,hmin,-ext.Z/2.0f);
			Box.MaxEdge.set(ext.X/2.0f,hmax,ext.Z/2.0f);

			stub=new ministub(hfield,
				&size,&dim,1.0f,1.0f,
				CLMTerrainSceneNode::_BeginFan,
				CLMTerrainSceneNode::_FanVertex,
				0,0,0);

			vertex.Normal.set(0,1,0);
			vertex.Color.set(255,255,255,255);

			Material.Texture1=texture;
			Material.Texture2=detailmap;

			bDrawToMesh=true;
			mesh = new SMesh();
			_self=this;
			stub->draw(
				res,					// resolution
				0,2.0f*hmax,0,			// pos 
				0,-1,0,				// dir
				0,0,1,					// up
				-ext.X,					// OTHO fovy
				1,						// aspect
				1,						// near
				ext.X);					
			BeginFan();
			bDrawToMesh=false;

			

			bDrawToMesh=false;

			return true;
		}

		// adds the meshbuffer to the mesh
		void CLMTerrainSceneNode::addMeshBufferToMesh()
		{
			if(buffer.Vertices.size()>0)
			{
				// copy the
				SMeshBuffer* mb=new SMeshBuffer();
				u32 n=buffer.Vertices.size();

				for(u32 i=0; i<n; i++)
				{
					// add vertex
					mb->Vertices.push_back(buffer.Vertices[i]);
					
					if(i>1)
					{
						mb->Indices.push_back(0);
						mb->Indices.push_back(i-1);
						mb->Indices.push_back(i);
					}
				}
				mb->Indices.push_back(0);
				mb->Indices.push_back(n-1);
				mb->Indices.push_back(1);

				mesh->addMeshBuffer(mb);
				mb->drop();
			}
		}

		// prepares a buffer if the buffer is nonempty draws and then empties the buffer
		// this function needs to be called after stub->draw one more time
		void CLMTerrainSceneNode::BeginFan()
		{
			if(buffer.Vertices.size()>0)
			{	
				if(driver )
				{
					if(bDrawToMesh)
						addMeshBufferToMesh();
					else
						driver->drawIndexedTriangleFan(
							buffer.Vertices.const_pointer(),
							buffer.Vertices.size(),
							buffer.Indices.const_pointer(),
							buffer.Indices.size()-2);

					buffer.Vertices.set_used(0);
					buffer.Indices.set_used(0);
				}
			}
		}
		// fills the buffer with vertecis
		void CLMTerrainSceneNode::FanVertex(float i,float y,float j)
		{
			vertex.Pos.set(dim*i-size/2*dim, y, size/2*dim-dim*j);
			vertex.TCoords.set((float)i/(size-1),(float)j/(size-1));
			buffer.Indices.push_back(buffer.Indices.size());
			buffer.Vertices.push_back(vertex);
		}

		IMesh* CLMTerrainSceneNode::getMesh()
		{
			return mesh;
		}

		void CLMTerrainSceneNode::OnPreRender()
		{
			if(IsVisible)
				SceneManager->registerNodeForRendering(this,SNRT_DEFAULT);
			
			ISceneNode::OnPreRender();

			AbsoluteTransformation.getInverse(invAbsoluteTransform);
		}

		void CLMTerrainSceneNode::render()
		{
			ICameraSceneNode* camera=SceneManager->getActiveCamera();
			driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);


			if(stub && camera)
			{

				aspect = camera->getAspectRatio();
				fovy = f32(GRAD_PI)*camera->getFOV();
				nearp = camera->getNearValue();
				farp = camera->getFarValue();
				
				pos.set(camera->getPosition());
				tgt.set(camera->getTarget());
				up.set(camera->getUpVector());

				invAbsoluteTransform.transformVect(pos);
				invAbsoluteTransform.transformVect(tgt);
				invAbsoluteTransform.transformVect(up);

				vector3df dx=tgt-pos;
				if(dx.getLengthSQ()==0.0)
				{
					dx.Z=-1.0f;
				}
				// make callbacks to this scenenode :)
				_self=this;
				
				driver->setMaterial(Material);

				stub->draw(res,
					pos.X,pos.Y,pos.Z,
					dx.X,dx.Y,dx.Z,
					up.X,up.Y,up.Z,
					2.0f*fovy,
					aspect,
					nearp,
					farp);

				BeginFan();

				if(DebugDataVisible)
				{
					SMaterial mat;
					mat.Lighting=false;
					mat.Wireframe=true;
					mat.FogEnable=false;
					mat.EmissiveColor=SColor(255,0,0,0);
					mat.MaterialType=EMT_SOLID;
					driver->setMaterial(mat);
					driver->draw3DBox(Box, SColor(255,0,0,255));
					
					if(mesh)
						for(int i=0;i<mesh->getMeshBufferCount();i++)
							driver->drawMeshBuffer(mesh->getMeshBuffer(i));
					
				}
				

			}
		}

		void CLMTerrainSceneNode::OnPostRender(u32 timeMs)
		{
			ISceneNode::OnPostRender(timeMs);
			
		}


		f32 CLMTerrainSceneNode::getHeight(int i,int j)
		{
			if(stub)
				return stub->getheight(i,j);
			else
				return 0;
		}

		f32 CLMTerrainSceneNode::getHeight(float x,float z)
		{
			if(stub)
				return stub->getheight(x,z);
			else
				return 0;
		}

		f32 CLMTerrainSceneNode::getFogHeight(float x,float z)
		{
			if(stub)
				return stub->getfogheight(x,z);
			else
				return 0;
		}

		vector3df CLMTerrainSceneNode::getNormal(float x,float z)
		{
			vector3df n(0,1,0);
			if(stub)
			{
				f32 nx,ny,nz;
				stub->getnormal(x,z,&nx,&ny,&nz);
				n.set(nx,ny,nz);
			}
			return n;
		}


	}
}
terrain height following animator

Code: Select all

#ifndef CTERRAINHEIGHTANIMATOR_H_INCLUDED
#define CTERRAINHEIGHTANIMATOR_H_INCLUDED

#include <irrlicht.h>
#include "CLMTerrainSceneNode.h"

namespace irr
{
	namespace scene
	{
		// animator that clamps the animated node to the terrain height
		class CTerrainHeightAnimator : public ISceneNodeAnimator
		{
		protected:

			// the terrian node
			CLMTerrainSceneNode* d_terrain;
			// minimal height over ground
			f32 d_h;
			// fit the height of the node or let it fly
			bool d_fit;
			
			// to speed things up a little  some cached memory, 
			// so anim node doesn't have to allocate everytime
			matrix4 Trans;
			matrix4 invTrans;
			vector3df pos;
		public:

			/*!
			\brief constructor
			\param terrain, the terrain we want to follow
			\param h, min height over ground
			\param fit, if true the clamp height to terrain height otherwise allow to fly
			*/
			CTerrainHeightAnimator(CLMTerrainSceneNode* terrain, f32 h, bool fit)
				: d_terrain(terrain),d_h(h),d_fit(fit)
			{ }

			// destructor
			virtual ~CTerrainHeightAnimator(){}

			//! Animates a scene node.
			//! \param node: Node to animate.
			//! \param timeMs: Current time in milli seconds.
			virtual void animateNode(ISceneNode* node, u32 timeMs)
			{
				pos.set(node->getPosition());

				Trans=d_terrain->getAbsoluteTransformation();
				
				Trans.getInverse(invTrans);
				invTrans.transformVect(pos);

				float h = d_terrain->getHeight(pos.X,pos.Z)+d_h;
				pos.Y = d_fit ? h : (pos.Y > h ? pos.Y : h);

				Trans.transformVect(pos);
				node->setPosition(pos);
			}
		};
	}
}


#endif
for collisions just get the whole terrain mesh after you created the terrain

Code: Select all

IMesh* mesh=terrain->getMesh();
and do what ever fancy things you'd like to do with the mesh but do not drop() it ;)

The interface to create the terrain and the collision mesh is currently just one function "create(...)" this might turn out not to be enough because the collision mesh will have the same resolution as the terrain.

Cheers
Tom
zola
Posts: 52
Joined: Thu Jul 15, 2004 2:31 pm
Location: switzerland
Contact:

Post by zola »

ZDimitor wrote:No!
I told about that:
LibMini terrain scene node generating geometry on a fly (each frame it updates according to the cameras position and rotation) and the snenenodes meshbuffer contain not all geom data of the terrain (just viewable sector of it), neded to collision detection.
If You only need to follow the height you can use the animator / or similar to place your object on the terrain. this works even for terrain sectors not in the viewfrustrum.

If You happen to need a mesh for the terrain the You can get it now with the new function IMesh* CLMTerrainSceneNode ::getMesh()
ZDimitor
Posts: 202
Joined: Fri Jul 16, 2004 3:27 am
Location: Russia

Post by ZDimitor »

Yes!!!!!!!!!!!!
You're the best!
Aloha

Post by Aloha »

hey,
can someone maybe post a package of those files? maybe zip or something? 8) Would be much appreciated.....hehe
Guest

Post by Guest »

i still cannot get it to run :cry: i compiled mini, i linked everything right i guess, i cannot see whats wrong, but it still get this errors:

Code: Select all



../../Irrlicht/extern/libmini/libMini.a(mini.o)(.text$_ZN7miniOGL8beginfanEv+0x16):mini.cpp: undefined reference to `glEnd@0'
../../Irrlicht/extern/libmini/libMini.a(mini.o)(.text$_ZN7miniOGL8beginfanEv+0x22):mini.cpp: undefined reference to `glBegin@4'

../../Irrlicht/extern/libmini/libMini.a(mini.o)(.text$_ZN7miniOGL5colorEffff+0x22):mini.cpp: undefined reference to `glColor4f@16'
../../Irrlicht/extern/libmini/libMini.a(mini.o)(.text$_ZN7miniOGL9fanvertexEfff+0x1b):mini.cpp: undefined reference to `glVertex3f@12'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x16):miniOGL.cpp: undefined reference to `glGetIntegerv@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x2d):miniOGL.cpp: undefined reference to `glGetBooleanv@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x3c):miniOGL.cpp: undefined reference to `glDepthFunc@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x4b):miniOGL.cpp: undefined reference to `glEnable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x62):miniOGL.cpp: undefined reference to `glGetIntegerv@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x79):miniOGL.cpp: undefined reference to `glGetIntegerv@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x90):miniOGL.cpp: undefined reference to `glGetBooleanv@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x9f):miniOGL.cpp: undefined reference to `glFrontFace@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0xae):miniOGL.cpp: undefined reference to `glCullFace@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0xbd):miniOGL.cpp: undefined reference to `glEnable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0xd4):miniOGL.cpp: undefined reference to `glGetBooleanv@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0xeb):miniOGL.cpp: undefined reference to `glGetBooleanv@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x112):miniOGL.cpp: undefined reference to `glColorMask@16'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x121):miniOGL.cpp: undefined reference to `glDepthMask@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x138):miniOGL.cpp: undefined reference to `glGetBooleanv@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x14f):miniOGL.cpp: undefined reference to `glGetIntegerv@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x166):miniOGL.cpp: undefined reference to `glGetIntegerv@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x175):miniOGL.cpp: undefined reference to `glDisable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x197):miniOGL.cpp: undefined reference to `glColor3f@12'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x1d9):miniOGL.cpp: undefined reference to `glDepthFunc@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x1f1):miniOGL.cpp: undefined reference to `glDisable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x20d):miniOGL.cpp: undefined reference to `glFrontFace@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x229):miniOGL.cpp: undefined reference to `glCullFace@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x241):miniOGL.cpp: undefined reference to `glDisable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x274):miniOGL.cpp: undefined reference to `glColorMask@16'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x286):miniOGL.cpp: undefined reference to `glDepthMask@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x2a8):miniOGL.cpp: undefined reference to `glBlendFunc@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x2b7):miniOGL.cpp: undefined reference to `glEnable@4'

../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x2ce):miniOGL.cpp: undefined reference to `glDisable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x2e6):miniOGL.cpp: undefined reference to `glEnable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x2fe):miniOGL.cpp: undefined reference to `glDepthMask@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x316):miniOGL.cpp: undefined reference to `glDepthMask@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x346):miniOGL.cpp: undefined reference to `glColorMask@16'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x376):miniOGL.cpp: undefined reference to `glColorMask@16'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x3a6):miniOGL.cpp: undefined reference to `glColorMask@16'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x3c6):miniOGL.cpp: undefined reference to `glBlendFunc@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x3d5):miniOGL.cpp: undefined reference to `glEnable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x3f4):miniOGL.cpp: undefined reference to `glBlendFunc@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x403):miniOGL.cpp: undefined reference to `glEnable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x437):miniOGL.cpp: undefined reference to `wglGetProcAddress@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x463):miniOGL.cpp: undefined reference to `glEnable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x48d):miniOGL.cpp: undefined reference to `wglGetProcAddress@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x4cc):miniOGL.cpp: undefined reference to `glDisable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x534):miniOGL.cpp: undefined reference to `glGetString@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x583):miniOGL.cpp: undefined reference to `glGenTextures@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x599):miniOGL.cpp: undefined reference to `glBindTexture@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x5b0):miniOGL.cpp: undefined reference to `glPixelStorei@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x5f6):miniOGL.cpp: undefined reference to `gluBuild2DMipmaps@28'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x638):miniOGL.cpp: undefined reference to `gluBuild2DMipmaps@28'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x65e):miniOGL.cpp: undefined reference to `glGetTexLevelParameteriv@16'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x684):miniOGL.cpp: undefined reference to `glGetTexLevelParameteriv@16'

../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x69b):miniOGL.cpp: undefined reference to `glBindTexture@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x772):miniOGL.cpp: undefined reference to `glGetString@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x7cc):miniOGL.cpp: undefined reference to `glGetIntegerv@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x7e2):miniOGL.cpp: undefined reference to `glBindTexture@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x801):miniOGL.cpp: undefined reference to `glTexEnvi@12'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x820):miniOGL.cpp: undefined reference to `glTexParameteri@12'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x83f):miniOGL.cpp: undefined reference to `glTexParameteri@12'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x85e):miniOGL.cpp: undefined reference to `glTexParameteri@12'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x87d):miniOGL.cpp: undefined reference to `glTexParameteri@12'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x8a4):miniOGL.cpp: undefined reference to `glGetFloatv@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x8c2):miniOGL.cpp: undefined reference to `glTexParameterfv@12'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x951):miniOGL.cpp: undefined reference to `glTexGeni@12'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x970):miniOGL.cpp: undefined reference to `glTexGeni@12'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x98e):miniOGL.cpp: undefined reference to `glTexGenfv@12'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x9ac):miniOGL.cpp: undefined reference to `glTexGenfv@12'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x9bb):miniOGL.cpp: undefined reference to `glEnable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x9ca):miniOGL.cpp: undefined reference to `glEnable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x9e1):miniOGL.cpp: undefined reference to `glGetBooleanv@8'

../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0x9f0):miniOGL.cpp: undefined reference to `glEnable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0xa0a):miniOGL.cpp: undefined reference to `glBindTexture@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0xa22):miniOGL.cpp: undefined reference to `glDisable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0xa31):miniOGL.cpp: undefined reference to `glDisable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0xa40):miniOGL.cpp: undefined reference to `glDisable@4'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0xa6d):miniOGL.cpp: undefined reference to `glDeleteTextures@8'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0xa7d):miniOGL.cpp: undefined reference to `glPushMatrix@0'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0xa8b):miniOGL.cpp: undefined reference to `glPopMatrix@0'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0xaad):miniOGL.cpp: undefined reference to `glScalef@12'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0xad1):miniOGL.cpp: undefined reference to `glTranslatef@12'
../../Irrlicht/extern/libmini/libMini.a(miniOGL.o)(.text+0xb04):miniOGL.cpp: undefined reference to `glEnd@0'
iam using devc++, anyone knows an idea about this ? :?
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

you compiled the libmini with the parameter -DNOOGL
so libmini kicks out all OpenGL things ?
brcolow
Posts: 56
Joined: Mon Jul 19, 2004 6:15 am
Location: Arizona

Post by brcolow »

I am unfortunatley getting these same errors. I compiled it with VC++ 2003 .NET in Release mode, and I there is no -DNOOGL in my compile options.

Help!

Thanks,
Mike
G'Day.
zola -

Post by zola - »

I'm using vc2003 too You have to add NOOGL in the preprocessor definitions:
Project Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions
add ";NOOGL" and recompile

lib mini actually just worked out of the box for me. unzipped doubleclicked on the vc6 project converted it and compiled.

I hope this help .
Guest

Post by Guest »

Alright I did that. But now, when intergrating into my app, I get a bunch of default lib errors. I can't use NODEFAULTLIB though, because I need those libs for other things.

:(
brcolow
Posts: 56
Joined: Mon Jul 19, 2004 6:15 am
Location: Arizona

Post by brcolow »

Oops, that was me ^
G'Day.
zola -

Post by zola - »

I'm no expert with using default libs etc.
I assume You tried with /NODEFAULTLIB and it still produced the link errors. I'm sorry but in this case I just run out of suggestions ;)

I guess there should be a possibility to say whether You want LIBC or MSVCRT as default lib but I don't know where.
zola
Posts: 52
Joined: Thu Jul 15, 2004 2:31 pm
Location: switzerland
Contact:

Post by zola »

try putting "/Zl" into your libmini project

"the project's Property Pages" -> " C/C++ " -> " Command Line" -> /Zl

/Zl : This option omits the default library name from the .obj file.
UzMaN
Posts: 3
Joined: Fri Oct 29, 2004 11:50 pm

Post by UzMaN »

i load a detail texture and pass it as a parameter of terrain->create,but it doesn't seem to be applied as second layer,perhaps it is applied but i can't see,
i want to tile the second layer so that it does what i expected,how can i do it?,i mean on the terrain texture,detail texture will be N x N tileset so that detail can be seen.
thanks :]
brcolow
Posts: 56
Joined: Mon Jul 19, 2004 6:15 am
Location: Arizona

Post by brcolow »

Linking...
LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
LIBCMT.lib(fpinit.obj) : error LNK2005: __ldused already defined in LIBCMT.lib(fpinit.obj)
LIBCMT.lib(fpinit.obj) : error LNK2005: __fltused already defined in LIBCMT.lib(fpinit.obj)
LIBCMT.lib(_ctype.obj) : error LNK2005: _isalpha already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(_ctype.obj) : error LNK2005: _isspace already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(_ctype.obj) : error LNK2005: _isalnum already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(isctype.obj) : error LNK2005: __isctype already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(setlocal.obj) : error LNK2005: _setlocale already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(strftime.obj) : error LNK2005: _strftime already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(exsup.obj) : error LNK2005: __except_list already defined in MSVCRTD.lib(dllsupp.obj)
LIBCMT.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(atox.obj) : error LNK2005: _atoi already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(getenv.obj) : error LNK2005: _getenv already defined in MSVCRTD.lib(MSVCR71D.dll)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in LIBCMT.lib(crt0init.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in LIBCMT.lib(crt0init.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in LIBCMT.lib(crt0init.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in LIBCMT.lib(crt0init.obj)
LIBCMT.lib(tolower.obj) : error LNK2005: _tolower already defined in MSVCRTD.lib(MSVCR71D.dll)
MSVCRTD.lib(MSVCR71D.dll) : error LNK2005: __strnicmp already defined in LIBCMT.lib(strnicmp.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib 'LIBC' conflicts with use of other libs; use /NODEFAULTLIB:library
Release/OninWars.exe : fatal error LNK1169: one or more multiply defined symbols found
G'Day.
Post Reply