Sign in to follow this  
treeway

OpenGL DevIL and DirectX

Recommended Posts

Hi Im trying to use DevIL to load textures into my DirectX/OpenGL program (I'm not using D3DX). I'm getting a link error saying the function
#pragma comment(lib, "..\\dependencies\\DevIL\\DevIL.lib")
#pragma comment(lib, "..\\dependencies\\DevIL\\ILU.lib")
#pragma comment(lib, "..\\dependencies\\DevIL\\ILUT.lib")

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

#include <IL\il.h>
#include <IL\ilu.h>
#include <IL\ilut.h>

#ifdef _CGE_OPENGL /// _CGE_OPENGL IS NOT DEFINED FOR THE DIRECTX BUILD
	#ifndef ILUT_USE_OPENGL
		#define ILUT_USE_OPENGL
	#endif
#else
	#ifndef ILUT_USE_DIRECTX9
		#define ILUT_USE_DIRECTX9
	#endif
#endif

....

CGE_Game::Initialise()
{
		CGparameter tmpParam = cgGetNamedEffectParameter(CgEffect.mCGeffect, "diffuse_sampler");
#ifdef _CGE_OPENGL

ILuint ImgId;										// The Image Name

	ilGenImages(1, &ImgId);								// Generate Image Name
	ilBindImage(ImgId);									// Bind Image Name to Be Current
	if (!ilLoadImage(getMedia("X\\tiny_skin.bmp"))) {				// Load the Bitmap and Check for Errors
		ilDeleteImages(1, &ImgId);						// If Could Not Load, Delete Image
		//return FALSE;									//  and Return False
	}

	int texture = ilutGLBindTexImage();					// Send the Image to OpenGL
	
		
	ilDeleteImages(1, &ImgId);	
	
	
	cgGLSetupSampler(tmpParam, texture);
#else

	LPDIRECT3DTEXTURE9 pTex;
	ilutD3D9TexFromFile(Renderer->D3DDevice,(char*)getMedia("X\\tiny_skin.bmp"),&pTex);

	cgD3D9SetupSampler(tmpParam,pTex);
#endif
}


This works fine in the OpenGL build but when compiled for DirectX, I get a linker error saying :
Error	63	error LNK2019: unresolved external symbol __imp__ilutD3D9TexFromFile@12 referenced in function "public: virtual int __thiscall CGE_Game::initialise(void)" (?initialise@CGE_Game@@UAEHXZ)	CGE_Game.obj



i.e. ilutD3D9TexFromFile is unavailable. Can anyone see where the link could be going wrong? thanks.

Share this post


Link to post
Share on other sites
Looks like one of the .lib files (Presumably ILUT.lib) can't be found for some reason. Is it where it should be? What if you (for testing) put it in the same directory as your solution file and don't use a full path to it?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this