- December 31, 2008 at 6:34 am #29659
I know how to export the .max file to .pod or .h file, but the .h file that I exported is different from the .h file of the demo or TrainingCourse. The version what i use is 2.02 OGLES-1.1. I also downloaded the version 2.03, and find the file is not .h but .cpp. Now the problem come out , how can I generate the .cpp or .pvr file?
What I do is export the .h file from 3dmax. And another question is how to export a image to a .h file. I can’t fine the guide or training course. Please me some suggestion.ThanksAresDecember 31, 2008 at 10:58 am #32559
For images use PVRTexTool – it has a mode to export to a C/C++ h style file.January 30, 2009 at 10:54 am #32560
Hello,The files in our SDK are binary PODs and PVRs which has been converted to .cpp by our FileWrap utility. This utility is used to integrate the binary resources into a single executable. Look at the SDK User Guide for some instructions on how FileWrap operates.Best regards.Carlos.May 20, 2009 at 9:34 am #32561
hello allI can’t create .cpp file from FileWrap, please tell me the way to create .cpp file from FileWarp step by step. I don’t find how to create cpp file using filewrap in SDK user Guidethank!
phancuong87 2009-05-20 10:01:10May 20, 2009 at 2:59 pm #32562
Yes, you are right. I have checked it and by mistake this section is not in our User Guide for OpenGL ES 1.1 although it is in the OpenGLES 2.0 one. We will fix this problem. In the meant time I have copied below the section that should have been in the document.
Memory File System and FileWrap
All file read access in the PVRTools library uses the CPVRTResourceFile class. This not only simplifies code, it also allows the use of a “memory file system”. Any file can be statically linked into the application and looked up by name at run time. This is useful for platforms without a file system and keeps all the required data in one place, the application executable.
When looking for a file, CPVRTResourceFile will first look in the read path the application set by calling CPVRTResourceFile::SetReadPath. This is usually a platform dependent path which can be obtained from PVRShell. If the file is not there, CPVRTResourceFile will look for the file in the memory file system. This way “internal” files linked in the executable can be overridden by external ones. When using the memory file system filenames passed to PVRTools, functions should always be given without a path.
Using the Memory File System in your own Projects
In order to use the memory file system in your own projects, you need to link to the PVRTools library. Furthermore, you need to turn the files you want to add into C++ sources using the Filewrap utility. Typically this would be done with a command line like this:
filewrap â€“o Memfilesystem.cpp file1 file2 file3 …
Note that the name of the .cpp file is not important; the files will be registered in the memory file system under their original name (in this case file1, file2, file3). You can also generate multiple .cpp files and compile them into the same application. However, the memory file system is just a list of files without any directory structure, so make sure not to use duplicate file names within an application.
After you have generated the .cpp files, all you need to do is add them to your project like you would add other C++ source files. Now you are ready to use CPVRTResourceFile to read files from the memory file system. Of course this wrapping can also be automated using makefiles or custom build steps in Visual Studio projects.
To automate Filewrap using custom build steps in Visual Studio, first add the file you want in the memory file system to your project (“Add existing itemâ€¦”). Then select this file in the Solution Explorer and open the property page for it. Choose “All Configurations”, and then select “Custom Build Step”.
Set “Command Line” to:
Filewrap.exe -o “$(InputDir)Outputfile.cpp” “$(InputPath)”
Set “Outputs” to:
Make sure Filewrap.exe is on your PATH environment variable or use an absolute path to Filewrap.exe. Replace Outputfile.cpp with a file name of your choice.
Following this, close the property page, right-click on the file and select “Compile”. This should produce the .cpp file which you should also add to your project.