Thomas Lock
2006-03-29 19:49:40 UTC
Hi Everyone
I would like to expose the reading and writing of EXR files
to other languages that i use, but nothing i have tried works as of yet. So
here is my problem. I'm using Visual C++ 2005 EE. As i am still pretty new
to C++ what headers do i need to call, i'm just guessing cause i can't find
a single document that tells me this. All i want to do is be able to read
and write Rgba files for now, and make it a simple as possible.
my code for reading. Writing is simple the reverse function of this.
extern "C" void WINAPI writeOpenEXR (char *filename, int width, int height,
float* Bits128)
{
using namespace Imf;
using namespace Imath;
int i=0;
const char fileName[]=&filename[0];
int bitcount=width*4*height;
int LineWidth=width*4;
Array2D<Rgba> p2 (width, height);
for(int h=0;h<height;h++)for(int b=0;b<width;b++)
{
i=h*LineWidth+(b<<2);
p2[b][h].b=half::half(Bits128[i]);
p2[b][h].g=half::half(Bits128[i + 1]);
p2[b][h].r=half::half(Bits128[i + 2]);
//Still have to fix alpha to be precalculated but don't care about
that at this time since i can't do anything yet.
p2[b][h].a=half::half(Bits128[i + 3]);
}
// ALL CODE FROM THIS POINT ON JUST CAUSES APPS TO CRASH TEST BY REMING
OUT THE LAST THREE LINES
RgbaOutputFile file ("c:\foo.exr", width, height, WRITE_RGBA); // 1
//EVEN WHEN THESE LAST FUNCTION ARE REMOVED IT STILL FAILS
file.setFrameBuffer (&p2[-height][0], 1, width); // 2
file.writePixels (height); // 3
}
WARNING/ERROR MESSAGES
D:\OpenEXR plugin\EXR\include\IlmImf\ImfName.h(103) : warning C4996:
'strncpy' was declared deprecated
C:\Program Files\Microsoft Visual Studio 8\VC\include\string.h(156)
: see declaration of 'strncpy'
Message: 'This function or variable may be unsafe. Consider using
strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See
online help for details.'
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(215) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(247) : see reference
to class template instantiation 'Imath::Vec2<T>' being compiled
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(219) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(408) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(440) : see reference
to class template instantiation 'Imath::Vec3<T>' being compiled
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(412) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(215) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(483) : see reference
to class template instantiation 'Imath::Vec2<T>' being compiled
with
[
T=short
]
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(219) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(489) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(498) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(215) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(507) : see reference
to class template instantiation 'Imath::Vec2<T>' being compiled
with
[
T=int
]
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(219) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(513) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(522) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(408) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(531) : see reference
to class template instantiation 'Imath::Vec3<T>' being compiled
with
[
T=short
]
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(412) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(537) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(546) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(408) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(555) : see reference
to class template instantiation 'Imath::Vec3<T>' being compiled
with
[
T=int
]
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(412) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(561) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(570) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(902) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(939) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(1318) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(1357) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(215) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\IlmImf\ImfHeader.h(76) : see reference
to class template instantiation 'Imath::Vec2<T>' being compiled
with
[
T=float
]
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(219) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
.\EXR.cpp(62) : error C2065: 'file' : undeclared identifier
.\EXR.cpp(62) : error C2228: left of '.dataWindow' must have
class/struct/union
type is ''unknown-type''
Build log was saved at "file://d:\OpenEXR plugin\EXR\Release\BuildLog.htm"
EXR - 2 error(s), 27 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I would like to expose the reading and writing of EXR files
to other languages that i use, but nothing i have tried works as of yet. So
here is my problem. I'm using Visual C++ 2005 EE. As i am still pretty new
to C++ what headers do i need to call, i'm just guessing cause i can't find
a single document that tells me this. All i want to do is be able to read
and write Rgba files for now, and make it a simple as possible.
my code for reading. Writing is simple the reverse function of this.
extern "C" void WINAPI writeOpenEXR (char *filename, int width, int height,
float* Bits128)
{
using namespace Imf;
using namespace Imath;
int i=0;
const char fileName[]=&filename[0];
int bitcount=width*4*height;
int LineWidth=width*4;
Array2D<Rgba> p2 (width, height);
for(int h=0;h<height;h++)for(int b=0;b<width;b++)
{
i=h*LineWidth+(b<<2);
p2[b][h].b=half::half(Bits128[i]);
p2[b][h].g=half::half(Bits128[i + 1]);
p2[b][h].r=half::half(Bits128[i + 2]);
//Still have to fix alpha to be precalculated but don't care about
that at this time since i can't do anything yet.
p2[b][h].a=half::half(Bits128[i + 3]);
}
// ALL CODE FROM THIS POINT ON JUST CAUSES APPS TO CRASH TEST BY REMING
OUT THE LAST THREE LINES
RgbaOutputFile file ("c:\foo.exr", width, height, WRITE_RGBA); // 1
//EVEN WHEN THESE LAST FUNCTION ARE REMOVED IT STILL FAILS
file.setFrameBuffer (&p2[-height][0], 1, width); // 2
file.writePixels (height); // 3
}
WARNING/ERROR MESSAGES
D:\OpenEXR plugin\EXR\include\IlmImf\ImfName.h(103) : warning C4996:
'strncpy' was declared deprecated
C:\Program Files\Microsoft Visual Studio 8\VC\include\string.h(156)
: see declaration of 'strncpy'
Message: 'This function or variable may be unsafe. Consider using
strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See
online help for details.'
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(215) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(247) : see reference
to class template instantiation 'Imath::Vec2<T>' being compiled
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(219) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(408) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(440) : see reference
to class template instantiation 'Imath::Vec3<T>' being compiled
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(412) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(215) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(483) : see reference
to class template instantiation 'Imath::Vec2<T>' being compiled
with
[
T=short
]
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(219) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(489) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(498) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(215) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(507) : see reference
to class template instantiation 'Imath::Vec2<T>' being compiled
with
[
T=int
]
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(219) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(513) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(522) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(408) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(531) : see reference
to class template instantiation 'Imath::Vec3<T>' being compiled
with
[
T=short
]
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(412) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(537) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(546) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(408) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(555) : see reference
to class template instantiation 'Imath::Vec3<T>' being compiled
with
[
T=int
]
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(412) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(561) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(570) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(902) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(939) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(1318) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(1357) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(215) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
D:\OpenEXR plugin\EXR\include\IlmImf\ImfHeader.h(76) : see reference
to class template instantiation 'Imath::Vec2<T>' being compiled
with
[
T=float
]
D:\OpenEXR plugin\EXR\include\Imath\ImathVec.h(219) : warning C4290: C++
exception specification ignored except to indicate a function is not
__declspec(nothrow)
.\EXR.cpp(62) : error C2065: 'file' : undeclared identifier
.\EXR.cpp(62) : error C2228: left of '.dataWindow' must have
class/struct/union
type is ''unknown-type''
Build log was saved at "file://d:\OpenEXR plugin\EXR\Release\BuildLog.htm"
EXR - 2 error(s), 27 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========