Jump to content
  • Advertisement
Sign in to follow this  
treeway

OpenGL DevIL and DirectX

This topic is 3597 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!