PDA

View Full Version : problem with loading HDR image using pbrt



nrst87
02-17-2012, 04:40 AM
Hi everyone
I'm trying to load an HDR image into my program using pbrt libaray( 3rdparty), I include the associated libraries in "Additional include directories" of my solution. I'm using visual studio 2010. here is my code to load the image:
bool loadTexture(const char *path)
{
Imf::Rgba * pixelBuffer;
GLuint width;
GLuint height;
try
{
Imf::RgbaInputFile in(path);

Imath::Box2i win = in.dataWindow();
width = win.max.x - win.min.x+1;
height = win.max.y - win.min.y+1;
Imath::V2i dim(win.max.x - win.min.x + 1,
win.max.y - win.min.y + 1);

pixelBuffer = new Imf::Rgba[dim.x * dim.y];


int dx = win.min.x;
int dy = win.min.y;

int order = in.lineOrder();

in.setFrameBuffer(pixelBuffer - dx - (dy * dim.x), 1, dim.x);
in.readPixels(win.min.y, win.max.y);
}
catch(Iex::BaseExc & e)
{
std::cerr << e.what() << std::endl;

delete[]pixelBuffer;
return false;
}
//GLuint texture;
glGenTextures(1, &amp;texture);
glBindTexture(GL_TEXTURE_2D /*GL_TEXTURE_RECTANGLE*/, texture);

glTexParameteri(GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D , GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D , GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D , GL_TEXTURE_WRAP_T, GL_CLAMP);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

glTexImage2D(GL_TEXTURE_2D , 0, GL_RGBA16F, width, height, 0, GL_RGBA, GL_HALF_FLOAT, pixelBuffer);

delete[]pixelBuffer;
return true;


}

I got this linking errors:
error LNK1120:7 unresoved externals
error LNK2019:unresoved external symbol "int_cdecl Imf::globalTreadCount(void)(?globalTreadCount@Imf@ @yahXZ)refrenced in function "bool_cdeclloadTexture(char const*)"(?loadTexture@@YA_NPBD@Z)
And 4 more linker errors like this.

Thanks in advance!

carsten neumann
02-17-2012, 07:16 AM
This isn't really about OpenGL (also not exactly advanced), a generic C/C++ programming forum might have gotten you a better/faster answer.

The linker tells you what the problem is: None of the libraries you are linking with provides the symbol "Imf::globalTreadCount(void)". AFAIK it should come from one of the OpenEXR libraries (probably libIlmThread.{dll,lib}). You need to link with it.