diff --git a/samples/DevIL/AUTHORS b/samples/DevIL/AUTHORS new file mode 100644 index 000000000..0f80b3c4a --- /dev/null +++ b/samples/DevIL/AUTHORS @@ -0,0 +1,4 @@ +The main programmer is Denton Woods, but this could not have been possible +without contributions and some pieces of code from other projects. + +For contributors and credits, read the CREDITS file. diff --git a/samples/DevIL/COPYING b/samples/DevIL/COPYING new file mode 100644 index 000000000..30c8ca213 --- /dev/null +++ b/samples/DevIL/COPYING @@ -0,0 +1,506 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + + + diff --git a/samples/DevIL/CREDITS b/samples/DevIL/CREDITS new file mode 100644 index 000000000..b30dc4685 --- /dev/null +++ b/samples/DevIL/CREDITS @@ -0,0 +1,264 @@ +Credits as of 02/06/2009 +------------------------ + +If I inadvertently omitted anyone's name from this list, please e-mail me at +doomwiz@users.sourceforge.net to remedy the problem. + + +James Joplin, alias jayjay (rjoplin@webzone.net) +for all his invaluable help and encouragement with DevIL. + +Edouard Gomez for his invaluable help. + +All the #flipCode gang for their support. + +All my friends at uni for their support. + +SoftImage .pic support based off of code obtained from +http://www.swin.edu.au/astronomy/pbourke/dataformats/ + +TestPic, used in TestIL +http://www.paintlib.de/paintlib/testpic.zip + +Png Test Images +http://www.schaik.com/pngsuite/pngsuite.html + +John Villar (john.villar@eliaschev.com) for making the suggestion of not +letting the user use ILimage structs but instead binding images like OpenGL. +He also made a suggestion on how to load luminance .jpg images, along with +other suggestions. + +http://www.opengl.org/Coding/KilgardTechniques/oglpitfall/oglpitfall.html +section 6 for the values the NTSC uses, so I could convert from coloured +images to luminance values. + +Kodak Photo CD code from the .pcd link on http://www.wotsit.org. + +Foper (foper@hotmail.com) from #flipCode for supplying the excellent +flipcode.jpg in testil\in. The original can be found at +http://webpatterns.com/flip/flipshow.htm + +Lightman (cdthompson@home.net) from #flipCode for restructuring the project +into /bin, /obj, etc. + +Alexander Blach (alexander@abee.de) from #flipCode for creating the Delphi +headers and test app. He figured out that we needed to use .def files to +prevent name decoration of the dlls. He has contributed multiple ideas and +found flaws. Alexander also created a lovely documentation database to help +with documenting DevIL. + +Randy Heit for finding problems in my Doom texture code. + +Oliver Kurowski (oliver.kurowski@gmx.de) for locating a bug in ilut's +DllMain() and another very harmful bug with ilDeleteImages(). + +Ender Wiggin's article on "Elementary Digital Filtering", +found at http://www.gamedev.net/reference/programming/features/edf/ +for many filters in DevIL. + +SGI's "Graphica Obscura" site at http://www.sgi.com/grafica/matrix/index.html +for several filters in DevIL. + +The http://bae.fse.missouri.edu/luw/course/image/project1/project1.html +page for help in determining filter code for Graphica Obscura's interpolation +article at http://www.sgi.com/grafica/interp/index.html. + +Matt Denham for suggesting optimizations in ilNegativeImage(), +iluEdgeDetectS() and iluEdgeDetectP(). + +Timo Heister (Timo-Heister@gmx.de) from #flipCode for creating the original +Visual Basic headers and test apps for VB. + +The OpenGL SuperBible for code for ilutGetHPal(). + +DJ Luminescent (luminescent@uswest.net) for finding a couple of bugs in the +.bmp-loading code and diligently beta testing. + +Lionel Brits, alias Zaewo from #flipCode for slapping me around and telling +me how Microsoft does their .bmp padding. He then wrote most of the +iluEqualize() code from the base code on +http://www.manning.com/Kabir/Files.html . + +Joel Wilsson, alias Siigron (siigron@hotmail.com) for pointing-out several +design flaws that I (Denton) had introduced and posing very useful +suggestions. + +Sean Montgomery, alias Vapor (sean@astralfx.com) for patiently listening to +my endless drivel about DevIL. + +Perlin Noise site http://freespace.virgin.net/hugo.elias/models/m_perlin.htm +for information on interpolation used in iluScale(). + +Shimon Shvartsbroit, alias MasterBoy (cobra11@netvision.net.il) from #flipCode +for explaining bilinear interpolation to me. + +Lbm source from http://www.wotsit.org + +Eran Kampf, alias ttentacle (ekampf@internet-zahav.net) for giving me +resource-loading code for ilutLoadResource and helping with the Windows +clipboard functions. + +Strumpf from #flipCode for writing a really good DirectDraw class for me to +use in the DDraw test, which is based off of his test, too. + +NullSoft (http://www.nullsoft.com), for their SuperPiMP installer. It is +extremely easy to learn to use and very powerful. + +Serun from #flipCode for noticing that Quake2 .pcx files sometimes don't have +the checksum byte for palette'd .pcx files. + +Conor Stokes, aka DirtyPunk from #flipCode for helping explain several things +to me. + +Half-Life model viewer sources (at http://www.swissquake.ch/chumbalum-soft/) +for specs for the Half-Life model format. + +Rich Schwab, alias endura (endura29@hotmail.com) for contributing +girlfriend.cpp. + +The Djgpp libc sources (http://www.delorie.com/djgpp), from where I copied +several functions. + +Roman Podobedov (romka@ut.ee) of Romka Graphics (http://romka.demonews.com) +for his colour quantization sources, which he was kind enough to let me use. + +Pcx document on http://www.wotsit.org for .pcx saving code. + +http://www-classic.be.com/aboutbe/benewsletter/volume_III/Issue2.html#Insight +for iluWave(). + +.lif specs from http://www.infinite-mass.com/bob/files/lifed.zip and + http://www.infinite-mass.com/bob/files/lif.zip + +Rune Kock (rune@vupti.com) for writing the new Visual Basic headers and for +finding a return bug in iluScaleAdvanced. + +Julien Verchere and Xavier Decoret for suggesting that I use const char*'s +instead of char*'s as function parameters. + +Jason Reeve (jason@retribution-entertainment.com) for finding a bug in iluCrop, +several origin-related problems, and helping me bring my targa-loading code up +to spec. + +Darren Adams for telling me the #pragmas to use in MSVC++ to disable the +console window in a "console app". + +David Gould for getting onto me about my crappy Linux support. + +David Galeano for his DX8 Surface to TGA code, modified to save to any texture. +The original can be found at http://rt000s2p.eresmas.net/downloads.htm + +RLE code from TrueVision's TGA sample code available as Tgautils.zip at +ftp://ftp.truevision.com/pub/TGA.File.Format.Spec/PC.Version/ + +Jeroen Janssen for creating a Mandrake RPM patch for DevIL. + +Greg Priem for his help with supporting libungif and some various other things. + +Nelson Rush for SDL surface support and finding several bugs with DevIL. + +George McBay for his wonderful help finding bugs in my mipmapping code. + +Marco Kögler for finding bugs in my .jpg and .png code. + +Falco Kleinschmidt for fixing problems with the Linux makefiles. + +Olivier Bucher for finding a bug in saving 8-bit .bmp files. + +Derek Wills for noticing a problem with ilutGLScreenie when the screen width is +not a multiple of 4. + +Dale Schumacher's "Filtered Image Rescaling" code in Graphic Gems III for some +scaling algorithms in ILU. + +Kevin Park for making some suggestions on the ilImage C++ wrapper. + +Alessandro Pedretti for finding a bug in my TIFF code and making suggestions +about portability issues. + +boostrlns from #flipCode for finding the ilutGLLoadImage bug in the 1.1.5 +release. + +Ismo Kärkkäinen (iak@cs.joensuu.fi) for making some really nice new makefiles +for Linux. + +Kishan (http://www.hackorama.com) for the nice directions on how to compile +the external libraries under Linux. + +Wojciech Sobczuk for creating FreeBSD versions of the makefiles. + +nVidia for code to load .DDS files available at +http://www.nvidia.com/view.asp?IO=dxtc_decompression_code + +PixiGreg for noticing that many viewers don't like .bmp files with negative +heights (flipped), even though the specs say that it is valid. + +Matthias Stiller and Andre Normann for their invaluable help with getting +DevIL to work on Big Endian machines. + +Jean-Francois Richard for the Python bindings of DevIL. + +Nick Marley for post-build information in MSVC++. + +Kenneth Hurley for his help in expanding and fixing my DDS code. + +Mark Callow for EXIF-loading and saving code, along with il[Load/Save]FromJpegStruct + +Sam for several fixes to my .bmp and .jpg loaders. + +chris79 for his help debugging my .psp and .gif code in several versions. + +Nick Marley for his MSVC++ post-build fixes. + +Marc Gregoire for sending images that DevIL would not load. + +Alberto Barbati for noticing that the IL_NEU_QUANT_SAMPLE mode wasn't being used properly. + +Ryan Butterfoss for his contributions to the DDS saving code. + +Computer Graphics (C Version) book by Hearn and Baker for the arbitrary polygon filling code. + +Nicolas Weber + +Meloni Dario + +Erick Tryzelaar + +Matej Tyc for completely redoing the Linux makefile system and rewriting the documentation. + +Matevz Tadel for fixing makefile for Scientific Linux. + +Richard Sim for contributing several fixes, especially for .psd loading + +robin_charlton for contributing a patch for Windows BMP support in ILUT. + +Vincent Richomme for DirectX Mobile support + +Antibyte for DDS save bugfix + +Stefan Cornelius, Secunia Research, for finding some buffer overflow vulnerabilities. + +Nico Golde for finding that my fix for the above vulnerability was not totally complete. + +GAIA (Group for Artificial Intelligence Applications) for contributions including .iff-loading +and redoing the ilutConvertToHBitmap code. Their changes are at +http://gaia.fdi.ucm.es/grupo/projects/javy/devzone.html#DevILNotes. + +Jesse Maurais for support of X11 component + + +Translations: +------------- + +Carlos Aragonés, for Spanish translation + +Bart De Lathouwer, for Danish translation + +Osamu Ohara, for English translation + +Abdullah Alshammari, for Arabic translation + +Osamu Ohara, for Japanese translation + +Andreas Stöckel, for German translation + diff --git a/samples/DevIL/ChangeLog b/samples/DevIL/ChangeLog new file mode 100644 index 000000000..aeae00053 --- /dev/null +++ b/samples/DevIL/ChangeLog @@ -0,0 +1,604 @@ +2009-03-08 MatÄ›j Týč + * docs/Makefile.am: Fixed distcheck by overriding dvi target. + * lib/Makefile.am: Renoved ilu_mipmap.h file + * configure.ac: Added option to disable checks for 'nvidia texture tools' and + 'libsquish' + +2009-03-08 Denton Woods + * il_ilbm.c:410: Changed to IL_BGR from IL_RGB. + * il_iff.c (ilLoadIffF/ilLoadIffL): Changed to call Lbm loading functions + if Iff loading fails, since they both can have the .iff extension. + * il_ilbm.c:416: Added origin reference. + * configure.ac: Added more file formats to the format checks. + * Makefile.am: Removed ilu_mipmap.h. Added ilu_error-french.h. + +2009-03-07 Denton Woods + * Updated version numbers to 1.7.8 project-wide. + * DevIL_manual.texi: Added several file formats to the appendix. + * il_io.c: Updated Doxygen comments for loading/saving functions. + * libraries.txt: Updated with new libraries. + * il_io.c (ilTypeFromExt): Changed return value of FITS files to IL_FITS. + Added DICOM, FTX, Rot and Texture checks. + * il_states.c/.h: Updated with newer file formats. + * il_blp.c:649: Fixed ilNewImageFull call to use color index. + 659: Fixed memcpy from base image to new mipmap. + * il_dcx.c, il_exr.cpp and many more: Checks return value of ilFixImage now. + * il_iff.c:271: Got rid of ilConvertImage call. + +2009-03-06 Denton Woods + * Updated VC8 projects to use il_mp3.c. + * il.h: Added description to IL_WDP. + +2009-03-05 Denton Woods + * il_mp3.c: Added this file. + * il_io.c: Added loading calls for .mp3 files. + * il_internal.h: Added .mp3 loading declarations. + * Makefile.am: Added il_mp3.c to source line. + * il.h: Added IL_MP3 define. + +2009-03-04 Denton Woods + * il_utx.cpp: Started cleanup of file using C++ constructs. + * Updated VC8 projects to use il_utx.cpp. + +2009-03-03 Denton Woods + * ilu_error-french.h: Added French translation of errors. + * ilu.h: Added ILU_FRENCH define. + * Changed il_utx.c to il_utx.cpp. + +2009-03-02 Denton Woods + * il_utx.c: Added DXT1 loading in UTX files. + * il_utx.h: Added this file. + * lib/Makefile.am: Added il_utx.h to include line. + * il_utx.c: Fixed loading of larger images. + * windows_example.rc: Fixed accelerator for menu. + +2009-03-01 Denton Woods + * il_utx.c: Added this file. + * lib/Makefile.am: Added il_utx.c to source line. + * il_internal.h: Added .utx loading declarations. + * il_io.c: Added loading calls for .utx files. + +2009-02-28 Denton Woods + * il_states.c / il_states.h: Added ilVtfCompression to IL_STATES. + * il_vtf.c: Added more formats to saving. + * il.h: Added IL_VTF_COMP define. + * il_io.c: Added saving calls for .vtf files. + * il_dds.c: Added DecompressARGB16 to load a2r10g10b10 and a2b10g10r10 formats. + * il_convbuff (iSwitchTypes): Added several missing break statements. + * il_convbuff:1988: Changed to check types instead of bpc. + +2009-02-27 Denton Woods + * il_dpx.c / il_dpx.h: Got basic dpx loading working. + * WindowsTest.cpp: Fixed memory leak when loading files. + * il_vtf.c (iGetVtfHead): Added support for headers of 64 bytes. + * il_iwi.c (iLoadIwiInternal): Added IL_INVALID_FILE_HEADER error. + * il_vtf.c: Added VTF writing functions. + +2009-02-26 Denton Woods + * configure.ac, lib/Makefile.am, il.h, il_internal.h, il_ilbm.c, il_io.c: Added + patch from Ben Campbell for ILBM files at + https://sourceforge.net/tracker2/index.php?func=detail&aid=2635333&group_id=4470&atid=304470. + * il_dpx.c / il_dpx.h: Added these files. + * lib/Makefile.am: Added il_dpx.c and il_dpx.h to source/include lines. + * il_internal.h: Added .dpx loading declarations. + * il_io.c: Added loading calls for .dpx files. + +2009-02-25 Denton Woods + * il_iwi.c:329: Changed IL_MAX parameter from 16 to 8 (copy+paste error). + * WindowsTest.cpp: Added mipmap functionality to 0-9 keys (0 goes to main image). + +2009-02-24 Denton Woods + * vc9 Unicode projects: Changed settings to use x64 and x86 directories for .obj files. + * test/in: Removed this directory. + * Added "Test Images" to SVN. + * il_dds.c (DecompressFloat): Added proper support for G16B16, G32B32, R16 and R32 images. + +2009-02-23 Denton Woods + * il_pnm.c: Fixed bug at https://sourceforge.net/forum/message.php?msg_id=6491617 - + Changed order of lines 448 and 450. + +2009-02-22 Denton Woods + * il_internal.h: Added IL_NO_EXTLIBS define. + * il_dds-save.c: Removed unused variables. + * ilu_mipmap.c: Finished redoing all mipmap functions. + * ilu_mipmap.h: Removed this file. + +2009-02-21 Denton Woods + * ilu_mipmap.c: Redid mipmap functions to use iluScale functions instead of nearest. + +2009-02-20 MatÄ›j Týč + * docs/Makefile.am,docs/Devil_manual.texi: Added new ILU images to the + manual, set the manual license to GFDL. + * testil, ilur: Licensed under GPL v3 + +2009-02-19 Denton Woods + * windows_example\resources: Added DevIL Logo.ico, removed OpenIL Logo.ico. + * windows_example\resource.h: Changed to use DevIL Logo.ico. + * il_io.c (ilSaveL): Fixed bug where return type was cast to 1 byte. + +2009-02-18 Denton Woods + * configure.ac: Added descriptions of more image formats. + * il_ftx.c (iLoadFtxInternal): Changed to load all FTX images as RGBA. + +2009-02-17 Denton Woods + * ilu_mipmap.c: Changed all references of Next to Mipmaps to fix bug noticed at + https://sourceforge.net/forum/message.php?msg_id=6443698. + * Added support for IL_NO_GAMES in il_internal.h. + +2009-02-17 MatÄ›j Týč + * configure.ac, m4/devil-definitions.m4 (TEST_FORMAT): Added an option + to describe image formats. + +2009-02-16 MatÄ›j Týč + * src-ILU/ilur: Made ilur independent on regex.h + * autogen.sh: Simplified autotools invocation to autoreconf only + * configure.ac: Added support for IL_NO_GAMES if users don't want + support for game formats + * docs/DevIL_manual.texi: Fixed errors causing trouble when making + info files + some minor syntax enhancements. + +2009-02-16 Denton Woods + * il_manip.c (ilGetAlpha): Added IL_ALPHA case. + * il_manip.c (ilSetAlpha): Cleaned up formatting. Added IL_ALPHA case. + Fixed casting issue in integer case. + * il_texture.c: Added this file and the simple .texture loading. + * lib/Makefile.am and src-IL/src/Makefile.am: Added il_texture.c to source line. + * il.h: Added IL_TEXTURE define. + * il_internal.h: Added .texture loading declarations. + * DevIL.nb: Removed the test image from the notebook to drop it from over 9MB to 4.5KB. + +2009-02-15 Denton Woods + * il_blp.c (iLoadBlpInternal): Finished testing and fixed BLP2 RAW with 1-bit alpha. + * il_dicom.c: Added this file. + * config.h.win: Added defines for new image formats. + * il_io.c / il_jp2.c: Added .jpx, .j2k and .j2c extensions for JPEG 2000. + * il_io.c / il_jpeg.c: Added .jif and .jfif extensions for JPEG. + * il_dicom.c: Added DICOM loading for uncompressed formats and little endian data. + * lib/Makefile.am and src-IL/src/Makefile.am: Added il_dicom.c to source line. + * il_dicom.c: Added DICOM support for big endian data. + * test/in/tiff: Removed this directory. + * il_rot.c: Added this file. Added .rot loading. + * lib/Makefile.am and src-IL/src/Makefile.am: Added il_rot.c to source line. + * il.h: Added IL_ROT define. + * il_internal.h: Added Rot loading declarations. + +2009-02-15 MatÄ›j Týč + * src-ILU/ilur: Added the ilur - commandline ILU frontend + * bin, examples/Makefile.am: Moved examples's Makefile.am to bin + directory. Added ilur to it. + * docs/DevIL_manual.texi: Made slight syntax corrections, fixed the + sample program and added functions index + +2009-02-14 Denton Woods + * il_blp.c (iLoadBlp1): Support for mipmaps added. + * il_gif.h: Moved iCopyPalette declaration out of here into il_internal.h. + * il_gif.c: Moved iCopyPalette definition out of here into il_pal.c. + * projects/Mathematica: Added this folder. + * il_fits.c (iCheckFits): Implemented this. + * il_fits.c (iLoadFitsInternal): Renormalized float and double data. + * il_blp.c (iLoadBlp1): Added seeks to image data (not necessarily following palette). + * il_blp.c (iLoadBlpInternal): Added loading for BLP2 RAW with 1-bit alpha. + +2009-02-13 Denton Woods + * WindowsTest.cpp: Added slideshow capabilities with Page Up and Page Down. + * il_jpeg.c:357: Added ilFixImage call. + * il_jpeg.c (ilLoadFromJpegStruct): Changed return value to the return of ilFixImage. + * il_blp.c:466-467: Fixed to read these images properly. + * WindowsTest Project: Changed x64 debug to use runtime library debug DLLs. + +2009-02-12 Denton Woods + * il_ftx.c: Added this file. + * lib/Makefile.am and src-IL/src/Makefile.am: Added il_ftx.c to source line. + * il_io.c: Added Ftx loading function calls. + * il_blp.c: Added BLP1-loading functions. + +2009-02-11 Denton Woods + * il_jpeg.c (ilSaveJpegL): Changed the itellw call to after iSetOutputLump + (was returning bad values, since the lump was not set yet). + * il_io.c (ilSaveL): Changed return value to Ret and got rid of IL_FALSE check. + * il_bmp.c, il_dds-save.c, il_hdr.c, il_jp2.c, il_pcx.c, il_png.c, il_pnm.c, il_psd.c, il_raw.c, + il_sgi.c, il_wbmp.c: Fixed same problem that il_jpeg.c had with saving lumps. + * il_sgi.c: Put header on file. + * il_iwi.c:337: Removed this line, which called iread a second time for CompData. + +2009-02-10 Denton Woods + * il_io.c: Added ilLoadBlp calls in il_io.c. + * VC9 projects: Turned off x64 incremental linking to prevent debugging problems described here: + http://stackoverflow.com/questions/218747/msvcr90ddll-not-found-in-debug-mode-with-visual-c-2008 + * il_blp.c: Added code to read BLP2 files. + +2009-02-09 Denton Woods + * ilu_scale2d.c (iluScale2DBilinear_): Started rewrite, since results were really ugly. + * il_iwi.c / il_vtf.c: Changed max references to IL_MAX. + * il_wdp.c: Redid all of the code so that it actually works now. + * il_internal.h:42-46: Added lines to define IL_NO_WDP if not in Windows. + * il_io.c: Added Iwi and Fits loading calls. + * il.h: Added IL_BLP and IL_DICOM. Switched IL_DICOM and IL_IWI defines. + * il_internal.h: Added Blp and Dicom function defines. + * il_blp.c: Added this file and started code. + * lib/Makefile.am and src-IL/src/Makefile.am: Added il_blp.c to source line. + +2009-02-09 MatÄ›j Týč + * tests/testil.c: Added checks what IL loading/saving routines ended + * build system: Removed --enable-monolithic option. + +2009-02-07/08 Denton Woods + * il_iwi.c: Added this file and code to load .iwi files. + * il_vtf.c (iLoadVtfInternal): Added checks for CompData == NULL. + * il_dds.c/il_dds.h: Changed CompFormat to a local variable. Renamed Decompress to DdsDecompress. + * ChangeLog (this file): Changed order to newest at the top. + * il.h: Added IL_FITS and IL_IWI defines. + * config.h.win: Added IL_FITS, IL_IWI, IL_SUN and IL_TPL. + * lib/Makefile.am and src-IL/src/Makefile.am: Added il_fits.c and il_iwi.c to source line. + + +--- 1.7.7 release --- + +2009-02-06 MatÄ›j Týč + * configure.ac, lib/Makefile.am: Added explicit linking with libm + library + fixed the ilut_x11.c file conditions of compilation + * examples/Makefile.am + IL examples, test/Makefile.am + testil: Added + conditional compilation option when compiling only with IL (without + ILU, iluErrorString() absence workaround) + +2009-02-06 Denton Woods + * README.win and README.unix: Updated with Cygwin/MinGW instructions. + +2009-02-05 Denton Woods + * il_tga.c: Fixed bug loading malformed RLE Targa images. + * il_rle.c:20: Changed size_t cast to ILint to resolve compiler warning. + * il.def: Added definitions. + * Updated version numbers to 1.7.7 everywhere. + +2009-02-04 Denton Woods + * ilut_opengl.c:160: Changed checks to see if less than 0. + * il_fits.c: Got this reading FITS files properly. + +2009-02-04 MatÄ›j Týč + * configure.ac: Corrected handling of --enable-debug options, added + working install support for pkg-config + * data/Makefile.am, *.pc.in: Corrected pkg-config files + +2009-02-03 Denton Woods + * il_io.c: Updated Doxygen comments. + * il_fits.c: Added this file (not in any projects yet). + * il_fits.c: Wrote beginning of FITS loading code. + +2009-02-02 Denton Woods + * il_manip.c (ilCopyPixels):311: Added check for destination format of color index. + * il_convbuff.c (ilConvertBuffer): Changed to accept the source image palette. Added code to + convert from buffers that are related to a palette before the large switch. + * il_alloc.c (ifree): Changed so that if Ptr == NULL, it does not try to free the pointer. + * il_nvidia.cpp/il_squish.cpp: Added empty functions if nVidia or libsquish support is not + compiled in. + * test/format_test/testil.c:5: Added _USE_MATH_DEFINES. + +2009-02-01 MatÄ›j Týč + * test/format_test: Tweaked the script to use wine if cross-compiling + to run the tests, extended testil capabilities + * m4/devil-definitions.m4: Fixed bugs that caused that you couldn't + disable support for some formats no matter what :-) + * m4/devil-api-checks.m4: Added Xrender build support (by Jesse Maurais) + +2009-02-01 Denton Woods + * devil_internal_exports.h: Commented members of ILimage struct using Doxygen-style comments. + Removed deprecated, commented-out members (NumNext, NumLayers, NumMips). + * Updated several functions with appropriate Doxygen comments. + * il.h: Updated IL_XXX file format defines with Doxygen comments. + * ilu_rotate.c: Changed min/max calls to IL_MIN/IL_MAX. + * ilut_states.c (ilutSetInteger): Fixed ILUT_MAXTEX_DEPTH call and added checks around first + three calls for Param >= 1. + +2009-01-31 Denton Woods + * Added newlines to the end of several files to keep gcc quiet. + * Added new MSVC++ projects for examples. + * il_bmp.c:556: Changed to Header->biWidth from iCurImage->Width. iCurImage->Width was not + updated to the new width at this point. + * il_rotate.c (iluRotate_): Rewrote to fix 1 pixel shifting issue. + * Updated DevIL Manual with new ilSaveL information. + * il_stack.c (ilCloseImage): Added missing delete of Faces member. + * il_dds-save.c (ilCompressDXT): Added this function. + * il.h: Removed ilNVidiaCompressDXT and ilSquishCompressDXT - moved to il_internal.h. + * il_dds-save.c:151: Changed to Faces from Images. + * il_dds-save.c (CompressTo565): Added IL_ALPHA case. + * Updated DevIL Manual with new DXTC information. + +2009-01-30 Denton Woods + * Added DevIL.NET to projects folder. + * il_dds.c: Changed Image->Next code for cubemaps to read Image->Faces. Also changed Image->Next + code for mipmaps to read Image->Mipmaps, even further down the chain. + * il_dds.c (ilTexImageDxtc): Added call to ilCloseImage for Image->Faces. + * il_endian.h:113: Fixed bug #2545848 - inline GCC ASM changed. + * ilut_directx9.c (ilutD3D9CubeTexture): Changed ->Next to ->Faces. + * ilut_directx9.c (iD3D9CreateMipmaps): Changed ->Next to ->Mipmaps. + * il_states.c:605: Changed from ->Next to ->Mipmaps. + * il_states.c (iGetActiveNum): Rewrote to not use ->Next pointer for everything. + * il_vtf.c (VtfInitMipmaps): Changed to reflect the new mipmap arrangement as well. + * il_wal.c:141,142: Changed ->Next to ->Mipmaps. + * il_wal.c: Cleaned up the formatting a bit. + * il_stack.c (ilActiveMipmap): Changed ->Next to ->Mipmaps. + * il_stack.c (ilActiveImage/Mipmap/Face/Layer): Added another check for NULL, changed error. + Changed order of statements in for loop. This leads to much much less in the way of + ilSetError calls, since we do not have iCurImage == NULL. + * il_vtf.h:43: Changed to ILuint from ILint. + * il_vtf.c: Changed VtfInitMipmaps calls to VtfInitFacesMipmaps calls and changed iLoadVtfInternal + to support environment maps. + * il.h:384: Added IL_SPHEREMAP. + * il_hdr.c:467: Changed to char* to get OS X to stop issuing a warning. + * il_size.c:53: Changed return value to ILuint. + * devil_cpp_wrapper.hpp: Removed MSVC++ #pragma at the top for deprecated lib. + +2009-01-28 Denton Woods + * il_tpl.c: Added line 219. + +2009-01-27 Denton Woods + * il_bits.c (bseek): Changed check for return values of iseek. + * il_tpl.c: Added support for many more TPL data formats. + * il_tpl.c: Added support for color indexed data formats. + * il_tpl.c: Added support for multiple images in a file. + * il_sdl.c (ilutConvertToSDLSurface): Overhauled this code. + * ilut_opengl.c: Removed iGLSetMaxW/H/D and MaxTexW/H/D. + * ilut_states.h/ilut_states.c: Added MaxTexW/H/D to ILUT_STATES. + * ilut_states.c (ilutGetIntegerv): Added ILUT_MAXTEX_WIDTH/HEIGHT/DEPTH. + +2009-01-26 Denton Woods + * projects/win mobile: Added Windows Mobile projects. + * Removed .cvsignore files from SVN. + * il_bits.c:65: Commented out icloser call. + * include/IL/DevIL.i: Removed IL/ prefix on header filenames. + * include/IL/build-python and build-lua: Updated paths. + * projects folder: Renamed msvc to msvc9. + * il_tpl.c: Added for TPL support. + * il_io.c: Added function calls for TPL support. + * il_internal.h: Added declarations for TPL support. + +2009-01-25 Denton Woods + * ilut_internal.h:63-67: Redid definitions of IL_TEXT to coincide with il_internal.h. + * il_states.c: Updated _ilLoadExt/_ilSaveExt with all extensions. + * il_states.h: Updated with all extensions. + * All image formats with saving: Changed return values of ilSaveXxxF and ilSaveXxxL to be + an integer stating the number of bytes written. This is what ilSaveF/L have been + trying to return all along. + * il_pal.c:1075: Added error condition. + * lib/Makefile.am: Added il_size.c. + * simple.c: Added iluInit call. + * il_dds-save.c (GetAlphaBlock): Applied code from GetBlock, since it was still reading out of bounds. + * il_psd.c (ParseResources):808: Added check for ResourceSize being too small. + 834-837: Added check to insure that we are not copying from past the end of Resource. + * il_hdr.c:527-528: Changed order so that beg_run+run_count is tested first. + * il_psd.c:829: Subtracted an additional 4 for the Size obtained in the lines before. + * il_jp2.c:792-792: Added cleanup code if failure. 676-680: Added call to jas_init. + Added code throughout to prevent from having to initialize Jasper more than once. + * il_internal.h/il_internal.c: Added strdup for Windows CE. + * il_internal.h:105-107: Added so that we do not try to compile inline ASM with Windows Mobile. + +2009-01-24 Denton Woods + * il_internal.h,il_tiff.c: Changed ilSaveTiffL to void* instead of const void*. + * il_tiff.c: Added _tiffFileReadProcW. Changed _tiffFileSeekProc(W) to return the + result of itellw instead of tOff. This allows us to finally overload the TIFF + writing code. + * il_internal.h: Removed #pragma comments, which were commented out anyway. + * il_io.c (ilSaveL): Added call to ilDetermineSize. + * il_size.c: Added this file. + * il_manip.c:14: Removed #include . + * il_jpeg.c:53: Added check for IL_USE_IJL. + * il_exr.cpp:319,329: Changed to write functions instead of read. + * il_files.c: Added iSetOutputFake. + * il_files.c (iSetOutputLump): Added check for NULL to accomodate ilDetermineSize function. + * il_hdr.c:457: Changed from char* to ILbyte*. + * il_icns.h:24,30: Changed from ILbyte to char. + * il_size.c: Added #ifdefs for when user has declared IL_NO_XXX. Changed error to ENUM instead of PARAM. + * Updated MSVC8 projects with il_size.c. + * src-IL/src/Makefile.am: Added il_size.c. + * il_jp2.c: Added ilIsValidJp2* functions. + * il.h: Added ilDetermineType and ilDetermineTypeL to declarations. + * il_io.c: Changed ilDetermineTypeL to be exported. + * il_pcx.c: Formatting issues fixed. + * il_mdl.c: Added ilIsValidJp2* functions. + * il_io.c: Added JP2, MDL and XPM support to ilDetermineType and ilIsValid functions. + * il_icon.c/il_png.c: Renamed color_type to ico_color_type and png_color_type to avoid name conflicts. + * il_iff.c: Changed all malloc->ialloc and free->ifree. Added checks for ialloc failure. + * il_io.c (ilDetermineTypeL): Changed VTF check to return IL_VTF instead of the miscopied IL_SUN. + * il_size.c (ilDetermineSize): Now calls iTargaSize for Targa files. + * il_tga.c: Added iTargaSize. + +2009-01-22 Denton Woods + * ilut_internal.h:66: Changed to compile under Cygwin. + * ilut_opengl.c:108: Replaced _MSC_VER with _WIN32 and _WIN64. + * il_dds-save.c:343: Fixed bug #1067590 - Removed this line, which caused crashes. + * il_pic.c (iLoadPicInternal): Fixed ilTexImage call, moved it after channel information read. + * il_pic.c (readScanline):294-295: Added check for alpha channel. + * il_pic.c: Added ilSetError calls throughout. + * il_sgi.c (iLoadSgiInternal): Fixed bug #1060946 - Removed IL_LUMINANCE_ALPHA filetype. + * WindowsTest.cpp:52,53: Changed border size to accomodate Windows Vista/7. + * il_endian.h:20: Changed to give __BIG_ENDIAN__ a value of 1. The Google cached page of + http://74.125.47.132/search?q=cache:YfSl36C2pAQJ:patch-tracking.debian.net/patch/series/view/devil/1.7.2-1/00_endian_and_ILvoid_fixes.diff+devil+big+endian&hl=en&ct=clnk&cd=11&gl=us&lr=lang_en + has this patch (Nov. 24, 2008 cache). + * devil_internal_exports.h:34: Uncommented and commented line 30. + +2009-01-20 MatÄ›j Týč + * test/format_test: Added a program and script as 'make check' target. + Those will test whether IL is capable of saving and loading images and whether the saved and + loaded image is similar to the original. + * configure.ac, lib/Makefile.am: Added support to IFF compilation. + * docs/DevIL_manual.texi: Added missing documentation about getting + image data + fixed some typos. + * include/IL/devil_cpp_wrapper.hpp: Fixed a typo that caused + compilation error + +2009-01-20 Denton Woods + * ilut_opengl.c (ilutGLScreen): Added glPixelStorei call. + * Added il_iff.c from GAIA. + * Added "x64 DLL Install.exe" to SVN. + * il_internal.h: Renamed ilIsValidJpg* functions to ilIsValidJpeg*. Added Iff functions. + * il_io.c: Added checks for Iff-loading. + * ilut_win32.c (ilutConvertSliceToHBitmap): Added better error handling. + * src-IL/src/Makefile.am: Added il_iff.c. + * ilu_rotate.c (iluRotate_): Changed ilResizeImage call. + * Added ilut_config.h. + * ilut.h: Added reference to ilut_config.h for Windows. + * il_files.c/il_icon.c/il_png.c/il_mng.c: Fixed typecasting warnings. + * il_jp2.c/il_wbmp.c (ilSaveJp2L/ilSaveWbmpL): Removed const qualifier. + +2009-01-19 Denton Woods + * il_hdr.c: Changed line 73 to have space for terminating NULL. + * src-IL/src/Makefile.am: Added il_vtf.c and *.cpp files. + * Fixed the MSVC++ 9 solutions pointing to the MSVC++ 8 project files. + * devil_cpp_wrapper.hpp: Updated to use ILconst_string instead of char*. + * il.h: Changed definition of IL_ALPHA to match OpenGL's GL_ALPHA. + * src-IL/include/Makefile.am: Added il_exr.h. + * il_dds.c/il.h: Readded DXT extension code. + * il_internal.h: Added declaration of ilFixCur. + +2009-01-16 Denton Woods + * Updated x64 projects + +2009-01-15 MatÄ›j Týč + * il_io.h, include/IL/il.h, il_states.h: Changed some normal strings to constant + strings (in ilSave, ilIsValid and ilGetString) + * configure.ac, lib/Makefile.am: Added wbmp compilation support + * il_jp2.c, il_wbmp.c: Fixed a typo that prevented compilation + * include/IL/devil_cpp_wrapper.hpp: Added a hopefully harmless solution for + the initialization of DevIL. + +2009-01-15 Denton Woods + * il_manip.c / il.h: Added ilClampNTSC function. + * il_squish.cpp: Added file. + * il_dds-save.c: Added line 688. + * il_states.c: Added lines for libsquish support. + * il_dds-save.c (Compress): Added libsquish compression. + * il_io.c (ilDetermineTypeF/L and ilIsValid/F/L): Added VTF, SUN and EXR. + * il_io.c (ilIsValidF/L): Added TIF + * il_jp2.c:131-137: Added these lines to take care of erroneous error generated by JasPer's buffering. + * il_jp2.c: Added functions to save JPEG 2000 images. + * il_utility.c (ilGetBppFormat): Added IL_ALPHA. + * il_jp2.c (iLoadJp2Internal): Added 1 and 2 channel format loading. + * il_dds-save.c:700-701: Changed to IL_RGBA. + * il_dds-save.c (ChooseEndpoints): Changed to use norm squared instead of a sum of the components. + * il_dds-save.c (GetBlock): Changed to copy adjacent data if it goes beyond the bounds of the image. + * il_icon.c: Removed extra whitespace. + * il_icns.c / il_internal.h: Added ilIsValidIcns*. + * il_icns.h: Changed comments on ICNSDATA. + * il_exr.c: Added ilIsValidExr*. + * il_io.c (ilLoadF): Uncommented ilLoadJp2F. + * il_dds-save.c (CompressTo565): Changed 24-bit to 16-bit code based on Charles Bloom's rant. + * il_dds.c (DxtcReadColor/DxtcReadColors): Changed conversion to copy high bits to lowest bits as well. + * il_io.c: Reenabled PhotoCD support. + * il_pcd.c (iLoadPcdInternal): Added check for end-of-file. + * il_exr.c: Added EXR saving functions. + +2009-01-13 Denton Woods + * Converted source repository to SVN from CVS. + +2009-01-12 Denton Woods + * ilut_directx9.c: Cleared up formatting some. + +2009-01-11 Denton Woods + * MSVC9 Unicode projects: Updated to work better in 64-bit Windows. + * il_vtf.c: Removed commented lines 238-242. + * Created application to copy DLL files to the System32 directory. + +2009-01-10 MatÄ›j Týč + * m4/devil-definitions.m4, m4/devil-reports.m4: Added a report saying + what libraries were linked with DevIL (should be helpful to packagers + who need to know DevIL dependencies) + * il_endian.h (iGwapUShort/iSwapUInt): Finished fixing bug #2023453 + (inline GCC asm, there was a typo left) + * src_IL/src/il_tiff.c (ilSaveTiff): Fixed a typo that was causing + conflicting declarations error + * configure.ac:264: Added IL_NO_WBMP since the Wbmp loading functions + that are referenced, but not implemented, caused linking errors + +2009-01-09 Denton Woods + * ilut_opengl.h: Moved ILGLCOMPRESSEDTEXIMAGE2DARBPROC typedef out of #ifdefs. + * ilut_opengl.c: Added ilutGLSetTex2D and ilutGLSetTex3D. Changed ilutGLSetTex to + just call ilutGLSetTex2D. Did the same thing for ilutGLSubTex. Added checks for + volume image extensions. Renamed MakeGLCompliant to MakeGLCompliant2D. Added + MakeGLCompliant3D. + * ilut_opengl.c (ilutGLScreen): Added check for ilTexImage failing. + * il_vtf.c (iLoadVtfInternal): Added BGRA4444 support. + * il_alloc.c / ilu_scale.c: Cleaned up formatting some. + * devil_internal_exports.h: Added Faces member to ILimage. + * il_devil.c (iCopySubImages): Added support for faces. + * il_register.c: Added ilRegisterNumFaces. + * il_convert.c (ilFixImage): Added support for faces. + * il_stack.c: Added ilActiveFace. + * ilut_directx9:63,779: Added ILboolean typecast. + * ilut_win32:102: Added ILboolean typecast. + * il_jpeg.c:987: Commented out pragma warning at the end. + * il_mng.c: Added #pragma warning at the top to get rid of redefinition warning when compiling. + * il_nvidia.cpp (ilNVidiaCompressDXT): Added check for Data being NULL. + * ilut_win32.c (ilutConvertSliceToHBitmap): Fixed bug #2496509 - added line 117 and + added DataSize member. + * il_hdr.c (iGetHdrHead): Fixed bug #2496518 - Added check for count. Changed + sscanf to use %2s format specifier to prevent buffer overruns in x and y. + * il_pnm.c (iGetWord): Fixed bug mentioned in #2496518 - igetc was moved back + into the while loop. Added a check for WordPos to prevent buffer overflow. + Restructured the while loop to work properly. + * il_convert.c (iConvertPalette): Changed references of iCurImage to Image. + * il_gif.c (GifGetData): Added DataPtr and changed line 636 to use Data instead of Image->Data. + * il_gif.c (iGetPalette / GetImages): Changed to better deal with local palettes. + +2009-01-08 MatÄ›j Týč + * TODO: Added some tasks that I would like to undertake + * ChangeLog, NEWS: Copied old ChangeLog entries to NEWS file + * lib/Makefile.am: Added two new files to the list of IL sources + (il_sun.c, il_nvidia.cpp) + * examples/iller: Made empty files where the ILU frontend will be in + the future. + * configure.ac, m4/devil-reports.m4: Put the report stage of the + configure script to a separate m4 file. + +2009-01-08 Denton Woods + * opengl_example/gltest.c (main): Added iluInit/ilutInit calls. + * ilut_opengl.c (ilutGLFormat): Added IL_ALPHA support. + * il_bmp.c: Minor formatting issues fixed. + * il.h: Added IL_NVIDIA_COMPRESS #define. + * il_states.h: Added ilUseNVidiaDXT to IL_STATES. + * il_state.c: Added IL_NVIDIA_COMPRESS support. + * il_dds-save.c (Compress): Changed to use NVTT if needed. + * il_nvidia.cpp: Added ilNVidiaCompressDXTFile and Depth parameter to ilNVidiaCompressDXT. + +2009-01-06/07 Denton Woods + * Added il_sun.c (Sun Raster file support) + * ilut_opengl.c (ilutGLInit): Changed Linux ilGLCompressed2D pointer casting + to coincide with the old SVN version. + * il_tiff.c / il_alloc.c: Fixed a few pointer casts that were fixed in SVN. + * test/DDrawTest: Fixed extra whitespace in all files in this project. + * il_endian.h (iGwapUShort/iSwapUInt): Fixed bug #2023453 (inline GCC asm). + * ilut_win32.c (ilutConvertSliceToBitmap): Fixed bug #1775036 (definition of buff). + * il_psd.c (PsdGetData): Fixed bug #2219350 (16-bit luminance images not loading properly). + * il_manip.c: Cleared up some minor formatting issues. + * il_png.c (iSavePngInternal): Fixed bug #1680577 (some metadata not written correctly). + * il_nvidia.cpp (ilnVidiaCompressDXT1): Disabled mipmap generation and added code to + ilOutputHandler constructor to determine the proper size of the buffer. + * il.h: Added IL_DXT1A define for nVidia Texture Tools. + * il_nvidia.cpp: Added DXT1a, DXT3 and DXT5 support. Renamed ilnVidiaCompressDXT to + ilnVidiaCompressDXT and added the DxtType parameter. + * il_internal.c: Cleaned up extra whitespace toward end. + +2009-01-02 MatÄ›j Týč + * src-{IL,ILU,ILUT}/src/*_internal.c: Hopefully resolved the + HAVE_CONFIG_H thing once for all :-) + * src-IL/src/il_exr.cpp: Undefined OPENEXR_DLL if we are not on + Windows (=> when HAVE_CONFIG_H is not defined) + * src-IL/src/il_io.c:765: Fixed a typo + * src-IL/src/il_vtf.c: Added min and max macros to the beginning + * docs/Devil_manual.texi: Corrected typos and missing @code and other + formatting stuff, corrected image names and incorrect usage of @xref + etc. that prevented compilation + * build setup (Makefile.am and configure.ac): Added support for + compilation of EXR and WDP formats + various other tweaks. + +Up to 2009-01-02 (since 1.7.5 release) Denton Woods + * Readded EXR code. + * Redefined clamping values in il.h. + * Added 64-bit integer types. + * Fixed bug in iRegisterLoad (https://sourceforge.net/forum/message.php?msg_id=5973761). + * Changed seek functions in il_files.c to return ILint. + * Added rpcsal.h and sal.h #includes to ilut.h for DX10. + * Added IL_MAX_QUANT_INDICES to use instead of IL_MAX_QUANT_INDEXS (mispelled). + * Added WBMP support (loading and saving). + * EXR files can now be loaded as file streams and lumps. + * Changed iNeuQuant to take number of colors in palette. + * Compiled MNG support back in. diff --git a/samples/DevIL/DevIL Website.url b/samples/DevIL/DevIL Website.url new file mode 100644 index 000000000..e002d0636 --- /dev/null +++ b/samples/DevIL/DevIL Website.url @@ -0,0 +1,5 @@ +[InternetShortcut] +URL=http://openil.sf.net/ +IDList= +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 diff --git a/samples/DevIL/Libraries.txt b/samples/DevIL/Libraries.txt new file mode 100644 index 000000000..727652ade --- /dev/null +++ b/samples/DevIL/Libraries.txt @@ -0,0 +1,40 @@ +Libraries needed to compile DevIL* : +---------------------------------- + +(Most of these are optional) + + +Libpng for .png (and some .ico) support available at http://www.libpng.org/pub/png/libpng.html +ZLib for .png (and some .ico) support available at http://www.gzip.org/zlib/ +Libjpeg for .jpg (and some .blp) support from http://www.ijg.org/ +Libtiff for .tif support from http://www.libtiff.org/ +Libmng for .mng and .jng support from http://www.libmng.com/ +JasPer for .jp2 (and some .icns) support available at http://www.ece.uvic.ca/~mdadams/jasper/ +HD Photo Device Porting Kit for .wdp/.hdp support from http://www.microsoft.com/Downloads/details.aspx?FamilyID=285eeffd-d86c-48c3-ab93-3abd5ee7f1ce&displaylang=en. +Little CMS for color profiles (ILU) from http://www.littlecms.com/ +Colour Picker lib for WindowsTest from http://www.fluidstudios.com/freeware.html +Freeglut (or glut) for GLTest from http://freeglut.sourceforge.net +glext.h from http://oss.sgi.com/projects/ogl-sample/ABI/glext.h (as if using OpenGL) +libsquish for DXT compression from http://code.google.com/p/libsquish/ +nVidia Texture Tools for DXT compression from http://developer.nvidia.com/object/nv_texture_tools.html. + +MSVC++ precompiled versions of libpng, zlib, libjpeg, libtiff, lcms and JasPer can be found +at http://openil.sourceforge.net/libs/LibCompiled-vc8.zip or +http://openil.sourceforge.net/libs/LibCompiled-vc9.zip. + +Sources of libpng, zlib, libjpeg, libmng, libungif, libtiff, lcms and JasPer can be +found at http://openil.sourceforge.net/libs/LibSrc.zip + +Intel Jpeg Library from + http://developer.intel.com/software/products/perflib/ijl/index.htm + + +MAC OS X +These library are not still uploaded! +To learn how to install these libraries, read README.macosx + +Source of external framework, downloaded from the previous sites +http://openil.sourceforge.net/libs/ExternFrameworksSrc.sitx + +Complete Compiled Library +http://openil.sourceforge.net/libs/OpenILBin.sitx \ No newline at end of file diff --git a/samples/DevIL/README b/samples/DevIL/README new file mode 100644 index 000000000..a043a64ee --- /dev/null +++ b/samples/DevIL/README @@ -0,0 +1,176 @@ +Developer's Image Library version 1.7.8 Readme, Notes and Quick Use +------------------------------------------------------------------- + + DevIL song: "la la la, a cross-platform image library utilizing a + simple syntax to load, save, convert, manipulate, filter and display + a variety of images with ease, la la la" + + +What is it? +----------- + +DevIL is an Open Source image library whose distribution is done under the +terms of the GNU LGPL license. See the COPYING file for more details. +DevIL offers you a simple way to implement loading, manipulating, filtering, +converting, displaying, saving from/to several different image formats in your +own project. + + +Where can I find it? +-------------------- + +DevIL can be found at http://openil.sourceforge.net + + +How do I build and install the 3 libraries ? +----------------------------------------- + +*nix users should read README.unix +VisualC users should read README.win +Cygwin users should read README.cygwin +MacOSX users should read README.macosx + +PS: *nix stands for GNU/Linux, *BSD, SunOS/Solaris and perhaps some more. + + +More Extensive Documentation +---------------------------- + +This file is only a quick guide to point you to more detailed information on +how to use DevIL. More extensive documentation can currently be found on the +DevIL site at http://openil.sf.net and in the /Docs directory in a normal +install. + + +Why the hell another image library? +----------------------------------- + +I have never seen an image library that can do everything DevIL does. Sure, +various different libraries can do part of what DevIL can do as well or even +better, but I wanted a simple to use library that encompassed all of these +features. I also wanted an extremely portable image library that could be used +from a variety of languages and utilized the OpenGL syntax. + + +Basic Readme +------------ + +Most anything stated in this document applies to DevIL as well as DevILU and +DevILUT, unless otherwise stated. (This file is best viewed with word wrap on.) + + +Errors: +------- + +All errors generated inside DevIL, along with illegal parameters passed to +DevIL functions are caught and passed to ilSetError(), an internal library +function. The calling program can call ilGetError() to get the value of the +error generated. Error types are defined in il.h, using the 0x501 - 0x5FF +range. ilGetError() will return 0 (IL_NO_ERROR) if no error has occurred. + + +Basic Usage: +------ + +This demonstrates loading an image through DevIL for OpenGL. Don't forget to +call ilInit before you before you do anything: + +#include +#include +#include + +... + +ILuint devilError; + + +ilInit(); + +devilError = ilGetError(); + +if (devilError != IL_NO_ERROR) { + printf ("Devil Error (ilInit: %s\n", iluGetErrorString (devilError)); + exit (2); +} + +.... + +ILuint devilID; + + +ilGenImages(1, &devilID); +ilBindImage(devilID); +ilLoadImage("default1.tga"); // Loads into the current bound image +devilError = ilGetError(); + +if (devilError != IL_NO_ERROR) { + printf ("Devil Error (ilLoadImage: %s\n", iluGetErrorString (devilError)); + exit (2); +} + +.... + +ilutRenderer(IL_OPENGL); // Switch the renderer + +.... + +GLuint openglID, openglError; + + +openglID = ilutGLBindTexImage(); // This generates the texture for you +devilError = ilGetError(); + +if (devilError != IL_NO_ERROR) { + printf ("Error: %s\n", iluGetErrorString (devilError)); + exit (2); +} + +if (openglError != GL_NO_ERROR) { + printf ("Opengl Error (ilutGLBindTexImage): %s\n", gluGetErrorString (openglError)); + exit (2); +} + + + +// Make sure to close the image when you are done with it (though DevIL +// automatically deletes them when the program exits): + +glDeleteTextures(1, &openglID); +ilDeleteImages (1, &devilID); + + +More Examples: +--------- + +The TestIL project is included to test features of DevIL. + +DevIL includes a project called GLTest. This is a simple test of DevIL's +capabilities. All it does it load any image and displays it in a window +created by FreeGlut, which is available on http://freeglut.sourceforge.net. It +is also included to let the user have an idea of what the library can really +be used for. + +Several other test projects are included to test support with various display +APIs. The WindowsTest project is a basic image program that only runs in +Windows right now but showcases several of DevIL's features through various +menus. + +If you want more in-depth tutorials, you can find them on +http://openil.sf.net, or they may be in your installation under the /examples +directory. Documents are also available in the /docs directory. + + +Additional Reading +------------------ + +All image formats used in DevIL have corresponding documents on +http://www.wotsit.org, under the Graphics Files section. These documents +proved invaluable for the creation of this library when there was no library +already available for that image format. + + +Legalese +-------- + +All contents of this file are intellectual property of Denton Woods, +copyright 2001-2008. diff --git a/samples/DevIL/README.win b/samples/DevIL/README.win new file mode 100644 index 000000000..57e3e90eb --- /dev/null +++ b/samples/DevIL/README.win @@ -0,0 +1,44 @@ +Where do I find the project files ? +----------------------------------------- + +MSVC++ projects are in DevIL\projects\vc8 and DevIL\projects\vc9. +If compiling with Cygwin or MinGW, use the instructions in README.unix. + + +The IL_NO_XXX #define's: +------------------------ + +A user can recompile this library without complete image support in it. For +example, if your project does not use .jpg files, you can uncomment +#define IL_NO_JPG at the top of il/il.h, recompile the library, and no .jpg +support will be added, meaning quicker compiles and a smaller library. + + +The ILUT_USE_XXX #define's: +--------------------------- + +To disable support for a specific API, edit IL/ilut.h and comment the +corresponding #define. Per example, to disable OpenGL functions support, + add // in front of the line that reads: + +#define ILUT_USE_OPENGL + + +Libraries needed to compile DevIL* : +----------------------------------- + +Libraries.txt (included with the DevIL distribution) lists all libraries needed +to properly compile DevIL. + +Precompiled versions and sources of all libraries needed to compile DevIL are +available at http://openil.sourceforge.net/libs/LibCompiled.zip and +http://openil.sourceforge.net/libs/LibSrc.zip , respectively. + + +Installation: +------------- + +Just unzip and compile other libs included if needed. + +Please also refer to MSVC++.txt for further instructions if you are using +Microsoft Visual C++. diff --git a/samples/DevIL/include/IL/config.h b/samples/DevIL/include/IL/config.h new file mode 100644 index 000000000..b9fe5dc0a --- /dev/null +++ b/samples/DevIL/include/IL/config.h @@ -0,0 +1,140 @@ +/* include/IL/config.h. Generated by configure. */ +/* include/IL/config.h.in. Generated from configure.in by autoheader. */ +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +#define IL_USE_PRAGMA_LIBS + +// Supported image formats (IL) + +// #define IL_NO_BLP +// #define IL_NO_BMP +// #define IL_NO_CUT +// #define IL_NO_CHEAD +// #define IL_NO_DCX +// #define IL_NO_DDS +// #define IL_NO_DICOM +// #define IL_NO_DOOM +// #define IL_NO_EXR +// #define IL_NO_FITS +// #define IL_NO_FTX +// #define IL_NO_GIF +// #define IL_NO_HDR +// #define IL_NO_ICO +// #define IL_NO_ICNS +// #define IL_NO_IWI +// #define IL_NO_JP2 +// #define IL_NO_JPG +// #define IL_NO_LCMS +// #define IL_NO_LIF +// #define IL_NO_MDL +// #define IL_NO_MNG +// #define IL_NO_PCD +// #define IL_NO_PCX +// #define IL_NO_PIC +// #define IL_NO_PIX +// #define IL_NO_PNG +// #define IL_NO_PNM +// #define IL_NO_PSD +// #define IL_NO_PSP +// #define IL_NO_PXR +// #define IL_NO_RAW +// #define IL_NO_ROT +// #define IL_NO_SGI +// #define IL_NO_SUN +// #define IL_NO_TGA +// #define IL_NO_TIF +// #define IL_NO_TPL +// #define IL_NO_WAL +// #define IL_NO_WDP +// #define IL_NO_XPM +#define IL_USE_JPEGLIB_UNMODIFIED 1 +//#define IL_USE_DXTC_NVIDIA +#define IL_USE_DXTC_SQUISH + +/* Supported api (ilut) */ + + +// +// sorry just +// cant get this one to work under windows +// have disabled for the now +// +// will look at it some more later +// +// Kriss +// +#undef ILUT_USE_ALLEGRO + +#undef ILUT_USE_DIRECTX8 +//#define ILUT_USE_DIRECTX9 +//#define ILUT_USE_DIRECTX10 +//#define ILUT_USE_OPENGL +//#define ILUT_USE_SDL +//#define ILUT_USE_WIN32 + + +/* Define to 1 if you have the header file. */ +//#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_UNISTD_H 1 + +/* Name of package */ +#define IL_PACKAGE "DevIL" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define IL_PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define IL_PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define IL_PACKAGE_TARNAME "" + +/* Define to the version of this package. */ +#define IL_PACKAGE_VERSION "" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +//#define IL_VERSION "1.7.3" + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +/* #undef WORDS_BIGENDIAN */ + +/* If using Mac OS X uncomment this line */ +/* #include "macconfig.h" */ + +/* Define to 1 if the X Window System is missing or not being used. */ +/* #undef X_DISPLAY_MISSING */ +#endif /* __CONFIG_H__ */ diff --git a/samples/DevIL/include/IL/config.h.win b/samples/DevIL/include/IL/config.h.win new file mode 100644 index 000000000..659f4ca0e --- /dev/null +++ b/samples/DevIL/include/IL/config.h.win @@ -0,0 +1,79 @@ +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +#define IL_USE_PRAGMA_LIBS // Links to only the libraries that are requested. +#define IL_INLINE_ASM 1 // Define if you can support at least some ASM + +// Supported images formats (IL) + +// #define IL_NO_BLP +// #define IL_NO_BMP +// #define IL_NO_CUT +// #define IL_NO_CHEAD +// #define IL_NO_DCX +// #define IL_NO_DDS +// #define IL_NO_DICOM +// #define IL_NO_DOOM +// #define IL_NO_EXR +// #define IL_NO_FITS +// #define IL_NO_FTX +// #define IL_NO_GIF +// #define IL_NO_HDR +// #define IL_NO_ICO +// #define IL_NO_ICNS +// #define IL_NO_IWI +// #define IL_NO_JP2 +// #define IL_NO_JPG +// #define IL_NO_LCMS +// #define IL_NO_LIF +// #define IL_NO_MDL +// #define IL_NO_MNG +// #define IL_NO_PCD +// #define IL_NO_PCX +// #define IL_NO_PIC +// #define IL_NO_PIX +// #define IL_NO_PNG +// #define IL_NO_PNM +// #define IL_NO_PSD +// #define IL_NO_PSP +// #define IL_NO_PXR +// #define IL_NO_RAW +// #define IL_NO_ROT +// #define IL_NO_SGI +// #define IL_NO_SUN +// #define IL_NO_TGA +// #define IL_NO_TIF +// #define IL_NO_TPL +// #define IL_NO_WAL +// #define IL_NO_WDP +// #define IL_NO_XPM + +#define IL_USE_JPEGLIB_UNMODIFIED 1 +#define IL_USE_DXTC_NVIDIA +#define IL_USE_DXTC_SQUISH + +//#define IL_NO_GAMES + +/* Supported api (ilut) */ + + +// +// sorry just +// cant get this one to work under windows +// have disabled for the now +// +// will look at it some more later +// +// Kriss +// +#undef ILUT_USE_ALLEGRO + +#undef ILUT_USE_DIRECTX8 +#define ILUT_USE_DIRECTX9 +#define ILUT_USE_DIRECTX10 +#define ILUT_USE_OPENGL +#define ILUT_USE_SDL +#define ILUT_USE_WIN32 + + +#endif /* __CONFIG_H__ */ diff --git a/samples/DevIL/include/IL/devil_internal_exports.h b/samples/DevIL/include/IL/devil_internal_exports.h new file mode 100644 index 000000000..30b7aaab4 --- /dev/null +++ b/samples/DevIL/include/IL/devil_internal_exports.h @@ -0,0 +1,161 @@ +//----------------------------------------------------------------------------- +// +// ImageLib Sources +// Copyright (C) 2000-2009 by Denton Woods +// Last modified: 01/06/2009 +// +// Filename: IL/devil_internal_exports.h +// +// Description: Internal stuff for DevIL (IL, ILU and ILUT) +// +//----------------------------------------------------------------------------- + +#ifndef IL_EXPORTS_H +#define IL_EXPORTS_H + +#include "IL/il.h" + +#ifdef DEBUG + #include +#else + #define assert(x) +#endif + +//#ifndef NOINLINE +#ifndef INLINE +#if defined(__GNUC__) + #define INLINE extern inline +#elif defined(_MSC_VER) //@TODO: Get this working in MSVC++. + // http://www.greenend.org.uk/rjk/2003/03/inline.html + #define NOINLINE + //#define INLINE + /*#ifndef _WIN64 // Cannot use inline assembly in x64 target platform. + #define USE_WIN32_ASM + #endif//_WIN64*/ + #define INLINE __inline +#else + #define INLINE inline +#endif +#endif +//#else +//#define INLINE +//#endif //NOINLINE + +#ifdef __cplusplus +extern "C" { +#endif + +#define IL_MAX(a,b) (((a) > (b)) ? (a) : (b)) +#define IL_MIN(a,b) (((a) < (b)) ? (a) : (b)) + + +//! Basic Palette struct +typedef struct ILpal +{ + ILubyte* Palette; //!< the image palette (if any) + ILuint PalSize; //!< size of the palette (in bytes) + ILenum PalType; //!< the palette types in il.h (0x0500 range) +} ILpal; + + +//! The Fundamental Image structure +/*! Every bit of information about an image is stored in this internal structure.*/ +typedef struct ILimage +{ + ILuint Width; //!< the image's width + ILuint Height; //!< the image's height + ILuint Depth; //!< the image's depth + ILubyte Bpp; //!< bytes per pixel (now number of channels) + ILubyte Bpc; //!< bytes per channel + ILuint Bps; //!< bytes per scanline (components for IL) + ILubyte* Data; //!< the image data + ILuint SizeOfData; //!< the total size of the data (in bytes) + ILuint SizeOfPlane; //!< SizeOfData in a 2d image, size of each plane slice in a 3d image (in bytes) + ILenum Format; //!< image format (in IL enum style) + ILenum Type; //!< image type (in IL enum style) + ILenum Origin; //!< origin of the image + ILpal Pal; //!< palette details + ILuint Duration; //!< length of the time to display this "frame" + ILenum CubeFlags; //!< cube map flags for sides present in chain + struct ILimage* Mipmaps; //!< mipmapped versions of this image terminated by a NULL - usu. NULL + struct ILimage* Next; //!< next image in the chain - usu. NULL + struct ILimage* Faces; //!< next cubemap face in the chain - usu. NULL + struct ILimage* Layers; //!< subsequent layers in the chain - usu. NULL + ILuint* AnimList; //!< animation list + ILuint AnimSize; //!< animation list size + void* Profile; //!< colour profile + ILuint ProfileSize; //!< colour profile size + ILuint OffX; //!< x-offset of the image + ILuint OffY; //!< y-offset of the image + ILubyte* DxtcData; //!< compressed data + ILenum DxtcFormat; //!< compressed data format + ILuint DxtcSize; //!< compressed data size +} ILimage; + + +// Memory functions +ILAPI void* ILAPIENTRY ialloc(const ILsizei Size); +ILAPI void ILAPIENTRY ifree(const void *Ptr); +ILAPI void* ILAPIENTRY icalloc(const ILsizei Size, const ILsizei Num); +#ifdef ALTIVEC_GCC +ILAPI void* ILAPIENTRY ivec_align_buffer(void *buffer, const ILuint size); +#endif + +// Internal library functions in IL +ILAPI ILimage* ILAPIENTRY ilGetCurImage(void); +ILAPI void ILAPIENTRY ilSetCurImage(ILimage *Image); +ILAPI void ILAPIENTRY ilSetError(ILenum Error); +ILAPI void ILAPIENTRY ilSetPal(ILpal *Pal); + +// +// Utility functions +// +ILAPI ILubyte ILAPIENTRY ilGetBppFormat(ILenum Format); +ILAPI ILenum ILAPIENTRY ilGetFormatBpp(ILubyte Bpp); +ILAPI ILubyte ILAPIENTRY ilGetBpcType(ILenum Type); +ILAPI ILenum ILAPIENTRY ilGetTypeBpc(ILubyte Bpc); +ILAPI ILubyte ILAPIENTRY ilGetBppPal(ILenum PalType); +ILAPI ILenum ILAPIENTRY ilGetPalBaseType(ILenum PalType); +ILAPI ILuint ILAPIENTRY ilNextPower2(ILuint Num); +ILAPI ILenum ILAPIENTRY ilTypeFromExt(ILconst_string FileName); +ILAPI void ILAPIENTRY ilReplaceCurImage(ILimage *Image); +ILAPI void ILAPIENTRY iMemSwap(ILubyte *, ILubyte *, const ILuint); + +// +// Image functions +// +ILAPI void ILAPIENTRY iBindImageTemp (void); +ILAPI ILboolean ILAPIENTRY ilClearImage_ (ILimage *Image); +ILAPI void ILAPIENTRY ilCloseImage (ILimage *Image); +ILAPI void ILAPIENTRY ilClosePal (ILpal *Palette); +ILAPI ILpal* ILAPIENTRY iCopyPal (void); +ILAPI ILboolean ILAPIENTRY ilCopyImageAttr (ILimage *Dest, ILimage *Src); +ILAPI ILimage* ILAPIENTRY ilCopyImage_ (ILimage *Src); +ILAPI void ILAPIENTRY ilGetClear (void *Colours, ILenum Format, ILenum Type); +ILAPI ILuint ILAPIENTRY ilGetCurName (void); +ILAPI ILboolean ILAPIENTRY ilIsValidPal (ILpal *Palette); +ILAPI ILimage* ILAPIENTRY ilNewImage (ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILubyte Bpc); +ILAPI ILimage* ILAPIENTRY ilNewImageFull (ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data); +ILAPI ILboolean ILAPIENTRY ilInitImage (ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data); +ILAPI ILboolean ILAPIENTRY ilResizeImage (ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILubyte Bpc); +ILAPI ILboolean ILAPIENTRY ilTexImage_ (ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data); +ILAPI ILboolean ILAPIENTRY ilTexSubImage_ (ILimage *Image, void *Data); +ILAPI void* ILAPIENTRY ilConvertBuffer (ILuint SizeOfData, ILenum SrcFormat, ILenum DestFormat, ILenum SrcType, ILenum DestType, ILpal *SrcPal, void *Buffer); +ILAPI ILimage* ILAPIENTRY iConvertImage (ILimage *Image, ILenum DestFormat, ILenum DestType); +ILAPI ILpal* ILAPIENTRY iConvertPal (ILpal *Pal, ILenum DestFormat); +ILAPI ILubyte* ILAPIENTRY iGetFlipped (ILimage *Image); +ILAPI ILboolean ILAPIENTRY iMirror(); +ILAPI void ILAPIENTRY iFlipBuffer(ILubyte *buff, ILuint depth, ILuint line_size, ILuint line_num); +ILubyte* iFlipNewBuffer(ILubyte *buff, ILuint depth, ILuint line_size, ILuint line_num); +ILAPI void ILAPIENTRY iGetIntegervImage(ILimage *Image, ILenum Mode, ILint *Param); + +// Internal library functions in ILU +ILAPI ILimage* ILAPIENTRY iluRotate_(ILimage *Image, ILfloat Angle); +ILAPI ILimage* ILAPIENTRY iluRotate3D_(ILimage *Image, ILfloat x, ILfloat y, ILfloat z, ILfloat Angle); +ILAPI ILimage* ILAPIENTRY iluScale_(ILimage *Image, ILuint Width, ILuint Height, ILuint Depth); + +#ifdef __cplusplus +} +#endif + +#endif//IL_EXPORTS_H diff --git a/samples/DevIL/include/IL/il.h b/samples/DevIL/include/IL/il.h new file mode 100644 index 000000000..540a56eb3 --- /dev/null +++ b/samples/DevIL/include/IL/il.h @@ -0,0 +1,644 @@ +//----------------------------------------------------------------------------- +// +// ImageLib Sources +// Copyright (C) 2000-2009 by Denton Woods +// Last modified: 03/07/2009 +// +// Filename: IL/il.h +// +// Description: The main include file for DevIL +// +//----------------------------------------------------------------------------- + +// Doxygen comment +/*! \file il.h + The main include file for DevIL +*/ + +#ifndef __il_h_ +#ifndef __IL_H__ + +#define __il_h_ +#define __IL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +//this define controls if floats and doubles are clampled to [0..1] +//during conversion. It takes a little more time, but it is the correct +//way of doing this. If you are sure your floats are always valid, +//you can undefine this value... +#define CLAMP_HALF 1 +#define CLAMP_FLOATS 1 +#define CLAMP_DOUBLES 1 + +/*#ifdef _WIN32_WCE + #define IL_NO_EXR + #define IL_NO_GIF + #define IL_NO_JP2 + #define IL_NO_JPG + #define IL_NO_MNG + #define IL_NO_PNG + #define IL_NO_TIF + #define IL_NO_LCMS +#endif //_WIN32_WCE + +#ifdef DJGPP + #define IL_NO_EXR + #define IL_NO_GIF + #define IL_NO_JP2 + #define IL_NO_JPG + #define IL_NO_MNG + #define IL_NO_PNG + #define IL_NO_TIF + #define IL_NO_LCMS +#endif //DJGPP*/ + +#ifdef _WIN32 + #if (defined(IL_USE_PRAGMA_LIBS)) && (!defined(_IL_BUILD_LIBRARY)) + #if defined(_MSC_VER) || defined(__BORLANDC__) + #pragma comment(lib, "DevIL.lib") + #endif + #endif +#endif + +#ifdef RESTRICT_KEYWORD +#define RESTRICT restrict +#define CONST_RESTRICT const restrict +#else +#define RESTRICT +#define CONST_RESTRICT const +#endif + +#include + +typedef unsigned int ILenum; +typedef unsigned char ILboolean; +typedef unsigned int ILbitfield; +typedef signed char ILbyte; +typedef signed short ILshort; +typedef int ILint; +typedef size_t ILsizei; +typedef unsigned char ILubyte; +typedef unsigned short ILushort; +typedef unsigned int ILuint; +typedef float ILfloat; +typedef float ILclampf; +typedef double ILdouble; +typedef double ILclampd; + +#ifdef _MSC_VER +typedef __int64 ILint64; +typedef unsigned __int64 ILuint64; +#else +typedef long long int ILint64; +typedef long long unsigned int ILuint64; +#endif + + +#include +#ifdef _UNICODE + #ifndef _WIN32_WCE + #include + #endif + //if we use a define instead of a typedef, + //ILconst_string works as intended + #define ILchar wchar_t + #define ILstring wchar_t* + #define ILconst_string wchar_t const * +#else + //if we use a define instead of a typedef, + //ILconst_string works as intended + #define ILchar char + #define ILstring char* + #define ILconst_string char const * +#endif //_UNICODE + +#define IL_FALSE 0 +#define IL_TRUE 1 + +// Matches OpenGL's right now. +//! Data formats \link Formats Formats\endlink +#define IL_COLOUR_INDEX 0x1900 +#define IL_COLOR_INDEX 0x1900 +#define IL_ALPHA 0x1906 +#define IL_RGB 0x1907 +#define IL_RGBA 0x1908 +#define IL_BGR 0x80E0 +#define IL_BGRA 0x80E1 +#define IL_LUMINANCE 0x1909 +#define IL_LUMINANCE_ALPHA 0x190A + +//! Data types \link Types Types\endlink +#define IL_BYTE 0x1400 +#define IL_UNSIGNED_BYTE 0x1401 +#define IL_SHORT 0x1402 +#define IL_UNSIGNED_SHORT 0x1403 +#define IL_INT 0x1404 +#define IL_UNSIGNED_INT 0x1405 +#define IL_FLOAT 0x1406 +#define IL_DOUBLE 0x140A +#define IL_HALF 0x140B + + +#define IL_MAX_BYTE SCHAR_MAX +#define IL_MAX_UNSIGNED_BYTE UCHAR_MAX +#define IL_MAX_SHORT SHRT_MAX +#define IL_MAX_UNSIGNED_SHORT USHRT_MAX +#define IL_MAX_INT INT_MAX +#define IL_MAX_UNSIGNED_INT UINT_MAX + +#define IL_LIMIT(x,m,M) (xM?M:x)) +#define IL_CLAMP(x) IL_LIMIT(x,0,1) + +#define IL_VENDOR 0x1F00 +#define IL_LOAD_EXT 0x1F01 +#define IL_SAVE_EXT 0x1F02 + + +// +// IL-specific #define's +// + +#define IL_VERSION_1_7_8 1 +#define IL_VERSION 178 + + +// Attribute Bits +#define IL_ORIGIN_BIT 0x00000001 +#define IL_FILE_BIT 0x00000002 +#define IL_PAL_BIT 0x00000004 +#define IL_FORMAT_BIT 0x00000008 +#define IL_TYPE_BIT 0x00000010 +#define IL_COMPRESS_BIT 0x00000020 +#define IL_LOADFAIL_BIT 0x00000040 +#define IL_FORMAT_SPECIFIC_BIT 0x00000080 +#define IL_ALL_ATTRIB_BITS 0x000FFFFF + + +// Palette types +#define IL_PAL_NONE 0x0400 +#define IL_PAL_RGB24 0x0401 +#define IL_PAL_RGB32 0x0402 +#define IL_PAL_RGBA32 0x0403 +#define IL_PAL_BGR24 0x0404 +#define IL_PAL_BGR32 0x0405 +#define IL_PAL_BGRA32 0x0406 + + +// Image types +#define IL_TYPE_UNKNOWN 0x0000 +#define IL_BMP 0x0420 //!< Microsoft Windows Bitmap - .bmp extension +#define IL_CUT 0x0421 //!< Dr. Halo - .cut extension +#define IL_DOOM 0x0422 //!< DooM walls - no specific extension +#define IL_DOOM_FLAT 0x0423 //!< DooM flats - no specific extension +#define IL_ICO 0x0424 //!< Microsoft Windows Icons and Cursors - .ico and .cur extensions +#define IL_JPG 0x0425 //!< JPEG - .jpg, .jpe and .jpeg extensions +#define IL_JFIF 0x0425 //!< +#define IL_ILBM 0x0426 //!< Amiga IFF (FORM ILBM) - .iff, .ilbm, .lbm extensions +#define IL_PCD 0x0427 //!< Kodak PhotoCD - .pcd extension +#define IL_PCX 0x0428 //!< ZSoft PCX - .pcx extension +#define IL_PIC 0x0429 //!< PIC - .pic extension +#define IL_PNG 0x042A //!< Portable Network Graphics - .png extension +#define IL_PNM 0x042B //!< Portable Any Map - .pbm, .pgm, .ppm and .pnm extensions +#define IL_SGI 0x042C //!< Silicon Graphics - .sgi, .bw, .rgb and .rgba extensions +#define IL_TGA 0x042D //!< TrueVision Targa File - .tga, .vda, .icb and .vst extensions +#define IL_TIF 0x042E //!< Tagged Image File Format - .tif and .tiff extensions +#define IL_CHEAD 0x042F //!< C-Style Header - .h extension +#define IL_RAW 0x0430 //!< Raw Image Data - any extension +#define IL_MDL 0x0431 //!< Half-Life Model Texture - .mdl extension +#define IL_WAL 0x0432 //!< Quake 2 Texture - .wal extension +#define IL_LIF 0x0434 //!< Homeworld Texture - .lif extension +#define IL_MNG 0x0435 //!< Multiple-image Network Graphics - .mng extension +#define IL_JNG 0x0435 //!< +#define IL_GIF 0x0436 //!< Graphics Interchange Format - .gif extension +#define IL_DDS 0x0437 //!< DirectDraw Surface - .dds extension +#define IL_DCX 0x0438 //!< ZSoft Multi-PCX - .dcx extension +#define IL_PSD 0x0439 //!< Adobe PhotoShop - .psd extension +#define IL_EXIF 0x043A //!< +#define IL_PSP 0x043B //!< PaintShop Pro - .psp extension +#define IL_PIX 0x043C //!< PIX - .pix extension +#define IL_PXR 0x043D //!< Pixar - .pxr extension +#define IL_XPM 0x043E //!< X Pixel Map - .xpm extension +#define IL_HDR 0x043F //!< Radiance High Dynamic Range - .hdr extension +#define IL_ICNS 0x0440 //!< Macintosh Icon - .icns extension +#define IL_JP2 0x0441 //!< Jpeg 2000 - .jp2 extension +#define IL_EXR 0x0442 //!< OpenEXR - .exr extension +#define IL_WDP 0x0443 //!< Microsoft HD Photo - .wdp and .hdp extension +#define IL_VTF 0x0444 //!< Valve Texture Format - .vtf extension +#define IL_WBMP 0x0445 //!< Wireless Bitmap - .wbmp extension +#define IL_SUN 0x0446 //!< Sun Raster - .sun, .ras, .rs, .im1, .im8, .im24 and .im32 extensions +#define IL_IFF 0x0447 //!< Interchange File Format - .iff extension +#define IL_TPL 0x0448 //!< Gamecube Texture - .tpl extension +#define IL_FITS 0x0449 //!< Flexible Image Transport System - .fit and .fits extensions +#define IL_DICOM 0x044A //!< Digital Imaging and Communications in Medicine (DICOM) - .dcm and .dicom extensions +#define IL_IWI 0x044B //!< Call of Duty Infinity Ward Image - .iwi extension +#define IL_BLP 0x044C //!< Blizzard Texture Format - .blp extension +#define IL_FTX 0x044D //!< Heavy Metal: FAKK2 Texture - .ftx extension +#define IL_ROT 0x044E //!< Homeworld 2 - Relic Texture - .rot extension +#define IL_TEXTURE 0x044F //!< Medieval II: Total War Texture - .texture extension +#define IL_DPX 0x0450 //!< Digital Picture Exchange - .dpx extension +#define IL_UTX 0x0451 //!< Unreal (and Unreal Tournament) Texture - .utx extension +#define IL_MP3 0x0452 //!< MPEG-1 Audio Layer 3 - .mp3 extension + + +#define IL_JASC_PAL 0x0475 //!< PaintShop Pro Palette + + +// Error Types +#define IL_NO_ERROR 0x0000 +#define IL_INVALID_ENUM 0x0501 +#define IL_OUT_OF_MEMORY 0x0502 +#define IL_FORMAT_NOT_SUPPORTED 0x0503 +#define IL_INTERNAL_ERROR 0x0504 +#define IL_INVALID_VALUE 0x0505 +#define IL_ILLEGAL_OPERATION 0x0506 +#define IL_ILLEGAL_FILE_VALUE 0x0507 +#define IL_INVALID_FILE_HEADER 0x0508 +#define IL_INVALID_PARAM 0x0509 +#define IL_COULD_NOT_OPEN_FILE 0x050A +#define IL_INVALID_EXTENSION 0x050B +#define IL_FILE_ALREADY_EXISTS 0x050C +#define IL_OUT_FORMAT_SAME 0x050D +#define IL_STACK_OVERFLOW 0x050E +#define IL_STACK_UNDERFLOW 0x050F +#define IL_INVALID_CONVERSION 0x0510 +#define IL_BAD_DIMENSIONS 0x0511 +#define IL_FILE_READ_ERROR 0x0512 // 05/12/2002: Addition by Sam. +#define IL_FILE_WRITE_ERROR 0x0512 + +#define IL_LIB_GIF_ERROR 0x05E1 +#define IL_LIB_JPEG_ERROR 0x05E2 +#define IL_LIB_PNG_ERROR 0x05E3 +#define IL_LIB_TIFF_ERROR 0x05E4 +#define IL_LIB_MNG_ERROR 0x05E5 +#define IL_LIB_JP2_ERROR 0x05E6 +#define IL_LIB_EXR_ERROR 0x05E7 +#define IL_UNKNOWN_ERROR 0x05FF + + +// Origin Definitions +#define IL_ORIGIN_SET 0x0600 +#define IL_ORIGIN_LOWER_LEFT 0x0601 +#define IL_ORIGIN_UPPER_LEFT 0x0602 +#define IL_ORIGIN_MODE 0x0603 + + +// Format and Type Mode Definitions +#define IL_FORMAT_SET 0x0610 +#define IL_FORMAT_MODE 0x0611 +#define IL_TYPE_SET 0x0612 +#define IL_TYPE_MODE 0x0613 + + +// File definitions +#define IL_FILE_OVERWRITE 0x0620 +#define IL_FILE_MODE 0x0621 + + +// Palette definitions +#define IL_CONV_PAL 0x0630 + + +// Load fail definitions +#define IL_DEFAULT_ON_FAIL 0x0632 + + +// Key colour and alpha definitions +#define IL_USE_KEY_COLOUR 0x0635 +#define IL_USE_KEY_COLOR 0x0635 +#define IL_BLIT_BLEND 0x0636 + + +// Interlace definitions +#define IL_SAVE_INTERLACED 0x0639 +#define IL_INTERLACE_MODE 0x063A + + +// Quantization definitions +#define IL_QUANTIZATION_MODE 0x0640 +#define IL_WU_QUANT 0x0641 +#define IL_NEU_QUANT 0x0642 +#define IL_NEU_QUANT_SAMPLE 0x0643 +#define IL_MAX_QUANT_INDEXS 0x0644 //XIX : ILint : Maximum number of colors to reduce to, default of 256. and has a range of 2-256 +#define IL_MAX_QUANT_INDICES 0x0644 // Redefined, since the above #define is misspelled + + +// Hints +#define IL_FASTEST 0x0660 +#define IL_LESS_MEM 0x0661 +#define IL_DONT_CARE 0x0662 +#define IL_MEM_SPEED_HINT 0x0665 +#define IL_USE_COMPRESSION 0x0666 +#define IL_NO_COMPRESSION 0x0667 +#define IL_COMPRESSION_HINT 0x0668 + + +// Compression +#define IL_NVIDIA_COMPRESS 0x0670 +#define IL_SQUISH_COMPRESS 0x0671 + + +// Subimage types +#define IL_SUB_NEXT 0x0680 +#define IL_SUB_MIPMAP 0x0681 +#define IL_SUB_LAYER 0x0682 + + +// Compression definitions +#define IL_COMPRESS_MODE 0x0700 +#define IL_COMPRESS_NONE 0x0701 +#define IL_COMPRESS_RLE 0x0702 +#define IL_COMPRESS_LZO 0x0703 +#define IL_COMPRESS_ZLIB 0x0704 + + +// File format-specific values +#define IL_TGA_CREATE_STAMP 0x0710 +#define IL_JPG_QUALITY 0x0711 +#define IL_PNG_INTERLACE 0x0712 +#define IL_TGA_RLE 0x0713 +#define IL_BMP_RLE 0x0714 +#define IL_SGI_RLE 0x0715 +#define IL_TGA_ID_STRING 0x0717 +#define IL_TGA_AUTHNAME_STRING 0x0718 +#define IL_TGA_AUTHCOMMENT_STRING 0x0719 +#define IL_PNG_AUTHNAME_STRING 0x071A +#define IL_PNG_TITLE_STRING 0x071B +#define IL_PNG_DESCRIPTION_STRING 0x071C +#define IL_TIF_DESCRIPTION_STRING 0x071D +#define IL_TIF_HOSTCOMPUTER_STRING 0x071E +#define IL_TIF_DOCUMENTNAME_STRING 0x071F +#define IL_TIF_AUTHNAME_STRING 0x0720 +#define IL_JPG_SAVE_FORMAT 0x0721 +#define IL_CHEAD_HEADER_STRING 0x0722 +#define IL_PCD_PICNUM 0x0723 +#define IL_PNG_ALPHA_INDEX 0x0724 //XIX : ILint : the color in the palette at this index value (0-255) is considered transparent, -1 for no trasparent color +#define IL_JPG_PROGRESSIVE 0x0725 +#define IL_VTF_COMP 0x0726 + + +// DXTC definitions +#define IL_DXTC_FORMAT 0x0705 +#define IL_DXT1 0x0706 +#define IL_DXT2 0x0707 +#define IL_DXT3 0x0708 +#define IL_DXT4 0x0709 +#define IL_DXT5 0x070A +#define IL_DXT_NO_COMP 0x070B +#define IL_KEEP_DXTC_DATA 0x070C +#define IL_DXTC_DATA_FORMAT 0x070D +#define IL_3DC 0x070E +#define IL_RXGB 0x070F +#define IL_ATI1N 0x0710 +#define IL_DXT1A 0x0711 // Normally the same as IL_DXT1, except for nVidia Texture Tools. + +// Environment map definitions +#define IL_CUBEMAP_POSITIVEX 0x00000400 +#define IL_CUBEMAP_NEGATIVEX 0x00000800 +#define IL_CUBEMAP_POSITIVEY 0x00001000 +#define IL_CUBEMAP_NEGATIVEY 0x00002000 +#define IL_CUBEMAP_POSITIVEZ 0x00004000 +#define IL_CUBEMAP_NEGATIVEZ 0x00008000 +#define IL_SPHEREMAP 0x00010000 + + +// Values +#define IL_VERSION_NUM 0x0DE2 +#define IL_IMAGE_WIDTH 0x0DE4 +#define IL_IMAGE_HEIGHT 0x0DE5 +#define IL_IMAGE_DEPTH 0x0DE6 +#define IL_IMAGE_SIZE_OF_DATA 0x0DE7 +#define IL_IMAGE_BPP 0x0DE8 +#define IL_IMAGE_BYTES_PER_PIXEL 0x0DE8 +#define IL_IMAGE_BPP 0x0DE8 +#define IL_IMAGE_BITS_PER_PIXEL 0x0DE9 +#define IL_IMAGE_FORMAT 0x0DEA +#define IL_IMAGE_TYPE 0x0DEB +#define IL_PALETTE_TYPE 0x0DEC +#define IL_PALETTE_SIZE 0x0DED +#define IL_PALETTE_BPP 0x0DEE +#define IL_PALETTE_NUM_COLS 0x0DEF +#define IL_PALETTE_BASE_TYPE 0x0DF0 +#define IL_NUM_FACES 0x0DE1 +#define IL_NUM_IMAGES 0x0DF1 +#define IL_NUM_MIPMAPS 0x0DF2 +#define IL_NUM_LAYERS 0x0DF3 +#define IL_ACTIVE_IMAGE 0x0DF4 +#define IL_ACTIVE_MIPMAP 0x0DF5 +#define IL_ACTIVE_LAYER 0x0DF6 +#define IL_ACTIVE_FACE 0x0E00 +#define IL_CUR_IMAGE 0x0DF7 +#define IL_IMAGE_DURATION 0x0DF8 +#define IL_IMAGE_PLANESIZE 0x0DF9 +#define IL_IMAGE_BPC 0x0DFA +#define IL_IMAGE_OFFX 0x0DFB +#define IL_IMAGE_OFFY 0x0DFC +#define IL_IMAGE_CUBEFLAGS 0x0DFD +#define IL_IMAGE_ORIGIN 0x0DFE +#define IL_IMAGE_CHANNELS 0x0DFF + +# if defined __GNUC__ && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)) +// __attribute__((deprecated)) is supported by GCC 3.1 and later. +# define DEPRECATED(D) D __attribute__((deprecated)) +# elif defined _MSC_VER && _MSC_VER >= 1300 +// __declspec(deprecated) is supported by MSVC 7.0 and later. +# define DEPRECATED(D) __declspec(deprecated) D +# else +# define DEPRECATED (D) D +# endif + +// +// Section shamelessly modified from the glut header. +// + +// This is from Win32's +#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__) + #define ILAPIENTRY __stdcall + #define IL_PACKSTRUCT +//#elif defined(linux) || defined(MACOSX) || defined(__CYGWIN__) //fix bug 840364 +#elif defined( __GNUC__ ) + // this should work for any of the above commented platforms + // plus any platform using GCC + #ifdef __MINGW32__ + #define ILAPIENTRY __stdcall + #else + #define ILAPIENTRY + #endif + #define IL_PACKSTRUCT __attribute__ ((packed)) +#else + #define ILAPIENTRY + #define IL_PACKSTRUCT +#endif + +// This is from Win32's and +#if defined(__LCC__) + #define ILAPI __stdcall +#elif defined(_WIN32) //changed 20031221 to fix bug 840421 + #ifdef IL_STATIC_LIB + #define ILAPI + #else + #ifdef _IL_BUILD_LIBRARY + #define ILAPI __declspec(dllexport) + #else + #define ILAPI __declspec(dllimport) + #endif + #endif +#elif __APPLE__ + #define ILAPI extern +#else + #define ILAPI +#endif + + +#define IL_SEEK_SET 0 +#define IL_SEEK_CUR 1 +#define IL_SEEK_END 2 +#define IL_EOF -1 + + +// Callback functions for file reading +typedef void* ILHANDLE; +typedef void (ILAPIENTRY *fCloseRProc)(ILHANDLE); +typedef ILboolean (ILAPIENTRY *fEofProc) (ILHANDLE); +typedef ILint (ILAPIENTRY *fGetcProc) (ILHANDLE); +typedef ILHANDLE (ILAPIENTRY *fOpenRProc) (ILconst_string); +typedef ILint (ILAPIENTRY *fReadProc) (void*, ILuint, ILuint, ILHANDLE); +typedef ILint (ILAPIENTRY *fSeekRProc) (ILHANDLE, ILint, ILint); +typedef ILint (ILAPIENTRY *fTellRProc) (ILHANDLE); + +// Callback functions for file writing +typedef void (ILAPIENTRY *fCloseWProc)(ILHANDLE); +typedef ILHANDLE (ILAPIENTRY *fOpenWProc) (ILconst_string); +typedef ILint (ILAPIENTRY *fPutcProc) (ILubyte, ILHANDLE); +typedef ILint (ILAPIENTRY *fSeekWProc) (ILHANDLE, ILint, ILint); +typedef ILint (ILAPIENTRY *fTellWProc) (ILHANDLE); +typedef ILint (ILAPIENTRY *fWriteProc) (const void*, ILuint, ILuint, ILHANDLE); + +// Callback functions for allocation and deallocation +typedef void* (ILAPIENTRY *mAlloc)(const ILsizei); +typedef void (ILAPIENTRY *mFree) (const void* CONST_RESTRICT); + +// Registered format procedures +typedef ILenum (ILAPIENTRY *IL_LOADPROC)(ILconst_string); +typedef ILenum (ILAPIENTRY *IL_SAVEPROC)(ILconst_string); + + +// ImageLib Functions +ILAPI ILboolean ILAPIENTRY ilActiveFace(ILuint Number); +ILAPI ILboolean ILAPIENTRY ilActiveImage(ILuint Number); +ILAPI ILboolean ILAPIENTRY ilActiveLayer(ILuint Number); +ILAPI ILboolean ILAPIENTRY ilActiveMipmap(ILuint Number); +ILAPI ILboolean ILAPIENTRY ilApplyPal(ILconst_string FileName); +ILAPI ILboolean ILAPIENTRY ilApplyProfile(ILstring InProfile, ILstring OutProfile); +ILAPI void ILAPIENTRY ilBindImage(ILuint Image); +ILAPI ILboolean ILAPIENTRY ilBlit(ILuint Source, ILint DestX, ILint DestY, ILint DestZ, ILuint SrcX, ILuint SrcY, ILuint SrcZ, ILuint Width, ILuint Height, ILuint Depth); +ILAPI ILboolean ILAPIENTRY ilClampNTSC(void); +ILAPI void ILAPIENTRY ilClearColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha); +ILAPI ILboolean ILAPIENTRY ilClearImage(void); +ILAPI ILuint ILAPIENTRY ilCloneCurImage(void); +ILAPI ILubyte* ILAPIENTRY ilCompressDXT(ILubyte *Data, ILuint Width, ILuint Height, ILuint Depth, ILenum DXTCFormat, ILuint *DXTCSize); +ILAPI ILboolean ILAPIENTRY ilCompressFunc(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilConvertImage(ILenum DestFormat, ILenum DestType); +ILAPI ILboolean ILAPIENTRY ilConvertPal(ILenum DestFormat); +ILAPI ILboolean ILAPIENTRY ilCopyImage(ILuint Src); +ILAPI ILuint ILAPIENTRY ilCopyPixels(ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, void *Data); +ILAPI ILuint ILAPIENTRY ilCreateSubImage(ILenum Type, ILuint Num); +ILAPI ILboolean ILAPIENTRY ilDefaultImage(void); +ILAPI void ILAPIENTRY ilDeleteImage(const ILuint Num); +ILAPI void ILAPIENTRY ilDeleteImages(ILsizei Num, const ILuint *Images); +ILAPI ILenum ILAPIENTRY ilDetermineType(ILconst_string FileName); +ILAPI ILenum ILAPIENTRY ilDetermineTypeF(ILHANDLE File); +ILAPI ILenum ILAPIENTRY ilDetermineTypeL(const void *Lump, ILuint Size); +ILAPI ILboolean ILAPIENTRY ilDisable(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilDxtcDataToImage(void); +ILAPI ILboolean ILAPIENTRY ilDxtcDataToSurface(void); +ILAPI ILboolean ILAPIENTRY ilEnable(ILenum Mode); +ILAPI void ILAPIENTRY ilFlipSurfaceDxtcData(void); +ILAPI ILboolean ILAPIENTRY ilFormatFunc(ILenum Mode); +ILAPI void ILAPIENTRY ilGenImages(ILsizei Num, ILuint *Images); +ILAPI ILuint ILAPIENTRY ilGenImage(void); +ILAPI ILubyte* ILAPIENTRY ilGetAlpha(ILenum Type); +ILAPI ILboolean ILAPIENTRY ilGetBoolean(ILenum Mode); +ILAPI void ILAPIENTRY ilGetBooleanv(ILenum Mode, ILboolean *Param); +ILAPI ILubyte* ILAPIENTRY ilGetData(void); +ILAPI ILuint ILAPIENTRY ilGetDXTCData(void *Buffer, ILuint BufferSize, ILenum DXTCFormat); +ILAPI ILenum ILAPIENTRY ilGetError(void); +ILAPI ILint ILAPIENTRY ilGetInteger(ILenum Mode); +ILAPI void ILAPIENTRY ilGetIntegerv(ILenum Mode, ILint *Param); +ILAPI ILuint ILAPIENTRY ilGetLumpPos(void); +ILAPI ILubyte* ILAPIENTRY ilGetPalette(void); +ILAPI ILconst_string ILAPIENTRY ilGetString(ILenum StringName); +ILAPI void ILAPIENTRY ilHint(ILenum Target, ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilInvertSurfaceDxtcDataAlpha(void); +ILAPI void ILAPIENTRY ilInit(void); +ILAPI ILboolean ILAPIENTRY ilImageToDxtcData(ILenum Format); +ILAPI ILboolean ILAPIENTRY ilIsDisabled(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilIsEnabled(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilIsImage(ILuint Image); +ILAPI ILboolean ILAPIENTRY ilIsValid(ILenum Type, ILconst_string FileName); +ILAPI ILboolean ILAPIENTRY ilIsValidF(ILenum Type, ILHANDLE File); +ILAPI ILboolean ILAPIENTRY ilIsValidL(ILenum Type, void *Lump, ILuint Size); +ILAPI void ILAPIENTRY ilKeyColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha); +ILAPI ILboolean ILAPIENTRY ilLoad(ILenum Type, ILconst_string FileName); +ILAPI ILboolean ILAPIENTRY ilLoadF(ILenum Type, ILHANDLE File); +ILAPI ILboolean ILAPIENTRY ilLoadImage(ILconst_string FileName); +ILAPI ILboolean ILAPIENTRY ilLoadL(ILenum Type, const void *Lump, ILuint Size); +ILAPI ILboolean ILAPIENTRY ilLoadPal(ILconst_string FileName); +ILAPI void ILAPIENTRY ilModAlpha(ILdouble AlphaValue); +ILAPI ILboolean ILAPIENTRY ilOriginFunc(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilOverlayImage(ILuint Source, ILint XCoord, ILint YCoord, ILint ZCoord); +ILAPI void ILAPIENTRY ilPopAttrib(void); +ILAPI void ILAPIENTRY ilPushAttrib(ILuint Bits); +ILAPI void ILAPIENTRY ilRegisterFormat(ILenum Format); +ILAPI ILboolean ILAPIENTRY ilRegisterLoad(ILconst_string Ext, IL_LOADPROC Load); +ILAPI ILboolean ILAPIENTRY ilRegisterMipNum(ILuint Num); +ILAPI ILboolean ILAPIENTRY ilRegisterNumFaces(ILuint Num); +ILAPI ILboolean ILAPIENTRY ilRegisterNumImages(ILuint Num); +ILAPI void ILAPIENTRY ilRegisterOrigin(ILenum Origin); +ILAPI void ILAPIENTRY ilRegisterPal(void *Pal, ILuint Size, ILenum Type); +ILAPI ILboolean ILAPIENTRY ilRegisterSave(ILconst_string Ext, IL_SAVEPROC Save); +ILAPI void ILAPIENTRY ilRegisterType(ILenum Type); +ILAPI ILboolean ILAPIENTRY ilRemoveLoad(ILconst_string Ext); +ILAPI ILboolean ILAPIENTRY ilRemoveSave(ILconst_string Ext); +ILAPI void ILAPIENTRY ilResetMemory(void); // Deprecated +ILAPI void ILAPIENTRY ilResetRead(void); +ILAPI void ILAPIENTRY ilResetWrite(void); +ILAPI ILboolean ILAPIENTRY ilSave(ILenum Type, ILconst_string FileName); +ILAPI ILuint ILAPIENTRY ilSaveF(ILenum Type, ILHANDLE File); +ILAPI ILboolean ILAPIENTRY ilSaveImage(ILconst_string FileName); +ILAPI ILuint ILAPIENTRY ilSaveL(ILenum Type, void *Lump, ILuint Size); +ILAPI ILboolean ILAPIENTRY ilSavePal(ILconst_string FileName); +ILAPI ILboolean ILAPIENTRY ilSetAlpha(ILdouble AlphaValue); +ILAPI ILboolean ILAPIENTRY ilSetData(void *Data); +ILAPI ILboolean ILAPIENTRY ilSetDuration(ILuint Duration); +ILAPI void ILAPIENTRY ilSetInteger(ILenum Mode, ILint Param); +ILAPI void ILAPIENTRY ilSetMemory(mAlloc, mFree); +ILAPI void ILAPIENTRY ilSetPixels(ILint XOff, ILint YOff, ILint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, void *Data); +ILAPI void ILAPIENTRY ilSetRead(fOpenRProc, fCloseRProc, fEofProc, fGetcProc, fReadProc, fSeekRProc, fTellRProc); +ILAPI void ILAPIENTRY ilSetString(ILenum Mode, const char *String); +ILAPI void ILAPIENTRY ilSetWrite(fOpenWProc, fCloseWProc, fPutcProc, fSeekWProc, fTellWProc, fWriteProc); +ILAPI void ILAPIENTRY ilShutDown(void); +ILAPI ILboolean ILAPIENTRY ilSurfaceToDxtcData(ILenum Format); +ILAPI ILboolean ILAPIENTRY ilTexImage(ILuint Width, ILuint Height, ILuint Depth, ILubyte NumChannels, ILenum Format, ILenum Type, void *Data); +ILAPI ILboolean ILAPIENTRY ilTexImageDxtc(ILint w, ILint h, ILint d, ILenum DxtFormat, const ILubyte* data); +ILAPI ILenum ILAPIENTRY ilTypeFromExt(ILconst_string FileName); +ILAPI ILboolean ILAPIENTRY ilTypeFunc(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilLoadData(ILconst_string FileName, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp); +ILAPI ILboolean ILAPIENTRY ilLoadDataF(ILHANDLE File, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp); +ILAPI ILboolean ILAPIENTRY ilLoadDataL(void *Lump, ILuint Size, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp); +ILAPI ILboolean ILAPIENTRY ilSaveData(ILconst_string FileName); + +// For all those weirdos that spell "colour" without the 'u'. +#define ilClearColor ilClearColour +#define ilKeyColor ilKeyColour + +#define imemclear(x,y) memset(x,0,y); + +#ifdef __cplusplus +} +#endif + +#endif // __IL_H__ +#endif // __il_h__ diff --git a/samples/DevIL/include/IL/il_wrap.h b/samples/DevIL/include/IL/il_wrap.h new file mode 100644 index 000000000..5cf9b0e0a --- /dev/null +++ b/samples/DevIL/include/IL/il_wrap.h @@ -0,0 +1,205 @@ +#ifndef WRAPPER_H +#define WRAPPER_H + +/*#include +#include */ +#include // Probably only have to #include this one + +#ifdef _MSC_VER + #ifndef _IL_WRAP_BUILD_LIB + #pragma comment(lib, "il_wrap.lib") + #endif +#endif + +class ilImage +{ +public: + ilImage(); + ilImage(char *); + ilImage(const ilImage &); + virtual ~ilImage(); + + ILboolean Load(char *); + ILboolean Load(char *, ILenum); + ILboolean Save(char *); + ILboolean Save(char *, ILenum); + + + // ImageLib functions + ILboolean ActiveImage(ILuint); + ILboolean ActiveLayer(ILuint); + ILboolean ActiveMipmap(ILuint); + ILboolean Clear(void); + ILvoid ClearColour(ILclampf, ILclampf, ILclampf, ILclampf); + ILboolean Convert(ILenum); + ILboolean Copy(ILuint); + ILboolean Default(void); + ILboolean Flip(void); + ILboolean SwapColours(void); + ILboolean Resize(ILuint, ILuint, ILuint); + ILboolean TexImage(ILuint, ILuint, ILuint, ILubyte, ILenum, ILenum, ILvoid*); + + + // Image handling + ILvoid Bind(void) const; + ILvoid Bind(ILuint); + ILvoid Close(void) { this->Delete(); } + ILvoid Delete(void); + ILvoid iGenBind(); + ILenum PaletteAlphaIndex(); + + // Image characteristics + ILuint Width(void); + ILuint Height(void); + ILuint Depth(void); + ILubyte Bpp(void); + ILubyte Bitpp(void); + ILenum PaletteType(void); + ILenum Format(void); + ILenum Type(void); + ILuint NumImages(void); + ILuint NumMipmaps(void); + ILuint GetId(void) const; + ILenum GetOrigin(void); + ILubyte *GetData(void); + ILubyte *GetPalette(void); + + + // Rendering + ILuint BindImage(void); + ILuint BindImage(ILenum); + + + // Operators + ilImage& operator = (ILuint); + ilImage& operator = (const ilImage &); + + +protected: + ILuint Id; + +private: + ILvoid iStartUp(); + + +}; + + +class ilFilters +{ +public: + static ILboolean Alienify(ilImage &); + static ILboolean BlurAvg(ilImage &, ILuint Iter); + static ILboolean BlurGaussian(ilImage &, ILuint Iter); + static ILboolean Contrast(ilImage &, ILfloat Contrast); + static ILboolean EdgeDetectE(ilImage &); + static ILboolean EdgeDetectP(ilImage &); + static ILboolean EdgeDetectS(ilImage &); + static ILboolean Emboss(ilImage &); + static ILboolean Gamma(ilImage &, ILfloat Gamma); + static ILboolean Negative(ilImage &); + static ILboolean Noisify(ilImage &, ILubyte Factor); + static ILboolean Pixelize(ilImage &, ILuint PixSize); + static ILboolean Saturate(ilImage &, ILfloat Saturation); + static ILboolean Saturate(ilImage &, ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation); + static ILboolean ScaleColours(ilImage &, ILfloat r, ILfloat g, ILfloat b); + static ILboolean Sharpen(ilImage &, ILfloat Factor, ILuint Iter); +}; + + +#ifdef ILUT_USE_OPENGL +class ilOgl +{ +public: + static ILvoid Init(void); + static GLuint BindTex(ilImage &); + static ILboolean Upload(ilImage &, ILuint); + static GLuint Mipmap(ilImage &); + static ILboolean Screen(void); + static ILboolean Screenie(void); +}; +#endif//ILUT_USE_OPENGL + + +#ifdef ILUT_USE_ALLEGRO +class ilAlleg +{ +public: + static ILvoid Init(void); + static BITMAP *Convert(ilImage &); +}; +#endif//ILUT_USE_ALLEGRO + + +#ifdef ILUT_USE_WIN32 +class ilWin32 +{ +public: + static ILvoid Init(void); + static HBITMAP Convert(ilImage &); + static ILboolean GetClipboard(ilImage &); + static ILvoid GetInfo(ilImage &, BITMAPINFO *Info); + static ILubyte *GetPadData(ilImage &); + static HPALETTE GetPal(ilImage &); + static ILboolean GetResource(ilImage &, HINSTANCE hInst, ILint ID, char *ResourceType); + static ILboolean GetResource(ilImage &, HINSTANCE hInst, ILint ID, char *ResourceType, ILenum Type); + static ILboolean SetClipboard(ilImage &); +}; +#endif//ILUT_USE_WIN32 + + +class ilValidate +{ +public: + static ILboolean Valid(ILenum, char *); + static ILboolean Valid(ILenum, FILE *); + static ILboolean Valid(ILenum, ILvoid *, ILuint); + +protected: + +private: + +}; + + +class ilState +{ +public: + static ILboolean Disable(ILenum); + static ILboolean Enable(ILenum); + static ILvoid Get(ILenum, ILboolean &); + static ILvoid Get(ILenum, ILint &); + static ILboolean GetBool(ILenum); + static ILint GetInt(ILenum); + static const char *GetString(ILenum); + static ILboolean IsDisabled(ILenum); + static ILboolean IsEnabled(ILenum); + static ILboolean Origin(ILenum); + static ILvoid Pop(void); + static ILvoid Push(ILuint); + + +protected: + +private: + +}; + + +class ilError +{ +public: + static ILvoid Check(ILvoid (*Callback)(const char*)); + static ILvoid Check(ILvoid (*Callback)(ILenum)); + static ILenum Get(void); + static const char *String(void); + static const char *String(ILenum); + +protected: + +private: + +}; + + +#endif//WRAPPER_H diff --git a/samples/DevIL/include/IL/ilu.h b/samples/DevIL/include/IL/ilu.h new file mode 100644 index 000000000..49871d79f --- /dev/null +++ b/samples/DevIL/include/IL/ilu.h @@ -0,0 +1,195 @@ +//----------------------------------------------------------------------------- +// +// ImageLib Utility Sources +// Copyright (C) 2000-2009 by Denton Woods +// Last modified: 03/07/2009 +// +// Filename: IL/ilu.h +// +// Description: The main include file for ILU +// +//----------------------------------------------------------------------------- + +// Doxygen comment +/*! \file ilu.h + The main include file for ILU +*/ + +#ifndef __ilu_h_ +#ifndef __ILU_H__ + +#define __ilu_h_ +#define __ILU_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _WIN32 + #if (defined(IL_USE_PRAGMA_LIBS)) && (!defined(_IL_BUILD_LIBRARY)) + #if defined(_MSC_VER) || defined(__BORLANDC__) + #pragma comment(lib, "ILU.lib") + #endif + #endif +#endif + + +#define ILU_VERSION_1_7_8 1 +#define ILU_VERSION 178 + + +#define ILU_FILTER 0x2600 +#define ILU_NEAREST 0x2601 +#define ILU_LINEAR 0x2602 +#define ILU_BILINEAR 0x2603 +#define ILU_SCALE_BOX 0x2604 +#define ILU_SCALE_TRIANGLE 0x2605 +#define ILU_SCALE_BELL 0x2606 +#define ILU_SCALE_BSPLINE 0x2607 +#define ILU_SCALE_LANCZOS3 0x2608 +#define ILU_SCALE_MITCHELL 0x2609 + + +// Error types +#define ILU_INVALID_ENUM 0x0501 +#define ILU_OUT_OF_MEMORY 0x0502 +#define ILU_INTERNAL_ERROR 0x0504 +#define ILU_INVALID_VALUE 0x0505 +#define ILU_ILLEGAL_OPERATION 0x0506 +#define ILU_INVALID_PARAM 0x0509 + + +// Values +#define ILU_PLACEMENT 0x0700 +#define ILU_LOWER_LEFT 0x0701 +#define ILU_LOWER_RIGHT 0x0702 +#define ILU_UPPER_LEFT 0x0703 +#define ILU_UPPER_RIGHT 0x0704 +#define ILU_CENTER 0x0705 +#define ILU_CONVOLUTION_MATRIX 0x0710 + +#define ILU_VERSION_NUM IL_VERSION_NUM +#define ILU_VENDOR IL_VENDOR + + +// Languages +#define ILU_ENGLISH 0x0800 +#define ILU_ARABIC 0x0801 +#define ILU_DUTCH 0x0802 +#define ILU_JAPANESE 0x0803 +#define ILU_SPANISH 0x0804 +#define ILU_GERMAN 0x0805 +#define ILU_FRENCH 0x0806 + + +// Filters +/* +#define ILU_FILTER_BLUR 0x0803 +#define ILU_FILTER_GAUSSIAN_3x3 0x0804 +#define ILU_FILTER_GAUSSIAN_5X5 0x0805 +#define ILU_FILTER_EMBOSS1 0x0807 +#define ILU_FILTER_EMBOSS2 0x0808 +#define ILU_FILTER_LAPLACIAN1 0x080A +#define ILU_FILTER_LAPLACIAN2 0x080B +#define ILU_FILTER_LAPLACIAN3 0x080C +#define ILU_FILTER_LAPLACIAN4 0x080D +#define ILU_FILTER_SHARPEN1 0x080E +#define ILU_FILTER_SHARPEN2 0x080F +#define ILU_FILTER_SHARPEN3 0x0810 +*/ + + +typedef struct ILinfo +{ + ILuint Id; // the image's id + ILubyte *Data; // the image's data + ILuint Width; // the image's width + ILuint Height; // the image's height + ILuint Depth; // the image's depth + ILubyte Bpp; // bytes per pixel (not bits) of the image + ILuint SizeOfData; // the total size of the data (in bytes) + ILenum Format; // image format (in IL enum style) + ILenum Type; // image type (in IL enum style) + ILenum Origin; // origin of the image + ILubyte *Palette; // the image's palette + ILenum PalType; // palette type + ILuint PalSize; // palette size + ILenum CubeFlags; // flags for what cube map sides are present + ILuint NumNext; // number of images following + ILuint NumMips; // number of mipmaps + ILuint NumLayers; // number of layers +} ILinfo; + + +typedef struct ILpointf { + ILfloat x; + ILfloat y; +} ILpointf; + +typedef struct ILpointi { + ILint x; + ILint y; +} ILpointi; + +ILAPI ILboolean ILAPIENTRY iluAlienify(void); +ILAPI ILboolean ILAPIENTRY iluBlurAvg(ILuint Iter); +ILAPI ILboolean ILAPIENTRY iluBlurGaussian(ILuint Iter); +ILAPI ILboolean ILAPIENTRY iluBuildMipmaps(void); +ILAPI ILuint ILAPIENTRY iluColoursUsed(void); +ILAPI ILboolean ILAPIENTRY iluCompareImage(ILuint Comp); +ILAPI ILboolean ILAPIENTRY iluContrast(ILfloat Contrast); +ILAPI ILboolean ILAPIENTRY iluCrop(ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, ILuint Height, ILuint Depth); +ILAPI void ILAPIENTRY iluDeleteImage(ILuint Id); // Deprecated +ILAPI ILboolean ILAPIENTRY iluEdgeDetectE(void); +ILAPI ILboolean ILAPIENTRY iluEdgeDetectP(void); +ILAPI ILboolean ILAPIENTRY iluEdgeDetectS(void); +ILAPI ILboolean ILAPIENTRY iluEmboss(void); +ILAPI ILboolean ILAPIENTRY iluEnlargeCanvas(ILuint Width, ILuint Height, ILuint Depth); +ILAPI ILboolean ILAPIENTRY iluEnlargeImage(ILfloat XDim, ILfloat YDim, ILfloat ZDim); +ILAPI ILboolean ILAPIENTRY iluEqualize(void); +ILAPI ILconst_string ILAPIENTRY iluErrorString(ILenum Error); +ILAPI ILboolean ILAPIENTRY iluConvolution(ILint *matrix, ILint scale, ILint bias); +ILAPI ILboolean ILAPIENTRY iluFlipImage(void); +ILAPI ILboolean ILAPIENTRY iluGammaCorrect(ILfloat Gamma); +ILAPI ILuint ILAPIENTRY iluGenImage(void); // Deprecated +ILAPI void ILAPIENTRY iluGetImageInfo(ILinfo *Info); +ILAPI ILint ILAPIENTRY iluGetInteger(ILenum Mode); +ILAPI void ILAPIENTRY iluGetIntegerv(ILenum Mode, ILint *Param); +ILAPI ILstring ILAPIENTRY iluGetString(ILenum StringName); +ILAPI void ILAPIENTRY iluImageParameter(ILenum PName, ILenum Param); +ILAPI void ILAPIENTRY iluInit(void); +ILAPI ILboolean ILAPIENTRY iluInvertAlpha(void); +ILAPI ILuint ILAPIENTRY iluLoadImage(ILconst_string FileName); +ILAPI ILboolean ILAPIENTRY iluMirror(void); +ILAPI ILboolean ILAPIENTRY iluNegative(void); +ILAPI ILboolean ILAPIENTRY iluNoisify(ILclampf Tolerance); +ILAPI ILboolean ILAPIENTRY iluPixelize(ILuint PixSize); +ILAPI void ILAPIENTRY iluRegionfv(ILpointf *Points, ILuint n); +ILAPI void ILAPIENTRY iluRegioniv(ILpointi *Points, ILuint n); +ILAPI ILboolean ILAPIENTRY iluReplaceColour(ILubyte Red, ILubyte Green, ILubyte Blue, ILfloat Tolerance); +ILAPI ILboolean ILAPIENTRY iluRotate(ILfloat Angle); +ILAPI ILboolean ILAPIENTRY iluRotate3D(ILfloat x, ILfloat y, ILfloat z, ILfloat Angle); +ILAPI ILboolean ILAPIENTRY iluSaturate1f(ILfloat Saturation); +ILAPI ILboolean ILAPIENTRY iluSaturate4f(ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation); +ILAPI ILboolean ILAPIENTRY iluScale(ILuint Width, ILuint Height, ILuint Depth); +ILAPI ILboolean ILAPIENTRY iluScaleAlpha(ILfloat scale); +ILAPI ILboolean ILAPIENTRY iluScaleColours(ILfloat r, ILfloat g, ILfloat b); +ILAPI ILboolean ILAPIENTRY iluSetLanguage(ILenum Language); +ILAPI ILboolean ILAPIENTRY iluSharpen(ILfloat Factor, ILuint Iter); +ILAPI ILboolean ILAPIENTRY iluSwapColours(void); +ILAPI ILboolean ILAPIENTRY iluWave(ILfloat Angle); + +#define iluColorsUsed iluColoursUsed +#define iluSwapColors iluSwapColours +#define iluReplaceColor iluReplaceColour +#define iluScaleColor iluScaleColour + +#ifdef __cplusplus +} +#endif + +#endif // __ILU_H__ +#endif // __ilu_h_ diff --git a/samples/DevIL/include/IL/ilu_region.h b/samples/DevIL/include/IL/ilu_region.h new file mode 100644 index 000000000..b5b3adc2d --- /dev/null +++ b/samples/DevIL/include/IL/ilu_region.h @@ -0,0 +1,25 @@ +//----------------------------------------------------------------------------- +// +// ImageLib Utility Sources +// Copyright (C) 2000-2002 by Denton Woods +// Last modified: 07/09/2002 <--Y2K Compliant! =] +// +// Filename: src-ILU/src/ilu_region.h +// +// Description: Creates an image region. +// +//----------------------------------------------------------------------------- + +#ifndef ILU_REGION_H +#define ILU_REGION_H + +typedef struct Edge +{ + ILint yUpper; + ILfloat xIntersect, dxPerScan; + struct Edge *next; +} Edge; + + +#endif//ILU_REGION_H + diff --git a/samples/DevIL/include/IL/ilut.h b/samples/DevIL/include/IL/ilut.h new file mode 100644 index 000000000..4a84b845d --- /dev/null +++ b/samples/DevIL/include/IL/ilut.h @@ -0,0 +1,390 @@ +//----------------------------------------------------------------------------- +// +// ImageLib Utility Toolkit Sources +// Copyright (C) 2000-2009 by Denton Woods +// Last modified: 03/07/2009 +// +// Filename: IL/ilut.h +// +// Description: The main include file for ILUT +// +//----------------------------------------------------------------------------- + +// Doxygen comment +/*! \file ilut.h + The main include file for ILUT +*/ + +#ifndef __ilut_h_ +#ifndef __ILUT_H__ + +#define __ilut_h_ +#define __ILUT_H__ + +#include +#include + + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +#define ILUT_VERSION_1_7_8 1 +#define ILUT_VERSION 178 + + +// Attribute Bits +#define ILUT_OPENGL_BIT 0x00000001 +#define ILUT_D3D_BIT 0x00000002 +#define ILUT_ALL_ATTRIB_BITS 0x000FFFFF + + +// Error Types +#define ILUT_INVALID_ENUM 0x0501 +#define ILUT_OUT_OF_MEMORY 0x0502 +#define ILUT_INVALID_VALUE 0x0505 +#define ILUT_ILLEGAL_OPERATION 0x0506 +#define ILUT_INVALID_PARAM 0x0509 +#define ILUT_COULD_NOT_OPEN_FILE 0x050A +#define ILUT_STACK_OVERFLOW 0x050E +#define ILUT_STACK_UNDERFLOW 0x050F +#define ILUT_BAD_DIMENSIONS 0x0511 +#define ILUT_NOT_SUPPORTED 0x0550 + + +// State Definitions +#define ILUT_PALETTE_MODE 0x0600 +#define ILUT_OPENGL_CONV 0x0610 +#define ILUT_D3D_MIPLEVELS 0x0620 +#define ILUT_MAXTEX_WIDTH 0x0630 +#define ILUT_MAXTEX_HEIGHT 0x0631 +#define ILUT_MAXTEX_DEPTH 0x0632 +#define ILUT_GL_USE_S3TC 0x0634 +#define ILUT_D3D_USE_DXTC 0x0634 +#define ILUT_GL_GEN_S3TC 0x0635 +#define ILUT_D3D_GEN_DXTC 0x0635 +#define ILUT_S3TC_FORMAT 0x0705 +#define ILUT_DXTC_FORMAT 0x0705 +#define ILUT_D3D_POOL 0x0706 +#define ILUT_D3D_ALPHA_KEY_COLOR 0x0707 +#define ILUT_D3D_ALPHA_KEY_COLOUR 0x0707 +#define ILUT_FORCE_INTEGER_FORMAT 0x0636 + +//This new state does automatic texture target detection +//if enabled. Currently, only cubemap detection is supported. +//if the current image is no cubemap, the 2d texture is chosen. +#define ILUT_GL_AUTODETECT_TEXTURE_TARGET 0x0807 + + +// Values +#define ILUT_VERSION_NUM IL_VERSION_NUM +#define ILUT_VENDOR IL_VENDOR + +// The different rendering api's...more to be added later? +#define ILUT_OPENGL 0 +#define ILUT_ALLEGRO 1 +#define ILUT_WIN32 2 +#define ILUT_DIRECT3D8 3 +#define ILUT_DIRECT3D9 4 +#define ILUT_X11 5 +#define ILUT_DIRECT3D10 6 + +/* +// Includes specific config +#ifdef DJGPP + #define ILUT_USE_ALLEGRO +#elif _WIN32_WCE + #define ILUT_USE_WIN32 +#elif _WIN32 + //#ifdef __GNUC__ //__CYGWIN32__ (Cygwin seems to not define this with DevIL builds) + #define ILUT_USE_WIN32 + #include "IL/config.h" + + // Temporary fix for the SDL main() linker bug. + //#ifdef ILUT_USE_SDL + //#undef ILUT_USE_SDL + //#endif//ILUT_USE_SDL + + //#else + // #define ILUT_USE_WIN32 + // #define ILUT_USE_OPENGL + // #define ILUT_USE_SDL + // #define ILUT_USE_DIRECTX8 + //#endif +#elif BEOS // Don't know the #define + #define ILUT_USE_BEOS + #define ILUT_USE_OPENGL +#elif MACOSX + #define ILUT_USE_OPENGL +#else + + // We are surely using a *nix so the configure script + // may have written the configured config.h header + #include "IL/config.h" +#endif +*/ + +#if (defined(_WIN32) || defined(_WIN64)) + #if (defined(IL_USE_PRAGMA_LIBS)) && (!defined(_IL_BUILD_LIBRARY)) + #if defined(_MSC_VER) || defined(__BORLANDC__) + #pragma comment(lib, "ILUT.lib") + #endif + #endif + + #include +#endif + + + +//this should remain private and hidden +//#include "IL/config.h" + +////////////// +// OpenGL +////////////// + +#ifdef ILUT_USE_OPENGL + #if defined(_MSC_VER) || defined(_WIN32) + //#define WIN32_LEAN_AND_MEAN + #include + #endif//_MSC_VER + + #ifdef __APPLE__ + #include + #include + #else + #include + #include + #endif//__APPLE__ +#endif + + +#ifdef ILUT_USE_WIN32 + //#define WIN32_LEAN_AND_MEAN + #ifdef _DEBUG + #define _CRTDBG_MAP_ALLOC + #include + #ifndef _WIN32_WCE + #include + #endif + #endif + #include +#endif + + +// +// If we can avoid including these in all cases thing tend to break less +// and we can keep all of them defined as available +// +// Kriss +// + +// ImageLib Utility Toolkit's Allegro Functions +#ifdef ILUT_USE_ALLEGRO +// #include +#endif//ILUT_USE_ALLEGRO + +#ifdef ILUT_USE_SDL +// #include +#endif + +#ifdef ILUT_USE_DIRECTX8 + #include +#endif//ILUT_USE_DIRECTX9 + +#ifdef ILUT_USE_DIRECTX9 + #include +#endif//ILUT_USE_DIRECTX9 + +#ifdef ILUT_USE_DIRECTX10 + #pragma warning(push) + #pragma warning(disable : 4201) // Disables 'nonstandard extension used : nameless struct/union' warning + #include + #include + #include + #pragma warning(pop) +#endif//ILUT_USE_DIRECTX10 + +#ifdef ILUT_USE_X11 + #include + #include +#ifdef ILUT_USE_XSHM + #include + #include + #include +#endif//ILUT_USE_XSHM +#endif//ILUT_USE_X11 + + + +//----------------------------------------------------------------------------- +// Functions +//----------------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +// ImageLib Utility Toolkit Functions +ILAPI ILboolean ILAPIENTRY ilutDisable(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilutEnable(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilutGetBoolean(ILenum Mode); +ILAPI void ILAPIENTRY ilutGetBooleanv(ILenum Mode, ILboolean *Param); +ILAPI ILint ILAPIENTRY ilutGetInteger(ILenum Mode); +ILAPI void ILAPIENTRY ilutGetIntegerv(ILenum Mode, ILint *Param); +ILAPI ILstring ILAPIENTRY ilutGetString(ILenum StringName); +ILAPI void ILAPIENTRY ilutInit(void); +ILAPI ILboolean ILAPIENTRY ilutIsDisabled(ILenum Mode); +ILAPI ILboolean ILAPIENTRY ilutIsEnabled(ILenum Mode); +ILAPI void ILAPIENTRY ilutPopAttrib(void); +ILAPI void ILAPIENTRY ilutPushAttrib(ILuint Bits); +ILAPI void ILAPIENTRY ilutSetInteger(ILenum Mode, ILint Param); + +ILAPI ILboolean ILAPIENTRY ilutRenderer(ILenum Renderer); + + +// ImageLib Utility Toolkit's OpenGL Functions +#ifdef ILUT_USE_OPENGL + ILAPI GLuint ILAPIENTRY ilutGLBindTexImage(); + ILAPI GLuint ILAPIENTRY ilutGLBindMipmaps(void); + ILAPI ILboolean ILAPIENTRY ilutGLBuildMipmaps(void); + ILAPI GLuint ILAPIENTRY ilutGLLoadImage(ILstring FileName); + ILAPI ILboolean ILAPIENTRY ilutGLScreen(void); + ILAPI ILboolean ILAPIENTRY ilutGLScreenie(void); + ILAPI ILboolean ILAPIENTRY ilutGLSaveImage(ILstring FileName, GLuint TexID); + ILAPI ILboolean ILAPIENTRY ilutGLSubTex2D(GLuint TexID, ILuint XOff, ILuint YOff); + ILAPI ILboolean ILAPIENTRY ilutGLSubTex3D(GLuint TexID, ILuint XOff, ILuint YOff, ILuint ZOff); + ILAPI ILboolean ILAPIENTRY ilutGLSetTex2D(GLuint TexID); + ILAPI ILboolean ILAPIENTRY ilutGLSetTex3D(GLuint TexID); + ILAPI ILboolean ILAPIENTRY ilutGLTexImage(GLuint Level); + ILAPI ILboolean ILAPIENTRY ilutGLSubTex(GLuint TexID, ILuint XOff, ILuint YOff); + + ILAPI ILboolean ILAPIENTRY ilutGLSetTex(GLuint TexID); // Deprecated - use ilutGLSetTex2D. + ILAPI ILboolean ILAPIENTRY ilutGLSubTex(GLuint TexID, ILuint XOff, ILuint YOff); // Use ilutGLSubTex2D. +#endif//ILUT_USE_OPENGL + + +// ImageLib Utility Toolkit's Allegro Functions +#ifdef ILUT_USE_ALLEGRO + #ifdef __cplusplus + extern "C" { + #endif + #include + #ifdef __cplusplus + } + #endif + + ILAPI BITMAP* ILAPIENTRY ilutAllegLoadImage(ILstring FileName); + ILAPI BITMAP* ILAPIENTRY ilutConvertToAlleg(PALETTE Pal); +#endif//ILUT_USE_ALLEGRO + + +// ImageLib Utility Toolkit's SDL Functions +#ifdef ILUT_USE_SDL + ILAPI struct SDL_Surface* ILAPIENTRY ilutConvertToSDLSurface(unsigned int flags); + ILAPI struct SDL_Surface* ILAPIENTRY ilutSDLSurfaceLoadImage(ILstring FileName); + ILAPI ILboolean ILAPIENTRY ilutSDLSurfaceFromBitmap(struct SDL_Surface *Bitmap); +#endif//ILUT_USE_SDL + + +// ImageLib Utility Toolkit's BeOS Functions +#ifdef ILUT_USE_BEOS + ILAPI BBitmap ILAPIENTRY ilutConvertToBBitmap(void); +#endif//ILUT_USE_BEOS + + +// ImageLib Utility Toolkit's Win32 GDI Functions +#ifdef ILUT_USE_WIN32 + ILAPI HBITMAP ILAPIENTRY ilutConvertToHBitmap(HDC hDC); + ILAPI HBITMAP ILAPIENTRY ilutConvertSliceToHBitmap(HDC hDC, ILuint slice); + ILAPI void ILAPIENTRY ilutFreePaddedData(ILubyte *Data); + ILAPI void ILAPIENTRY ilutGetBmpInfo(BITMAPINFO *Info); + ILAPI HPALETTE ILAPIENTRY ilutGetHPal(void); + ILAPI ILubyte* ILAPIENTRY ilutGetPaddedData(void); + ILAPI ILboolean ILAPIENTRY ilutGetWinClipboard(void); + ILAPI ILboolean ILAPIENTRY ilutLoadResource(HINSTANCE hInst, ILint ID, ILstring ResourceType, ILenum Type); + ILAPI ILboolean ILAPIENTRY ilutSetHBitmap(HBITMAP Bitmap); + ILAPI ILboolean ILAPIENTRY ilutSetHPal(HPALETTE Pal); + ILAPI ILboolean ILAPIENTRY ilutSetWinClipboard(void); + ILAPI HBITMAP ILAPIENTRY ilutWinLoadImage(ILstring FileName, HDC hDC); + ILAPI ILboolean ILAPIENTRY ilutWinLoadUrl(ILstring Url); + ILAPI ILboolean ILAPIENTRY ilutWinPrint(ILuint XPos, ILuint YPos, ILuint Width, ILuint Height, HDC hDC); + ILAPI ILboolean ILAPIENTRY ilutWinSaveImage(ILstring FileName, HBITMAP Bitmap); +#endif//ILUT_USE_WIN32 + +// ImageLib Utility Toolkit's DirectX 8 Functions +#ifdef ILUT_USE_DIRECTX8 +// ILAPI void ILAPIENTRY ilutD3D8MipFunc(ILuint NumLevels); + ILAPI struct IDirect3DTexture8* ILAPIENTRY ilutD3D8Texture(struct IDirect3DDevice8 *Device); + ILAPI struct IDirect3DVolumeTexture8* ILAPIENTRY ilutD3D8VolumeTexture(struct IDirect3DDevice8 *Device); + ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromFile(struct IDirect3DDevice8 *Device, char *FileName, struct IDirect3DTexture8 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromFile(struct IDirect3DDevice8 *Device, char *FileName, struct IDirect3DVolumeTexture8 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromFileInMemory(struct IDirect3DDevice8 *Device, void *Lump, ILuint Size, struct IDirect3DTexture8 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromFileInMemory(struct IDirect3DDevice8 *Device, void *Lump, ILuint Size, struct IDirect3DVolumeTexture8 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromFileHandle(struct IDirect3DDevice8 *Device, ILHANDLE File, struct IDirect3DTexture8 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromFileHandle(struct IDirect3DDevice8 *Device, ILHANDLE File, struct IDirect3DVolumeTexture8 **Texture); + // These two are not tested yet. + ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromResource(struct IDirect3DDevice8 *Device, HMODULE SrcModule, char *SrcResource, struct IDirect3DTexture8 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromResource(struct IDirect3DDevice8 *Device, HMODULE SrcModule, char *SrcResource, struct IDirect3DVolumeTexture8 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D8LoadSurface(struct IDirect3DDevice8 *Device, struct IDirect3DSurface8 *Surface); +#endif//ILUT_USE_DIRECTX8 + +#ifdef ILUT_USE_DIRECTX9 + #pragma warning(push) + #pragma warning(disable : 4115) // Disables 'named type definition in parentheses' warning +// ILAPI void ILAPIENTRY ilutD3D9MipFunc(ILuint NumLevels); + ILAPI struct IDirect3DTexture9* ILAPIENTRY ilutD3D9Texture (struct IDirect3DDevice9* Device); + ILAPI struct IDirect3DVolumeTexture9* ILAPIENTRY ilutD3D9VolumeTexture (struct IDirect3DDevice9* Device); + ILAPI struct IDirect3DCubeTexture9* ILAPIENTRY ilutD3D9CubeTexture (struct IDirect3DDevice9* Device); + + ILAPI ILboolean ILAPIENTRY ilutD3D9CubeTexFromFile(struct IDirect3DDevice9 *Device, ILconst_string FileName, struct IDirect3DCubeTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9CubeTexFromFileInMemory(struct IDirect3DDevice9 *Device, void *Lump, ILuint Size, struct IDirect3DCubeTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9CubeTexFromFileHandle(struct IDirect3DDevice9 *Device, ILHANDLE File, struct IDirect3DCubeTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9CubeTexFromResource(struct IDirect3DDevice9 *Device, HMODULE SrcModule, ILconst_string SrcResource, struct IDirect3DCubeTexture9 **Texture); + + ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromFile(struct IDirect3DDevice9 *Device, ILconst_string FileName, struct IDirect3DTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromFile(struct IDirect3DDevice9 *Device, ILconst_string FileName, struct IDirect3DVolumeTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromFileInMemory(struct IDirect3DDevice9 *Device, void *Lump, ILuint Size, struct IDirect3DTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromFileInMemory(struct IDirect3DDevice9 *Device, void *Lump, ILuint Size, struct IDirect3DVolumeTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromFileHandle(struct IDirect3DDevice9 *Device, ILHANDLE File, struct IDirect3DTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromFileHandle(struct IDirect3DDevice9 *Device, ILHANDLE File, struct IDirect3DVolumeTexture9 **Texture); + + // These three are not tested yet. + ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromResource(struct IDirect3DDevice9 *Device, HMODULE SrcModule, ILconst_string SrcResource, struct IDirect3DTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromResource(struct IDirect3DDevice9 *Device, HMODULE SrcModule, ILconst_string SrcResource, struct IDirect3DVolumeTexture9 **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D9LoadSurface(struct IDirect3DDevice9 *Device, struct IDirect3DSurface9 *Surface); + #pragma warning(pop) +#endif//ILUT_USE_DIRECTX9 + +#ifdef ILUT_USE_DIRECTX10 + ILAPI ID3D10Texture2D* ILAPIENTRY ilutD3D10Texture(ID3D10Device *Device); + ILAPI ILboolean ILAPIENTRY ilutD3D10TexFromFile(ID3D10Device *Device, ILconst_string FileName, ID3D10Texture2D **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D10TexFromFileInMemory(ID3D10Device *Device, void *Lump, ILuint Size, ID3D10Texture2D **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D10TexFromResource(ID3D10Device *Device, HMODULE SrcModule, ILconst_string SrcResource, ID3D10Texture2D **Texture); + ILAPI ILboolean ILAPIENTRY ilutD3D10TexFromFileHandle(ID3D10Device *Device, ILHANDLE File, ID3D10Texture2D **Texture); +#endif//ILUT_USE_DIRECTX10 + + + +#ifdef ILUT_USE_X11 + ILAPI XImage * ILAPIENTRY ilutXCreateImage( Display* ); + ILAPI Pixmap ILAPIENTRY ilutXCreatePixmap( Display*,Drawable ); + ILAPI XImage * ILAPIENTRY ilutXLoadImage( Display*,char* ); + ILAPI Pixmap ILAPIENTRY ilutXLoadPixmap( Display*,Drawable,char* ); +#ifdef ILUT_USE_XSHM + ILAPI XImage * ILAPIENTRY ilutXShmCreateImage( Display*,XShmSegmentInfo* ); + ILAPI void ILAPIENTRY ilutXShmDestroyImage( Display*,XImage*,XShmSegmentInfo* ); + ILAPI Pixmap ILAPIENTRY ilutXShmCreatePixmap( Display*,Drawable,XShmSegmentInfo* ); + ILAPI void ILAPIENTRY ilutXShmFreePixmap( Display*,Pixmap,XShmSegmentInfo* ); + ILAPI XImage * ILAPIENTRY ilutXShmLoadImage( Display*,char*,XShmSegmentInfo* ); + ILAPI Pixmap ILAPIENTRY ilutXShmLoadPixmap( Display*,Drawable,char*,XShmSegmentInfo* ); +#endif//ILUT_USE_XSHM +#endif//ILUT_USE_X11 + + +#ifdef __cplusplus +} +#endif + +#endif // __ILUT_H__ +#endif // __ilut_h_ diff --git a/samples/DevIL/include/IL/ilut_config.h b/samples/DevIL/include/IL/ilut_config.h new file mode 100644 index 000000000..a05da54c1 --- /dev/null +++ b/samples/DevIL/include/IL/ilut_config.h @@ -0,0 +1,26 @@ +#ifndef __ILUT_CONFIG_H__ +#define __ILUT_CONFIG_H__ + +#define IL_USE_PRAGMA_LIBS + +// Supported APIs (ILUT) + +// +// sorry just +// cant get this one to work under windows +// have disabled for the now +// +// will look at it some more later +// +// Kriss +// +#undef ILUT_USE_ALLEGRO + +#undef ILUT_USE_DIRECTX8 +//#define ILUT_USE_DIRECTX9 +//#define ILUT_USE_DIRECTX10 +#define ILUT_USE_OPENGL +//#define ILUT_USE_SDL +#define ILUT_USE_WIN32 + +#endif//__ILUT_CONFIG_H__ diff --git a/samples/DevIL/lib/DevIL.lib b/samples/DevIL/lib/DevIL.lib new file mode 100644 index 000000000..1aa82d047 Binary files /dev/null and b/samples/DevIL/lib/DevIL.lib differ diff --git a/samples/DevIL/lib/ILU.lib b/samples/DevIL/lib/ILU.lib new file mode 100644 index 000000000..5124172e2 Binary files /dev/null and b/samples/DevIL/lib/ILU.lib differ diff --git a/samples/DevIL/lib/ILUT.lib b/samples/DevIL/lib/ILUT.lib new file mode 100644 index 000000000..99bfb6124 Binary files /dev/null and b/samples/DevIL/lib/ILUT.lib differ diff --git a/samples/README b/samples/README index fc082ddcf..3eab594ab 100644 --- a/samples/README +++ b/samples/README @@ -1,17 +1,32 @@ ----------------------------------------------------------------------------- + +ASSIMP SAMPLES README +===================== + + +1. General +---------- + This directory contains various samples to illustrate Assimp's -use in various real-world environments. Workspaces for all samples -are bundled in ./workspaces, makefiles can be found in the -respective directories of the samples. +use in various real-world environments. Workspaces to build the +samples can be found in the respective directories. The VC workspaces +copy the created executables to the ./bin directory. -All GL-based samples depend on GLUT. For use with the VS workspaces, -it's best practice to copy glut right _here_ (./glut/) so the -predefined build configuration will find it. +All GL-based samples depend on GLUT, some on DevIL. For convenience, +these libraries are included in the repository in their respective + Windows/x86 prebuilt versions. To build on linux, install the + required packages using the package manager of your choice. + +Also note that the VS workspaces link against the DLL version of the +Assimp library, thus you need to build it in the first place ( +assimp-release-dll build configuration). The Assimp DLL needs to be +copied to ./bin as well (the VS workspaces will try to do this +automatically). + + +2. List of samples +------------------ -Also note that the VS workspaces links against the DLL version of the library, -thus you need to build it first (assimp-release-dll) and copy the dll to the -directory of the sample. SimpleOpenGL @@ -20,4 +35,19 @@ SimpleOpenGL and displays the model as wireframe. Animations and materials are not evaluated at all. This samples uses the C interface to Assimp. Basic materials are displayed, but no textures. ----------------------------------------------------------------------------- + + This sample should work virtually everywhere, provided glut + is available. + + +SimpleTexturedOpenGL + + An extended OpenGL sample, featuring texturing using the DevIL + library. Based on SimpleOpenGL and the NeHe GL tutorial style. + + This is a Windows-only sample. + + This sample was kindly provided by SamHayne (http://sf.net/users/samhayne/) + See http://sourceforge.net/projects/assimp/forums/forum/817654/topic/3736373 + + diff --git a/samples/workspaces/vc8/SimpleOpenGL/SimpleOpenGL.vcproj b/samples/SimpleOpenGL/SimpleOpenGL.vcproj similarity index 78% rename from samples/workspaces/vc8/SimpleOpenGL/SimpleOpenGL.vcproj rename to samples/SimpleOpenGL/SimpleOpenGL.vcproj index 80f7f02ce..de3ac2133 100644 --- a/samples/workspaces/vc8/SimpleOpenGL/SimpleOpenGL.vcproj +++ b/samples/SimpleOpenGL/SimpleOpenGL.vcproj @@ -17,7 +17,7 @@ @@ -189,7 +189,7 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > diff --git a/samples/workspaces/vc8/samples.sln b/samples/SimpleOpenGL/SimpleOpenGL_VC8.sln similarity index 88% rename from samples/workspaces/vc8/samples.sln rename to samples/SimpleOpenGL/SimpleOpenGL_VC8.sln index 934b64680..4447d7795 100644 --- a/samples/workspaces/vc8/samples.sln +++ b/samples/SimpleOpenGL/SimpleOpenGL_VC8.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleOpenGL", "SimpleOpenGL\SimpleOpenGL.vcproj", "{A53D047C-2C35-44FB-B7DB-2066FE520950}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleOpenGL", "SimpleOpenGL.vcproj", "{A53D047C-2C35-44FB-B7DB-2066FE520950}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL.sln b/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL.sln new file mode 100644 index 000000000..9d59a0e46 --- /dev/null +++ b/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleTexturedOpenGL", "SimpleTexturedOpenGL\SimpleTexturedOpenGL.vcproj", "{A03DCB69-BBC5-4F55-A7D1-B9100E821BBE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A03DCB69-BBC5-4F55-A7D1-B9100E821BBE}.Debug|Win32.ActiveCfg = Debug|Win32 + {A03DCB69-BBC5-4F55-A7D1-B9100E821BBE}.Debug|Win32.Build.0 = Debug|Win32 + {A03DCB69-BBC5-4F55-A7D1-B9100E821BBE}.Release|Win32.ActiveCfg = Release|Win32 + {A03DCB69-BBC5-4F55-A7D1-B9100E821BBE}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/SimpleTexturedOpenGL.vcproj b/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/SimpleTexturedOpenGL.vcproj new file mode 100644 index 000000000..cd2502801 --- /dev/null +++ b/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/SimpleTexturedOpenGL.vcproj @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/include/boost_includes.h b/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/include/boost_includes.h new file mode 100644 index 000000000..7b9c0860e --- /dev/null +++ b/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/include/boost_includes.h @@ -0,0 +1 @@ +#include \ No newline at end of file diff --git a/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/src/model_loading.cpp b/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/src/model_loading.cpp new file mode 100644 index 000000000..eed22f102 --- /dev/null +++ b/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/src/model_loading.cpp @@ -0,0 +1,901 @@ +#include +#include +#include +#include +#include +//#include + +#include + +//to map image filenames to textureIds +#include +#include + + +// assimp include files. These three are usually needed. +#include "assimp.hpp" //OO version Header! +#include "aiPostProcess.h" +#include "aiScene.h" +#include "DefaultLogger.h" +#include "LogStream.h" + + +HGLRC hRC=NULL; // Permanent Rendering Context +HDC hDC=NULL; // Private GDI Device Context +HWND hWnd=NULL; // Holds Window Handle +HINSTANCE hInstance; // Holds The Instance Of The Application + +bool keys[256]; // Array used for Keyboard Routine; +bool active=TRUE; // Window Active Flag Set To TRUE by Default +bool fullscreen=TRUE; // Fullscreen Flag Set To Fullscreen By Default + +GLfloat xrot; +GLfloat yrot; +GLfloat zrot; + + +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); // Declaration For WndProc +GLboolean abortGLInit(char*); + +char* windowTitle = "OpenGL Framework"; + +GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0f }; +GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f }; +GLfloat LightPosition[]= { 0.0f, 0.0f, 15.0f, 1.0f }; + + + +// the global Assimp scene object +const aiScene* scene = NULL; +GLuint scene_list = 0; +struct aiVector3D scene_min, scene_max, scene_center; + +// images / texture +std::map textureIdMap; // map image filenames to textureIds +GLuint* textureIds; // pointer to texture Array + +// Create an instance of the Importer class +Assimp::Importer importer; + +/* +std::string toString(int i) +{ + return boost::lexical_cast(i); +} +*/ + +void createAILogger() +{ + //Assimp::Logger::LogSeverity severity = Assimp::Logger::NORMAL; + Assimp::Logger::LogSeverity severity = Assimp::Logger::VERBOSE; + + // Create a logger instance for Console Output + Assimp::DefaultLogger::create("",severity, aiDefaultLogStream_STDOUT); + + // Create a logger instance for File Output (found in project folder or near .exe) + Assimp::DefaultLogger::create("assimp_log.txt",severity, aiDefaultLogStream_FILE); + + // Now I am ready for logging my stuff + Assimp::DefaultLogger::get()->info("this is my info-call"); +} + +void destroyAILogger() +{ + // Kill it after the work is done + Assimp::DefaultLogger::kill(); +} + +//void logInfo(const char* logString) +void logInfo(std::string logString) +{ + //Will add message to File with "info" Tag + Assimp::DefaultLogger::get()->info(logString.c_str()); +} + +void logDebug(const char* logString) +{ + //Will add message to File with "debug" Tag + Assimp::DefaultLogger::get()->debug(logString); +} + + +bool Import3DFromFile( const std::string& pFile) +{ + //check if file exists + std::ifstream fin(pFile.c_str()); + if(!fin.fail()) + { + fin.close(); + } + else + { + MessageBox(NULL, ("Couldn't open file: " + pFile).c_str() , "ERROR", MB_OK | MB_ICONEXCLAMATION); + logInfo( importer.GetErrorString()); + return false; + } + + + scene = new aiScene(); + scene = importer.ReadFile( pFile, aiProcessPreset_TargetRealtime_Quality); + + // If the import failed, report it + if( !scene) + { + logInfo( importer.GetErrorString()); + return false; + } + + // Now we can access the file's contents. + logInfo("Import of scene " + pFile + " succeeded."); + //logInfo("Scene has " + toString(scene->mNumMeshes) + " meshes."); + //logInfo("RootNode has " + toString(scene->mRootNode->mNumMeshes) + " meshes."); + + // We're done. Everything will be cleaned up by the importer destructor + return true; + +} + + +GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize And Initialize The GL Window +{ + if (height==0) // Prevent A Divide By Zero By + { + height=1; // Making Height Equal One + } + + glViewport(0, 0, width, height); // Reset The Current Viewport + + glMatrixMode(GL_PROJECTION); // Select The Projection Matrix + glLoadIdentity(); // Reset The Projection Matrix + + // Calculate The Aspect Ratio Of The Window + gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f); + + glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix + glLoadIdentity(); // Reset The Modelview Matrix +} + + + +int LoadGLTextures(const aiScene* scene) +{ + ILboolean success; + + /* Before calling ilInit() version should be checked. */ + if (ilGetInteger(IL_VERSION_NUM) < IL_VERSION) + { + ILint test = ilGetInteger(IL_VERSION_NUM); + /// wrong DevIL version /// + std::string err_msg = "Wrong DevIL version. Old devil.dll in system32/SysWow64?"; + //std::string err_msg = "Wrong DevIL version: IL_VERSION_NUM:" + toString(ilGetInteger(IL_VERSION_NUM)) + " IL_VERSION:" + toString(IL_VERSION); + char* cErr_msg = (char *) err_msg.c_str(); + abortGLInit(cErr_msg); + return -1; + } + + ilInit(); /* Initialization of DevIL */ + + if (scene->HasTextures()) abortGLInit("Support for meshes with embedded textures is not implemented"); + + /* getTexture Filenames and Numb of Textures */ + for (unsigned int m=0; mmNumMaterials; m++) + { + int texIndex = 0; + aiReturn texFound = AI_SUCCESS; + + aiString path; // filename + + while (texFound == AI_SUCCESS) + { + texFound = scene->mMaterials[m]->GetTexture(aiTextureType_DIFFUSE, texIndex, &path); + textureIdMap[path.data] = NULL; //fill map with textures, pointers still NULL yet + texIndex++; + } + } + + int numTextures = textureIdMap.size(); + + /* array with DevIL image IDs */ + ILuint* imageIds = NULL; + imageIds = new ILuint[numTextures]; + + /* generate DevIL Image IDs */ + ilGenImages(numTextures, imageIds); /* Generation of numTextures image names */ + + /* create and fill array with GL texture ids */ + textureIds = new GLuint[numTextures]; + glGenTextures(numTextures, textureIds); /* Texture name generation */ + + /* define texture path */ + std::string texturepath = "../../test/models/X/"; + //std::string texturepath = "../../../test/models/Obj/"; + + /* get iterator */ + std::map::iterator itr = textureIdMap.begin(); + + for (int i=0; ir, color->g, color->b, color->a); +} + +void set_float4(float f[4], float a, float b, float c, float d) +{ + f[0] = a; + f[1] = b; + f[2] = c; + f[3] = d; +} + +void color4_to_float4(const struct aiColor4D *c, float f[4]) +{ + f[0] = c->r; + f[1] = c->g; + f[2] = c->b; + f[3] = c->a; +} + +void apply_material(const struct aiMaterial *mtl) +{ + float c[4]; + + GLenum fill_mode; + int ret1, ret2; + struct aiColor4D diffuse; + struct aiColor4D specular; + struct aiColor4D ambient; + struct aiColor4D emission; + float shininess, strength; + int two_sided; + int wireframe; + unsigned int max; // changed: to unsigned + + int texIndex = 0; + aiString texPath; //contains filename of texture + + if(AI_SUCCESS == mtl->GetTexture(aiTextureType_DIFFUSE, texIndex, &texPath)) + { + unsigned int texId = *textureIdMap[texPath.data]; + glBindTexture(GL_TEXTURE_2D, texId); + //bind texture + } + + /* + set_float4(c, 0.8f, 0.8f, 0.8f, 1.0f); + if(AI_SUCCESS == mtl->Get(AI_MATKEY_COLOR_DIFFUSE, diffuse)) + color4_to_float4(&diffuse, c); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, c); + */ + + set_float4(c, 0.8f, 0.8f, 0.8f, 1.0f); + if(AI_SUCCESS == aiGetMaterialColor(mtl, AI_MATKEY_COLOR_DIFFUSE, &diffuse)) + color4_to_float4(&diffuse, c); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, c); + + set_float4(c, 0.0f, 0.0f, 0.0f, 1.0f); + if(AI_SUCCESS == aiGetMaterialColor(mtl, AI_MATKEY_COLOR_SPECULAR, &specular)) + color4_to_float4(&specular, c); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, c); + + set_float4(c, 0.2f, 0.2f, 0.2f, 1.0f); + if(AI_SUCCESS == aiGetMaterialColor(mtl, AI_MATKEY_COLOR_AMBIENT, &ambient)) + color4_to_float4(&ambient, c); + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, c); + + set_float4(c, 0.0f, 0.0f, 0.0f, 1.0f); + if(AI_SUCCESS == aiGetMaterialColor(mtl, AI_MATKEY_COLOR_EMISSIVE, &emission)) + color4_to_float4(&emission, c); + glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, c); + + max = 1; + ret1 = aiGetMaterialFloatArray(mtl, AI_MATKEY_SHININESS, &shininess, &max); + max = 1; + ret2 = aiGetMaterialFloatArray(mtl, AI_MATKEY_SHININESS_STRENGTH, &strength, &max); + if((ret1 == AI_SUCCESS) && (ret2 == AI_SUCCESS)) + glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess * strength); + else { + glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 0.0f); + set_float4(c, 0.0f, 0.0f, 0.0f, 0.0f); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, c); + } + + max = 1; + if(AI_SUCCESS == aiGetMaterialIntegerArray(mtl, AI_MATKEY_ENABLE_WIREFRAME, &wireframe, &max)) + fill_mode = wireframe ? GL_LINE : GL_FILL; + else + fill_mode = GL_FILL; + glPolygonMode(GL_FRONT_AND_BACK, fill_mode); + + max = 1; + if((AI_SUCCESS == aiGetMaterialIntegerArray(mtl, AI_MATKEY_TWOSIDED, &two_sided, &max)) && two_sided) + glEnable(GL_CULL_FACE); + else + glDisable(GL_CULL_FACE); +} + + +void recursive_render (const struct aiScene *sc, const struct aiNode* nd, float scale) +{ + unsigned int i; + unsigned int n=0, t; + struct aiMatrix4x4 m = nd->mTransformation; + + m.Scaling(aiVector3D(scale, scale, scale), m); + + // update transform + m.Transpose(); + glPushMatrix(); + glMultMatrixf((float*)&m); + + // draw all meshes assigned to this node + for (; n < nd->mNumMeshes; ++n) + { + const struct aiMesh* mesh = scene->mMeshes[nd->mMeshes[n]]; + //const aiMesh* mesh; + + apply_material(sc->mMaterials[mesh->mMaterialIndex]); + + + if(mesh->mNormals == NULL) + { + glDisable(GL_LIGHTING); + } + else + { + glEnable(GL_LIGHTING); + } + + if(mesh->mColors[0] != NULL) + { + glEnable(GL_COLOR_MATERIAL); + } + else + { + glDisable(GL_COLOR_MATERIAL); + } + + + + for (t = 0; t < mesh->mNumFaces; ++t) { + const struct aiFace* face = &mesh->mFaces[t]; + GLenum face_mode; + + switch(face->mNumIndices) + { + case 1: face_mode = GL_POINTS; break; + case 2: face_mode = GL_LINES; break; + case 3: face_mode = GL_TRIANGLES; break; + default: face_mode = GL_POLYGON; break; + } + + glBegin(face_mode); + + for(i = 0; i < face->mNumIndices; i++) // go through all vertices in face + { + int vertexIndex = face->mIndices[i]; // get group index for current index + if(mesh->mColors[0] != NULL) + Color4f(&mesh->mColors[0][vertexIndex]); + if(mesh->mNormals != NULL) + + if(mesh->HasTextureCoords(0)) //HasTextureCoords(texture_coordinates_set) + { + glTexCoord2f(mesh->mTextureCoords[0][vertexIndex].x, 1 - mesh->mTextureCoords[0][vertexIndex].y); //mTextureCoords[channel][vertex] + } + + glNormal3fv(&mesh->mNormals[vertexIndex].x); + glVertex3fv(&mesh->mVertices[vertexIndex].x); + } + + glEnd(); + + } + + } + + + // draw all children + for (n = 0; n < nd->mNumChildren; ++n) + { + recursive_render(sc, nd->mChildren[n], scale); + } + + glPopMatrix(); +} + + +void drawAiScene(const aiScene* scene) +{ + logInfo("drawing objects"); + + recursive_render(scene, scene->mRootNode, 0.5); + +} + +int DrawGLScene(GLvoid) //Here's where we do all the drawing +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer + glLoadIdentity(); // Reset MV Matrix + + + glTranslatef(0.0f, -10.0f, -40.0f); // Move 40 Units And Into The Screen + + + glRotatef(xrot, 1.0f, 0.0f, 0.0f); + glRotatef(yrot, 0.0f, 1.0f, 0.0f); + glRotatef(zrot, 0.0f, 0.0f, 1.0f); + + drawAiScene(scene); + + + //xrot+=0.3f; + yrot+=0.2f; + //zrot+=0.4f; + + return TRUE; // Ewwrissing okay +} + + +GLvoid KillGLWindow(GLvoid) // Properly Kill The Window +{ + if (fullscreen) // Are We In Fullscreen Mode? + { + ChangeDisplaySettings(NULL, 0); // If So Switch Back To The Desktop + ShowCursor(TRUE); // Show Mouse Pointer + } + + if (hRC) // Do We Have A Rendering Context? + { + if (!wglMakeCurrent(NULL, NULL)) // Are We Able To Release The DC And RC Contexts? + { + MessageBox(NULL, "Release Of DC And RC Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); + } + + if (!wglDeleteContext(hRC)) // Are We Able To Delete The RC? + { + MessageBox(NULL, "Release Rendering Context Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); + } + hRC = NULL; + } + + if (hDC && !ReleaseDC(hWnd, hDC)) // Are We able to Release The DC? + { + MessageBox(NULL, "Release Device Context Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); + hDC=NULL; + } + + if (hWnd && !DestroyWindow(hWnd)) // Are We Able To Destroy The Window + { + MessageBox(NULL, "Could Not Release hWnd.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); + hWnd = NULL; + } + + if (!UnregisterClass("OpenGL", hInstance)) // Are We Able To Unregister Class + { + MessageBox(NULL, "Could Not Unregister Class.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); + hInstance = NULL; + } +} + +GLboolean abortGLInit(char* abortMessage) +{ + KillGLWindow(); // Reset Display + MessageBox(NULL, abortMessage, "ERROR", MB_OK|MB_ICONEXCLAMATION); + return FALSE; // quit and return False +} + +BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag) +{ + GLuint PixelFormat; // Hold the result after searching for a match + WNDCLASS wc; // Window Class Structure + DWORD dwExStyle; // Window Extended Style + DWORD dwStyle; // Window Style + RECT WindowRect; // Grabs Rectangle Upper Left / Lower Right Values + WindowRect.left = (long)0; + WindowRect.right = (long)width; + WindowRect.top = (long)0; + WindowRect.bottom = (long)height; + + fullscreen = fullscreenflag; + + hInstance = GetModuleHandle(NULL); // Grab An Instance For Our Window + wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // Redraw On Move, And Own DC For Window + wc.lpfnWndProc = (WNDPROC) WndProc; // WndProc handles Messages + wc.cbClsExtra = 0; // No Extra Window Data + wc.cbWndExtra = 0; // No Extra Window Data + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); // Load The Default Icon + wc.hCursor = LoadCursor(NULL, IDC_ARROW); // Load the default arrow + wc.hbrBackground= NULL; // No Background required for OpenGL + wc.lpszMenuName = NULL; // No Menu + wc.lpszClassName= "OpenGL"; // Class Name + + if (!RegisterClass(&wc)) + { + MessageBox(NULL, "Failed to register the window class", "ERROR", MB_OK | MB_ICONEXCLAMATION); + return FALSE; //exit and return false + } + + if (fullscreen) // attempt fullscreen mode + { + DEVMODE dmScreenSettings; // Device Mode + memset(&dmScreenSettings, 0, sizeof(dmScreenSettings)); // Make Sure Memory's Cleared + dmScreenSettings.dmSize = sizeof(dmScreenSettings); // Size Of the devmode structure + dmScreenSettings.dmPelsWidth = width; // Selected Screen Width + dmScreenSettings.dmPelsHeight = height; // Selected Screen Height + dmScreenSettings.dmBitsPerPel = bits; // bits per pixel + dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT; + + // Try To Set Selected Mode and Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar. + if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL) + { + // If The Mode Fails, Offer Two Options. Quit Or Run In A Window. + if (MessageBox(NULL,"The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?","NeHe GL",MB_YESNO|MB_ICONEXCLAMATION)==IDYES) + { + fullscreen = FALSE; // Select Windowed Mode (Fullscreen = FALSE) + } + else + { + //Popup Messagebox: Closing + MessageBox(NULL, "Program will close now.", "ERROR", MB_OK|MB_ICONSTOP); + return FALSE; //exit, return false + } + } + } + + if (fullscreen) // when mode really succeeded + { + dwExStyle=WS_EX_APPWINDOW; // Window Extended Style + dwStyle=WS_POPUP; + ShowCursor(FALSE); + } + else + { + dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; // Window extended style + dwStyle=WS_OVERLAPPEDWINDOW; // Windows style + } + + AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle); // Adjust Window To True Requestes Size + + if (!(hWnd=CreateWindowEx( dwExStyle, // Extended Style For The Window + "OpenGL", // Class Name + title, // Window Title + WS_CLIPSIBLINGS | // Required Window Style + WS_CLIPCHILDREN | // Required Window Style + dwStyle, // Selected WIndow Style + 0, 0, // Window Position + WindowRect.right-WindowRect.left, // Calc adjusted Window Width + WindowRect.bottom-WindowRect.top, // Calc adjustes Window Height + NULL, // No Parent Window + NULL, // No Menu + hInstance, // Instance + NULL ))) // Don't pass anything To WM_CREATE + { + abortGLInit("Window Creation Error."); + return FALSE; + /* + KillGLWindow(); // Reset The Display + MessageBox(NULL, "Window Creation Error.", "ERROR", MB_OK|MB_ICONEXCLAMATION); + return FALSE; // Return False + */ + } + + static PIXELFORMATDESCRIPTOR pfd= // pfd Tells Windows How We Want Things To Be + { + sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor + 1, // Version Number + PFD_DRAW_TO_WINDOW | // Format Must Support Window + PFD_SUPPORT_OPENGL | // Format Must Support OpenGL + PFD_DOUBLEBUFFER, // Must Support Double Buffering + PFD_TYPE_RGBA, // Request An RGBA Format + bits, // Select Our Color Depth + 0, 0, 0, 0, 0, 0, // Color Bits Ignored + 0, // No Alpha Buffer + 0, // Shift Bit Ignored + 0, // No Accumulation Buffer + 0, 0, 0, 0, // Accumulation Bits Ignored + 16, // 16Bit Z-Buffer (Depth Buffer) + 0, // No Stencil Buffer + 0, // No Auxiliary Buffer + PFD_MAIN_PLANE, // Main Drawing Layer + 0, // Reserved + 0, 0, 0 // Layer Masks Ignored + }; + + if (!(hDC=GetDC(hWnd))) // Did we get the Device Context? + { + abortGLInit("Can't Create A GL Device Context."); + return FALSE; + /* + KillGLWindow(); // Reset Display + MessageBox(NULL, "Can't Create A GL Device Context."), "ERROR", MB_OK|MB_ICONEXCLAMATION); + return FALSE; // quit and return False + */ + } + + if (!(PixelFormat=ChoosePixelFormat(hDC, &pfd))) // Did We Find a matching pixel Format? + { + abortGLInit("Can't Find Suitable PixelFormat"); + return FALSE; + } + + if (!SetPixelFormat(hDC, PixelFormat, &pfd)) + { + abortGLInit("Can't Set The PixelFormat"); + return FALSE; + } + + if (!(hRC=wglCreateContext(hDC))) + { + abortGLInit("Can't Create A GL Rendering Context."); + return FALSE; + } + + if (!(wglMakeCurrent(hDC,hRC))) // Try to activate the rendering context + { + abortGLInit("Can't Activate The Rendering Context"); + return FALSE; + } + + //// *** everything okay *** + + ShowWindow(hWnd, SW_SHOW); // Show The Window + SetForegroundWindow(hWnd); // Slightly Higher Prio + SetFocus(hWnd); // Sets Keyboard Focus To The Window + ReSizeGLScene(width, height); // Set Up Our Perspective GL Screen + + if (!InitGL()) + { + abortGLInit("Initialization failed"); + return FALSE; + } + + return TRUE; +} + +LRESULT CALLBACK WndProc(HWND hWnd, // Handles for this Window + UINT uMsg, // Message for this Window + WPARAM wParam, // additional message Info + LPARAM lParam) // additional message Info +{ + switch (uMsg) // check for Window Messages + { + case WM_ACTIVATE: // Watch For Window Activate Message + { + if (!HIWORD(wParam)) // Check Minimization State + { + active=TRUE; + } + else + { + active=FALSE; + } + + return 0; // return To The Message Loop + } + + case WM_SYSCOMMAND: // Interrupt System Commands + { + switch (wParam) + { + case SC_SCREENSAVE: // Screensaver trying to start + case SC_MONITORPOWER: // Monitor tryig to enter powersafe + return 0; + } + break; + } + + case WM_CLOSE: // close message received? + { + PostQuitMessage(0); // Send WM_QUIT quit message + return 0; // Jump Back + } + + case WM_KEYDOWN: // Is a key pressed? + { + keys[wParam] = TRUE; // If so, Mark it as true + return 0; + } + + case WM_KEYUP: // Has Key Been released? + { + keys[wParam] = FALSE; // If so, Mark It As FALSE + return 0; + } + + case WM_SIZE: // Resize The OpenGL Window + { + ReSizeGLScene(LOWORD(lParam), HIWORD(lParam)); // LoWord-Width, HiWord-Height + return 0; + } + } + + // Pass All Unhandled Messaged To DefWindowProc + return DefWindowProc(hWnd, uMsg, wParam, lParam); +} + + + +int WINAPI WinMain( __in HINSTANCE hInstance, // Instance + __in_opt HINSTANCE hPrevInstance, // Previous Instance + __in_opt LPSTR lpCmdLine, // Command Line Parameters + __in int nShowCmd ) // Window Show State +{ + MSG msg; // Windows Message Structure + BOOL done=FALSE; // Bool Variable To Exit Loop + + createAILogger(); + logInfo("App fired!"); + + // load scene + + if (!Import3DFromFile("../../test/models/X/dwarf.x")) return 0; + //if (!Import3DFromFile("../../../test/models/Obj/spider.obj")) return 0; + logInfo("=============== Post Import ===================="); + //logInfo("Scene has " + toString(scene->mNumMeshes) + " meshes."); + //logInfo("RootNode has " + toString(scene->mRootNode->mNumMeshes) + " meshes."); + + //logInfo("Scene imported. Scene Meshes:" + toString(scene->mNumMeshes)); + + + + // Ask The User Which Screen Mode They Prefer + if (MessageBox(NULL, "Would You Like To Run In Fullscreen Mode?", "Start Fullscreen?", MB_YESNO|MB_ICONEXCLAMATION)==IDNO) + { + fullscreen=FALSE; // Windowed Mode + } + + // Create Our OpenGL Window (also calls GLinit und LoadGLTextures) + if (!CreateGLWindow(windowTitle, 640, 480, 16, fullscreen)) + { + return 0; + } + + + + + while(!done) // Game Loop + { + if (PeekMessage(&msg, NULL, 0,0, PM_REMOVE)) // Is There A Message Waiting + { + if (msg.message==WM_QUIT) // Have we received A Quit Message? + { + done=TRUE; // If So done=TRUE + } + else + { + TranslateMessage(&msg); // Translate The Message + DispatchMessage(&msg); // Dispatch The Message + } + } + else + { + // Draw The Scene. Watch For ESC Key And Quit Messaged From DrawGLScene() + if (active) + { + if (keys[VK_ESCAPE]) // Was ESC pressed? + { + done=TRUE; // ESC signalled A quit + } + else + { + DrawGLScene(); // Draw The Scene + SwapBuffers(hDC); // Swap Buffers (Double Buffering) + } + } + + if (keys[VK_F1]) // Is F1 Being Pressed? + { + keys[VK_F1]=FALSE; // If so make Key FALSE + KillGLWindow(); // Kill Our Current Window + fullscreen=!fullscreen; // Toggle Fullscreen + //recreate Our OpenGL Window + if (!CreateGLWindow(windowTitle, 640, 480, 16, fullscreen)) + { + return 0; // Quit if Window Was Not Created + } + } + } + } + + // Shutdown + destroyAILogger(); + KillGLWindow(); + return (msg.wParam); // Exit The Program +} + + + + + diff --git a/samples/bin/DevIL.dll b/samples/bin/DevIL.dll new file mode 100644 index 000000000..b7a4c0906 Binary files /dev/null and b/samples/bin/DevIL.dll differ diff --git a/samples/bin/ILU.dll b/samples/bin/ILU.dll new file mode 100644 index 000000000..b5f6561c3 Binary files /dev/null and b/samples/bin/ILU.dll differ diff --git a/samples/bin/ILUT.dll b/samples/bin/ILUT.dll new file mode 100644 index 000000000..33178896c Binary files /dev/null and b/samples/bin/ILUT.dll differ diff --git a/samples/bin/glut32.dll b/samples/bin/glut32.dll new file mode 100644 index 000000000..106646ff7 Binary files /dev/null and b/samples/bin/glut32.dll differ diff --git a/samples/glut/GL/glut.h b/samples/glut/GL/glut.h new file mode 100644 index 000000000..aa7428f36 --- /dev/null +++ b/samples/glut/GL/glut.h @@ -0,0 +1,716 @@ +#ifndef __glut_h__ +#define __glut_h__ + +/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */ + +/* This program is freely distributable without licensing fees and is + provided without guarantee or warrantee expressed or implied. This + program is -not- in the public domain. */ + +#if defined(_WIN32) + +/* GLUT 3.7 now tries to avoid including + to avoid name space pollution, but Win32's + needs APIENTRY and WINGDIAPI defined properly. */ +# if 0 + /* This would put tons of macros and crap in our clean name space. */ +# define WIN32_LEAN_AND_MEAN +# include +# else + /* XXX This is from Win32's */ +# ifndef APIENTRY +# define GLUT_APIENTRY_DEFINED +# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__) +# define APIENTRY __stdcall +# else +# define APIENTRY +# endif +# endif + /* XXX This is from Win32's */ +# ifndef CALLBACK +# if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) || defined(__LCC__) +# define CALLBACK __stdcall +# else +# define CALLBACK +# endif +# endif + /* XXX Hack for lcc compiler. It doesn't support __declspec(dllimport), just __stdcall. */ +# if defined( __LCC__ ) +# undef WINGDIAPI +# define WINGDIAPI __stdcall +# else + /* XXX This is from Win32's and */ +# ifndef WINGDIAPI +# define GLUT_WINGDIAPI_DEFINED +# define WINGDIAPI __declspec(dllimport) +# endif +# endif + /* XXX This is from Win32's */ +# ifndef _WCHAR_T_DEFINED +typedef unsigned short wchar_t; +# define _WCHAR_T_DEFINED +# endif +# endif + +/* To disable automatic library usage for GLUT, define GLUT_NO_LIB_PRAGMA + in your compile preprocessor options. */ +# if !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA) +# pragma comment (lib, "winmm.lib") /* link with Windows MultiMedia lib */ +/* To enable automatic SGI OpenGL for Windows library usage for GLUT, + define GLUT_USE_SGI_OPENGL in your compile preprocessor options. */ +# ifdef GLUT_USE_SGI_OPENGL +# pragma comment (lib, "opengl.lib") /* link with SGI OpenGL for Windows lib */ +# pragma comment (lib, "glu.lib") /* link with SGI OpenGL Utility lib */ +# pragma comment (lib, "glut.lib") /* link with Win32 GLUT for SGI OpenGL lib */ +# else +# pragma comment (lib, "opengl32.lib") /* link with Microsoft OpenGL lib */ +# pragma comment (lib, "glu32.lib") /* link with Microsoft OpenGL Utility lib */ +# pragma comment (lib, "glut32.lib") /* link with Win32 GLUT lib */ +# endif +# endif + +/* To disable supression of annoying warnings about floats being promoted + to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor + options. */ +# ifndef GLUT_NO_WARNING_DISABLE +# pragma warning (disable:4244) /* Disable bogus VC++ 4.2 conversion warnings. */ +# pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */ +# endif + +/* Win32 has an annoying issue where there are multiple C run-time + libraries (CRTs). If the executable is linked with a different CRT + from the GLUT DLL, the GLUT DLL will not share the same CRT static + data seen by the executable. In particular, atexit callbacks registered + in the executable will not be called if GLUT calls its (different) + exit routine). GLUT is typically built with the + "/MD" option (the CRT with multithreading DLL support), but the Visual + C++ linker default is "/ML" (the single threaded CRT). + + One workaround to this issue is requiring users to always link with + the same CRT as GLUT is compiled with. That requires users supply a + non-standard option. GLUT 3.7 has its own built-in workaround where + the executable's "exit" function pointer is covertly passed to GLUT. + GLUT then calls the executable's exit function pointer to ensure that + any "atexit" calls registered by the application are called if GLUT + needs to exit. + + Note that the __glut*WithExit routines should NEVER be called directly. + To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */ + +/* XXX This is from Win32's */ +# if !defined(_MSC_VER) && !defined(__cdecl) + /* Define __cdecl for non-Microsoft compilers. */ +# define __cdecl +# define GLUT_DEFINED___CDECL +# endif +# ifndef _CRTIMP +# ifdef _NTSDK + /* Definition compatible with NT SDK */ +# define _CRTIMP +# else + /* Current definition */ +# ifdef _DLL +# define _CRTIMP __declspec(dllimport) +# else +# define _CRTIMP +# endif +# endif +# define GLUT_DEFINED__CRTIMP +# endif + +/* GLUT API entry point declarations for Win32. */ +# ifdef GLUT_BUILDING_LIB +# define GLUTAPI __declspec(dllexport) +# else +# ifdef _DLL +# define GLUTAPI __declspec(dllimport) +# else +# define GLUTAPI extern +# endif +# endif + +/* GLUT callback calling convention for Win32. */ +# define GLUTCALLBACK __cdecl + +#endif /* _WIN32 */ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_WIN32) +# ifndef GLUT_BUILDING_LIB +extern _CRTIMP void __cdecl exit(int); +# endif +#else +/* non-Win32 case. */ +/* Define APIENTRY and CALLBACK to nothing if we aren't on Win32. */ +# define APIENTRY +# define GLUT_APIENTRY_DEFINED +# define CALLBACK +/* Define GLUTAPI and GLUTCALLBACK as below if we aren't on Win32. */ +# define GLUTAPI extern +# define GLUTCALLBACK +/* Prototype exit for the non-Win32 case (see above). */ +extern void exit(int); +#endif + +/** + GLUT API revision history: + + GLUT_API_VERSION is updated to reflect incompatible GLUT + API changes (interface changes, semantic changes, deletions, + or additions). + + GLUT_API_VERSION=1 First public release of GLUT. 11/29/94 + + GLUT_API_VERSION=2 Added support for OpenGL/GLX multisampling, + extension. Supports new input devices like tablet, dial and button + box, and Spaceball. Easy to query OpenGL extensions. + + GLUT_API_VERSION=3 glutMenuStatus added. + + GLUT_API_VERSION=4 glutInitDisplayString, glutWarpPointer, + glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic + video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc, + glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat, + glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!). +**/ +#ifndef GLUT_API_VERSION /* allow this to be overriden */ +#define GLUT_API_VERSION 3 +#endif + +/** + GLUT implementation revision history: + + GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT + API revisions and implementation revisions (ie, bug fixes). + + GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of + GLUT Xlib-based implementation. 11/29/94 + + GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of + GLUT Xlib-based implementation providing GLUT version 2 + interfaces. + + GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95 + + GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95 + + GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95 + + GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96 + + GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner + and video resize. 1/3/97 + + GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines. + + GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release. + + GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling. + + GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support. + + GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface. + + GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa +**/ +#ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */ +#define GLUT_XLIB_IMPLEMENTATION 15 +#endif + +/* Display mode bit masks. */ +#define GLUT_RGB 0 +#define GLUT_RGBA GLUT_RGB +#define GLUT_INDEX 1 +#define GLUT_SINGLE 0 +#define GLUT_DOUBLE 2 +#define GLUT_ACCUM 4 +#define GLUT_ALPHA 8 +#define GLUT_DEPTH 16 +#define GLUT_STENCIL 32 +#if (GLUT_API_VERSION >= 2) +#define GLUT_MULTISAMPLE 128 +#define GLUT_STEREO 256 +#endif +#if (GLUT_API_VERSION >= 3) +#define GLUT_LUMINANCE 512 +#endif + +/* Mouse buttons. */ +#define GLUT_LEFT_BUTTON 0 +#define GLUT_MIDDLE_BUTTON 1 +#define GLUT_RIGHT_BUTTON 2 + +/* Mouse button state. */ +#define GLUT_DOWN 0 +#define GLUT_UP 1 + +#if (GLUT_API_VERSION >= 2) +/* function keys */ +#define GLUT_KEY_F1 1 +#define GLUT_KEY_F2 2 +#define GLUT_KEY_F3 3 +#define GLUT_KEY_F4 4 +#define GLUT_KEY_F5 5 +#define GLUT_KEY_F6 6 +#define GLUT_KEY_F7 7 +#define GLUT_KEY_F8 8 +#define GLUT_KEY_F9 9 +#define GLUT_KEY_F10 10 +#define GLUT_KEY_F11 11 +#define GLUT_KEY_F12 12 +/* directional keys */ +#define GLUT_KEY_LEFT 100 +#define GLUT_KEY_UP 101 +#define GLUT_KEY_RIGHT 102 +#define GLUT_KEY_DOWN 103 +#define GLUT_KEY_PAGE_UP 104 +#define GLUT_KEY_PAGE_DOWN 105 +#define GLUT_KEY_HOME 106 +#define GLUT_KEY_END 107 +#define GLUT_KEY_INSERT 108 +#endif + +/* Entry/exit state. */ +#define GLUT_LEFT 0 +#define GLUT_ENTERED 1 + +/* Menu usage state. */ +#define GLUT_MENU_NOT_IN_USE 0 +#define GLUT_MENU_IN_USE 1 + +/* Visibility state. */ +#define GLUT_NOT_VISIBLE 0 +#define GLUT_VISIBLE 1 + +/* Window status state. */ +#define GLUT_HIDDEN 0 +#define GLUT_FULLY_RETAINED 1 +#define GLUT_PARTIALLY_RETAINED 2 +#define GLUT_FULLY_COVERED 3 + +/* Color index component selection values. */ +#define GLUT_RED 0 +#define GLUT_GREEN 1 +#define GLUT_BLUE 2 + +#if defined(_WIN32) +/* Stroke font constants (use these in GLUT program). */ +#define GLUT_STROKE_ROMAN ((void*)0) +#define GLUT_STROKE_MONO_ROMAN ((void*)1) + +/* Bitmap font constants (use these in GLUT program). */ +#define GLUT_BITMAP_9_BY_15 ((void*)2) +#define GLUT_BITMAP_8_BY_13 ((void*)3) +#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4) +#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5) +#if (GLUT_API_VERSION >= 3) +#define GLUT_BITMAP_HELVETICA_10 ((void*)6) +#define GLUT_BITMAP_HELVETICA_12 ((void*)7) +#define GLUT_BITMAP_HELVETICA_18 ((void*)8) +#endif +#else +/* Stroke font opaque addresses (use constants instead in source code). */ +GLUTAPI void *glutStrokeRoman; +GLUTAPI void *glutStrokeMonoRoman; + +/* Stroke font constants (use these in GLUT program). */ +#define GLUT_STROKE_ROMAN (&glutStrokeRoman) +#define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman) + +/* Bitmap font opaque addresses (use constants instead in source code). */ +GLUTAPI void *glutBitmap9By15; +GLUTAPI void *glutBitmap8By13; +GLUTAPI void *glutBitmapTimesRoman10; +GLUTAPI void *glutBitmapTimesRoman24; +GLUTAPI void *glutBitmapHelvetica10; +GLUTAPI void *glutBitmapHelvetica12; +GLUTAPI void *glutBitmapHelvetica18; + +/* Bitmap font constants (use these in GLUT program). */ +#define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15) +#define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13) +#define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10) +#define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24) +#if (GLUT_API_VERSION >= 3) +#define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10) +#define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12) +#define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18) +#endif +#endif + +/* glutGet parameters. */ +#define GLUT_WINDOW_X ((GLenum) 100) +#define GLUT_WINDOW_Y ((GLenum) 101) +#define GLUT_WINDOW_WIDTH ((GLenum) 102) +#define GLUT_WINDOW_HEIGHT ((GLenum) 103) +#define GLUT_WINDOW_BUFFER_SIZE ((GLenum) 104) +#define GLUT_WINDOW_STENCIL_SIZE ((GLenum) 105) +#define GLUT_WINDOW_DEPTH_SIZE ((GLenum) 106) +#define GLUT_WINDOW_RED_SIZE ((GLenum) 107) +#define GLUT_WINDOW_GREEN_SIZE ((GLenum) 108) +#define GLUT_WINDOW_BLUE_SIZE ((GLenum) 109) +#define GLUT_WINDOW_ALPHA_SIZE ((GLenum) 110) +#define GLUT_WINDOW_ACCUM_RED_SIZE ((GLenum) 111) +#define GLUT_WINDOW_ACCUM_GREEN_SIZE ((GLenum) 112) +#define GLUT_WINDOW_ACCUM_BLUE_SIZE ((GLenum) 113) +#define GLUT_WINDOW_ACCUM_ALPHA_SIZE ((GLenum) 114) +#define GLUT_WINDOW_DOUBLEBUFFER ((GLenum) 115) +#define GLUT_WINDOW_RGBA ((GLenum) 116) +#define GLUT_WINDOW_PARENT ((GLenum) 117) +#define GLUT_WINDOW_NUM_CHILDREN ((GLenum) 118) +#define GLUT_WINDOW_COLORMAP_SIZE ((GLenum) 119) +#if (GLUT_API_VERSION >= 2) +#define GLUT_WINDOW_NUM_SAMPLES ((GLenum) 120) +#define GLUT_WINDOW_STEREO ((GLenum) 121) +#endif +#if (GLUT_API_VERSION >= 3) +#define GLUT_WINDOW_CURSOR ((GLenum) 122) +#endif +#define GLUT_SCREEN_WIDTH ((GLenum) 200) +#define GLUT_SCREEN_HEIGHT ((GLenum) 201) +#define GLUT_SCREEN_WIDTH_MM ((GLenum) 202) +#define GLUT_SCREEN_HEIGHT_MM ((GLenum) 203) +#define GLUT_MENU_NUM_ITEMS ((GLenum) 300) +#define GLUT_DISPLAY_MODE_POSSIBLE ((GLenum) 400) +#define GLUT_INIT_WINDOW_X ((GLenum) 500) +#define GLUT_INIT_WINDOW_Y ((GLenum) 501) +#define GLUT_INIT_WINDOW_WIDTH ((GLenum) 502) +#define GLUT_INIT_WINDOW_HEIGHT ((GLenum) 503) +#define GLUT_INIT_DISPLAY_MODE ((GLenum) 504) +#if (GLUT_API_VERSION >= 2) +#define GLUT_ELAPSED_TIME ((GLenum) 700) +#endif +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) +#define GLUT_WINDOW_FORMAT_ID ((GLenum) 123) +#endif + +#if (GLUT_API_VERSION >= 2) +/* glutDeviceGet parameters. */ +#define GLUT_HAS_KEYBOARD ((GLenum) 600) +#define GLUT_HAS_MOUSE ((GLenum) 601) +#define GLUT_HAS_SPACEBALL ((GLenum) 602) +#define GLUT_HAS_DIAL_AND_BUTTON_BOX ((GLenum) 603) +#define GLUT_HAS_TABLET ((GLenum) 604) +#define GLUT_NUM_MOUSE_BUTTONS ((GLenum) 605) +#define GLUT_NUM_SPACEBALL_BUTTONS ((GLenum) 606) +#define GLUT_NUM_BUTTON_BOX_BUTTONS ((GLenum) 607) +#define GLUT_NUM_DIALS ((GLenum) 608) +#define GLUT_NUM_TABLET_BUTTONS ((GLenum) 609) +#endif +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) +#define GLUT_DEVICE_IGNORE_KEY_REPEAT ((GLenum) 610) +#define GLUT_DEVICE_KEY_REPEAT ((GLenum) 611) +#define GLUT_HAS_JOYSTICK ((GLenum) 612) +#define GLUT_OWNS_JOYSTICK ((GLenum) 613) +#define GLUT_JOYSTICK_BUTTONS ((GLenum) 614) +#define GLUT_JOYSTICK_AXES ((GLenum) 615) +#define GLUT_JOYSTICK_POLL_RATE ((GLenum) 616) +#endif + +#if (GLUT_API_VERSION >= 3) +/* glutLayerGet parameters. */ +#define GLUT_OVERLAY_POSSIBLE ((GLenum) 800) +#define GLUT_LAYER_IN_USE ((GLenum) 801) +#define GLUT_HAS_OVERLAY ((GLenum) 802) +#define GLUT_TRANSPARENT_INDEX ((GLenum) 803) +#define GLUT_NORMAL_DAMAGED ((GLenum) 804) +#define GLUT_OVERLAY_DAMAGED ((GLenum) 805) + +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) +/* glutVideoResizeGet parameters. */ +#define GLUT_VIDEO_RESIZE_POSSIBLE ((GLenum) 900) +#define GLUT_VIDEO_RESIZE_IN_USE ((GLenum) 901) +#define GLUT_VIDEO_RESIZE_X_DELTA ((GLenum) 902) +#define GLUT_VIDEO_RESIZE_Y_DELTA ((GLenum) 903) +#define GLUT_VIDEO_RESIZE_WIDTH_DELTA ((GLenum) 904) +#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA ((GLenum) 905) +#define GLUT_VIDEO_RESIZE_X ((GLenum) 906) +#define GLUT_VIDEO_RESIZE_Y ((GLenum) 907) +#define GLUT_VIDEO_RESIZE_WIDTH ((GLenum) 908) +#define GLUT_VIDEO_RESIZE_HEIGHT ((GLenum) 909) +#endif + +/* glutUseLayer parameters. */ +#define GLUT_NORMAL ((GLenum) 0) +#define GLUT_OVERLAY ((GLenum) 1) + +/* glutGetModifiers return mask. */ +#define GLUT_ACTIVE_SHIFT 1 +#define GLUT_ACTIVE_CTRL 2 +#define GLUT_ACTIVE_ALT 4 + +/* glutSetCursor parameters. */ +/* Basic arrows. */ +#define GLUT_CURSOR_RIGHT_ARROW 0 +#define GLUT_CURSOR_LEFT_ARROW 1 +/* Symbolic cursor shapes. */ +#define GLUT_CURSOR_INFO 2 +#define GLUT_CURSOR_DESTROY 3 +#define GLUT_CURSOR_HELP 4 +#define GLUT_CURSOR_CYCLE 5 +#define GLUT_CURSOR_SPRAY 6 +#define GLUT_CURSOR_WAIT 7 +#define GLUT_CURSOR_TEXT 8 +#define GLUT_CURSOR_CROSSHAIR 9 +/* Directional cursors. */ +#define GLUT_CURSOR_UP_DOWN 10 +#define GLUT_CURSOR_LEFT_RIGHT 11 +/* Sizing cursors. */ +#define GLUT_CURSOR_TOP_SIDE 12 +#define GLUT_CURSOR_BOTTOM_SIDE 13 +#define GLUT_CURSOR_LEFT_SIDE 14 +#define GLUT_CURSOR_RIGHT_SIDE 15 +#define GLUT_CURSOR_TOP_LEFT_CORNER 16 +#define GLUT_CURSOR_TOP_RIGHT_CORNER 17 +#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18 +#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19 +/* Inherit from parent window. */ +#define GLUT_CURSOR_INHERIT 100 +/* Blank cursor. */ +#define GLUT_CURSOR_NONE 101 +/* Fullscreen crosshair (if available). */ +#define GLUT_CURSOR_FULL_CROSSHAIR 102 +#endif + +/* GLUT initialization sub-API. */ +GLUTAPI void APIENTRY glutInit(int *argcp, char **argv); +#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) +GLUTAPI void APIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int)); +#ifndef GLUT_BUILDING_LIB +static void APIENTRY glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); } +#define glutInit glutInit_ATEXIT_HACK +#endif +#endif +GLUTAPI void APIENTRY glutInitDisplayMode(unsigned int mode); +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) +GLUTAPI void APIENTRY glutInitDisplayString(const char *string); +#endif +GLUTAPI void APIENTRY glutInitWindowPosition(int x, int y); +GLUTAPI void APIENTRY glutInitWindowSize(int width, int height); +GLUTAPI void APIENTRY glutMainLoop(void); + +/* GLUT window sub-API. */ +GLUTAPI int APIENTRY glutCreateWindow(const char *title); +#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) +GLUTAPI int APIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int)); +#ifndef GLUT_BUILDING_LIB +static int APIENTRY glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); } +#define glutCreateWindow glutCreateWindow_ATEXIT_HACK +#endif +#endif +GLUTAPI int APIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height); +GLUTAPI void APIENTRY glutDestroyWindow(int win); +GLUTAPI void APIENTRY glutPostRedisplay(void); +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11) +GLUTAPI void APIENTRY glutPostWindowRedisplay(int win); +#endif +GLUTAPI void APIENTRY glutSwapBuffers(void); +GLUTAPI int APIENTRY glutGetWindow(void); +GLUTAPI void APIENTRY glutSetWindow(int win); +GLUTAPI void APIENTRY glutSetWindowTitle(const char *title); +GLUTAPI void APIENTRY glutSetIconTitle(const char *title); +GLUTAPI void APIENTRY glutPositionWindow(int x, int y); +GLUTAPI void APIENTRY glutReshapeWindow(int width, int height); +GLUTAPI void APIENTRY glutPopWindow(void); +GLUTAPI void APIENTRY glutPushWindow(void); +GLUTAPI void APIENTRY glutIconifyWindow(void); +GLUTAPI void APIENTRY glutShowWindow(void); +GLUTAPI void APIENTRY glutHideWindow(void); +#if (GLUT_API_VERSION >= 3) +GLUTAPI void APIENTRY glutFullScreen(void); +GLUTAPI void APIENTRY glutSetCursor(int cursor); +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) +GLUTAPI void APIENTRY glutWarpPointer(int x, int y); +#endif + +/* GLUT overlay sub-API. */ +GLUTAPI void APIENTRY glutEstablishOverlay(void); +GLUTAPI void APIENTRY glutRemoveOverlay(void); +GLUTAPI void APIENTRY glutUseLayer(GLenum layer); +GLUTAPI void APIENTRY glutPostOverlayRedisplay(void); +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11) +GLUTAPI void APIENTRY glutPostWindowOverlayRedisplay(int win); +#endif +GLUTAPI void APIENTRY glutShowOverlay(void); +GLUTAPI void APIENTRY glutHideOverlay(void); +#endif + +/* GLUT menu sub-API. */ +GLUTAPI int APIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int)); +#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) +GLUTAPI int APIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)(int), void (__cdecl *exitfunc)(int)); +#ifndef GLUT_BUILDING_LIB +static int APIENTRY glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK *func)(int)) { return __glutCreateMenuWithExit(func, exit); } +#define glutCreateMenu glutCreateMenu_ATEXIT_HACK +#endif +#endif +GLUTAPI void APIENTRY glutDestroyMenu(int menu); +GLUTAPI int APIENTRY glutGetMenu(void); +GLUTAPI void APIENTRY glutSetMenu(int menu); +GLUTAPI void APIENTRY glutAddMenuEntry(const char *label, int value); +GLUTAPI void APIENTRY glutAddSubMenu(const char *label, int submenu); +GLUTAPI void APIENTRY glutChangeToMenuEntry(int item, const char *label, int value); +GLUTAPI void APIENTRY glutChangeToSubMenu(int item, const char *label, int submenu); +GLUTAPI void APIENTRY glutRemoveMenuItem(int item); +GLUTAPI void APIENTRY glutAttachMenu(int button); +GLUTAPI void APIENTRY glutDetachMenu(int button); + +/* GLUT window callback sub-API. */ +GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void)); +GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int width, int height)); +GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y)); +GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y)); +GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK *func)(int x, int y)); +GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK *func)(int x, int y)); +GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK *func)(int state)); +GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK *func)(int state)); +GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK *func)(void)); +GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK *func)(int value), int value); +GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK *func)(int state)); +#if (GLUT_API_VERSION >= 2) +GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key, int x, int y)); +GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK *func)(int x, int y, int z)); +GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK *func)(int x, int y, int z)); +GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK *func)(int button, int state)); +GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK *func)(int button, int state)); +GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK *func)(int dial, int value)); +GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK *func)(int x, int y)); +GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y)); +#if (GLUT_API_VERSION >= 3) +GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK *func)(int status, int x, int y)); +GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK *func)(void)); +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) +GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK *func)(int state)); +#endif +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) +GLUTAPI void APIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y)); +GLUTAPI void APIENTRY glutSpecialUpFunc(void (GLUTCALLBACK *func)(int key, int x, int y)); +GLUTAPI void APIENTRY glutJoystickFunc(void (GLUTCALLBACK *func)(unsigned int buttonMask, int x, int y, int z), int pollInterval); +#endif +#endif +#endif + +/* GLUT color index sub-API. */ +GLUTAPI void APIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue); +GLUTAPI GLfloat APIENTRY glutGetColor(int ndx, int component); +GLUTAPI void APIENTRY glutCopyColormap(int win); + +/* GLUT state retrieval sub-API. */ +GLUTAPI int APIENTRY glutGet(GLenum type); +GLUTAPI int APIENTRY glutDeviceGet(GLenum type); +#if (GLUT_API_VERSION >= 2) +/* GLUT extension support sub-API */ +GLUTAPI int APIENTRY glutExtensionSupported(const char *name); +#endif +#if (GLUT_API_VERSION >= 3) +GLUTAPI int APIENTRY glutGetModifiers(void); +GLUTAPI int APIENTRY glutLayerGet(GLenum type); +#endif + +/* GLUT font sub-API */ +GLUTAPI void APIENTRY glutBitmapCharacter(void *font, int character); +GLUTAPI int APIENTRY glutBitmapWidth(void *font, int character); +GLUTAPI void APIENTRY glutStrokeCharacter(void *font, int character); +GLUTAPI int APIENTRY glutStrokeWidth(void *font, int character); +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) +GLUTAPI int APIENTRY glutBitmapLength(void *font, const unsigned char *string); +GLUTAPI int APIENTRY glutStrokeLength(void *font, const unsigned char *string); +#endif + +/* GLUT pre-built models sub-API */ +GLUTAPI void APIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks); +GLUTAPI void APIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks); +GLUTAPI void APIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); +GLUTAPI void APIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); +GLUTAPI void APIENTRY glutWireCube(GLdouble size); +GLUTAPI void APIENTRY glutSolidCube(GLdouble size); +GLUTAPI void APIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); +GLUTAPI void APIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); +GLUTAPI void APIENTRY glutWireDodecahedron(void); +GLUTAPI void APIENTRY glutSolidDodecahedron(void); +GLUTAPI void APIENTRY glutWireTeapot(GLdouble size); +GLUTAPI void APIENTRY glutSolidTeapot(GLdouble size); +GLUTAPI void APIENTRY glutWireOctahedron(void); +GLUTAPI void APIENTRY glutSolidOctahedron(void); +GLUTAPI void APIENTRY glutWireTetrahedron(void); +GLUTAPI void APIENTRY glutSolidTetrahedron(void); +GLUTAPI void APIENTRY glutWireIcosahedron(void); +GLUTAPI void APIENTRY glutSolidIcosahedron(void); + +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) +/* GLUT video resize sub-API. */ +GLUTAPI int APIENTRY glutVideoResizeGet(GLenum param); +GLUTAPI void APIENTRY glutSetupVideoResizing(void); +GLUTAPI void APIENTRY glutStopVideoResizing(void); +GLUTAPI void APIENTRY glutVideoResize(int x, int y, int width, int height); +GLUTAPI void APIENTRY glutVideoPan(int x, int y, int width, int height); + +/* GLUT debugging sub-API. */ +GLUTAPI void APIENTRY glutReportErrors(void); +#endif + +#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) +/* GLUT device control sub-API. */ +/* glutSetKeyRepeat modes. */ +#define GLUT_KEY_REPEAT_OFF 0 +#define GLUT_KEY_REPEAT_ON 1 +#define GLUT_KEY_REPEAT_DEFAULT 2 + +/* Joystick button masks. */ +#define GLUT_JOYSTICK_BUTTON_A 1 +#define GLUT_JOYSTICK_BUTTON_B 2 +#define GLUT_JOYSTICK_BUTTON_C 4 +#define GLUT_JOYSTICK_BUTTON_D 8 + +GLUTAPI void APIENTRY glutIgnoreKeyRepeat(int ignore); +GLUTAPI void APIENTRY glutSetKeyRepeat(int repeatMode); +GLUTAPI void APIENTRY glutForceJoystickFunc(void); + +/* GLUT game mode sub-API. */ +/* glutGameModeGet. */ +#define GLUT_GAME_MODE_ACTIVE ((GLenum) 0) +#define GLUT_GAME_MODE_POSSIBLE ((GLenum) 1) +#define GLUT_GAME_MODE_WIDTH ((GLenum) 2) +#define GLUT_GAME_MODE_HEIGHT ((GLenum) 3) +#define GLUT_GAME_MODE_PIXEL_DEPTH ((GLenum) 4) +#define GLUT_GAME_MODE_REFRESH_RATE ((GLenum) 5) +#define GLUT_GAME_MODE_DISPLAY_CHANGED ((GLenum) 6) + +GLUTAPI void APIENTRY glutGameModeString(const char *string); +GLUTAPI int APIENTRY glutEnterGameMode(void); +GLUTAPI void APIENTRY glutLeaveGameMode(void); +GLUTAPI int APIENTRY glutGameModeGet(GLenum mode); +#endif + +#ifdef __cplusplus +} + +#endif + +#ifdef GLUT_APIENTRY_DEFINED +# undef GLUT_APIENTRY_DEFINED +# undef APIENTRY +#endif + +#ifdef GLUT_WINGDIAPI_DEFINED +# undef GLUT_WINGDIAPI_DEFINED +# undef WINGDIAPI +#endif + +#ifdef GLUT_DEFINED___CDECL +# undef GLUT_DEFINED___CDECL +# undef __cdecl +#endif + +#ifdef GLUT_DEFINED__CRTIMP +# undef GLUT_DEFINED__CRTIMP +# undef _CRTIMP +#endif + +#endif /* __glut_h__ */ diff --git a/samples/glut/README-win32.txt b/samples/glut/README-win32.txt new file mode 100644 index 000000000..67c8d413e --- /dev/null +++ b/samples/glut/README-win32.txt @@ -0,0 +1,613 @@ + + + GLUT for Win32 README + --------------------- + + +VERSION/INFO: + + This is GLUT for Win32 version 3.7.6 as of Nov 8th 2001. + See the COPYRIGHT section for distribution and copyright notices. + Send all bug reports and questions for this version of GLUT to + Nate Robins [nate@pobox.com]. + + For more information about GLUT for Win32, see the web page: + www.pobox.com/~nate/glut.html or subscribe to the GLUT for Win32 + mailing list by sending e-mail to majordomo@perp.com with + "subscribe glut" in the body of the message. + + For general information about GLUT, see the GLUT web page: + http://reality.sgi.com/opengl/glut3/glut3.html and be sure to + check the GLUT FAQ first for any questions that you may have: + http://reality.sgi.com/opengl/glut3/glut-faq.html + + +COMPILING/INSTALLATION: + + o Precompiled versions of the DLL and import library can be + found on the GLUT for Win32 web page mentioned above. + + o Microsoft Developer Studio 6 workspace and project files have + been included in the source code distribution. + + To build the glut dll: + First, open Microsoft Developer Studio. + Then, select File -> Open Workspace and find the glut.dsw file + in the file dialog and double-click on it. + Finally, select Build -> Build glut32.dll. + When the build is finished, it will copy: + glut32.dll to %WinDir%\System, + glut32.lib to $(MSDevDir)\..\..\VC98\lib, and + glut.h to $(MSDevDir)\..\..\VC98\include\GL. + + Additional workspace files have been included in the progs, test + and lib directories to build the progs, tests and libs respectively. + + +BORLAND NOTES: + + From what I understand, Borland supplies a utility that + converts Microsoft Visual C++ .libs into Borland compatible + files. Therefore, the best method for Borland users is + probably to get the precompiled versions of the library and + convert the library. To create an import library for Borland + from the DLLs, use the following command (from a command prompt): + IMPLIB glut32.lib glut32.dll + If IMPLIB crashes when called this way, try + IMPLIB glut32.lib glut32.def + using the glut32.def file in this distribution. + + +FORTRAN NOTES: + + Bill Mitchell [william.mitchell@nist.gov] has put considerable + effort into getting GLUT to work with different compilers for + Fortran 90. He indicates that you should copy the f90glut.h + file to your $(MSDevDir)\..\..\VC98\include\GL directory. + Then, just build GLUT as usual. The Fortran 90 interface, f90gl, + can be obtained at http://math.nist.gov/f90gl and contains + installation instructions and usage examples. + + +MISC NOTES: + + o Overlay support is not implemented, nor are there any plans to + implement it in the near future. + + o To customize the windows icon, you can use the resource name + GLUT_ICON. For example, create an icon named "glut.ico", and + create a file called glut.rc that contains the following: + GLUT_ICON ICON glut.ico + then compile the glut.rc file with the following: + rc /r glut + and link the resulting glut.res file into your executable + (just like you would an object file). + Alternatively, you can simply add the glut.rc file to your + project if you are using Microsoft Developer Studio. + + +IMPLEMENTATION DEPENDENT DIFFERENCES: + + There are a few differences between the Win32 version of GLUT + and the X11 version of GLUT. Those are outlined here. Note + that MOST of these differences are allowed by the GLUT + specification. Bugs and unsupported features are outlined in + the UNSUPPORTED/BUGS section. + + o glutInit: + The following command line options have no meaning (and are + ignored) in GLUT for Win32: + -display, -indirect, -direct, -sync. + + o glutInitWindowPosition, glutPositionWindow: + Win32 has two different coordinate systems for windows. + One is in terms of client space and the other is the whole + window space (including the decorations). If you + glutPositionWindow(0, 0), GLUT for Win32 will place the + window CLIENT area at 0, 0. This will cause the window + decorations (title bar and left edge) to be OFF-SCREEN, but + it gives the user the most flexibility in positioning. + HOWEVER, if the user specifies glutInitWindowPosition(0, 0), + the window is placed relative to window space at 0, 0. + This will cause the window to be opened in the upper left + corner with all the decorations showing. This behaviour is + acceptable under the current GLUT specification. + + o glutSetIconTitle, glutSetWindowTitle: + There is no separation between Icon title and Window title + in Win32. Therefore, setting an icon title in Win32 has + no effect. + + o glutSetCursor: + As indicated in the GLUT specification, cursors may be + different on different platforms. This is the case in GLUT + for Win32. For the most part, the cursors will match the + meaning, but not necessarily the shape. Notable exceptions + are the GLUT_CURSOR_INFO & GLUT_CURSOR_SPRAY which use the + crosshair cursor and the GLUT_CURSOR_CYCLE which uses the + 'no' or 'destroy' cursor in Win32. + + o glutVisibilityFunc: + Win32 seems to be unable to determine if a window is fully + obscured. Therefore, the visibility of a GLUT window is + only reflected by its Iconic, Hidden or Shown state. That + is, even if a window is fully obscured, in GLUT for Win32, + it is still "visible". + + o glutEntryFunc: + Window Focus is handled differently in Win32 and X. + Specifically, the "window manager" in Win32 uses a "click to + focus" policy. That is, in order for a window to receive + focus, a mouse button must be clicked in it. Likewise, in + order for a window to loose focus, a mouse button must be + clicked outside the window (or in another window). + Therefore, the Enter and Leave notification provided by GLUT + may behave differently in the Win32 and in X11 versions. + There is a viable workaround for this. A program called + "Tweak UI" is provided by Microsoft which can be used to + change the focus policy in Win32 to "focus follows mouse". + It is available from the Microsoft Web Pages: + http://www.microsoft.com/windows/software/PowerToy.htm + + o glutCopyColormap: + GLUT for Win32 always copies the colormap. There is never + any sharing of colormaps. This is probably okay, since + Win32 merges the logical palette and the physical palette + anyway, so even if there are two windows with totally + different colors in their colormaps, Win32 will find a + (hopefully) good match between them. + + o glutIdleFunc + menus: + The glut idle function will NOT be called when a menu is + active. This causes all animation to stop when a menu is + active (in general, this is probably okay). Timer + functions will still fire, however. If the timer callback + draws into the rendering context, the drawing will not show + up until after the menu has finished, though. + + +UNSUPPORTED/BUGS: + + o glutAttachMenu: + Win32 only likes to work with left and right mouse buttons. + Especially so with popup menus. Therefore, when attaching + the menu to the middle mouse button, the LEFT mouse button + must be used to select from the menu. + + o glutSpaceball*, glutButtonBox*, glutTablet*, glutDials*: + None of the special input devices are supported at this + time. + + o When resizing or moving a GLUT for Win32 window, no updating + is performed. This causes the window to leave "tracks" on + the screen when getting bigger or when previously obscured + parts are being revealed. I put in a bit of a kludgy + workaround for those that absolutely can't have the weird + lines. The reshape callback is called multiple times for + reshapes. Therefore, in the reshape callback, some drawing + can be done. It should probably be limited to a color buffer + clear. + + o The video resizing capabilities of GLUT 3.3+ for X11 is + currently unimplemented (this is probably ok, since it + really isn't part of the spec until 4.0). I doubt that + this will ever be part of GLUT for Win32, since there is no + hardware to support it. A hack could simply change the + resolution of the desktop. + + +CHANGES/FIXES: + + (Nov 8, '01) + x Released 3.7.6 + + (Nov 8, '01) + x Changed fullscreen mode from TOPMOST back to simply TOP, since + (it turns out) many people use windows atop a GLUT window. + + (Nov 8, '01) + x Added code to prevent CPU spiking when no idle function is + registered. Otherwise, if an idle function is registered, spike + CPU so that the idle function gets all the attention it needs and + if this is a problem on the program side, the user can stick a + sleep() in their idle function. I believe that this strikes the + best balance betweeen GLUT being fast, and also being "nice" to + other processes. Thanks to James Wright for reporting this bug. + + (Nov 8, '01) + x Fixed bug in motion callback handler which wasn't setting the + current window, so multiple window apps (e.g., any GLUI app) + wouldn't get the callback correctly. + + (Oct 4, '01) + x Fixed bug in glutEnterGameMode() that caused new windows to not + be in "fullscreen" mode, so they got window decorations. + + (Oct 4, '01) + x Fixed bug in glutEnterGameMode() that caused new windows to not + be in "fullscreen" mode, so they got window decorations. + + (Oct 3, '01) + x Fixed bug in getVisualInfoFromString(): visuals not reloaded on + display mode change. Reload visuals each time they are queried. + This fixes a problem with Win32 because the list of availabe Visuals + (Pixelformats) changes after a change in displaymode. The problem + occurs when switching to gamemode and back. Thanks to Michael + Wimmer for pointing this out & providing the fix. + + (Oct 3, '01) + x Fixed bug in XGetVisualInfo(): pixelformats enumerated incorrectly. + Passing 0 as a pixelformat index to DescribePixelFormat gives + unpredictible results (e.g., this fails on the Voodoo opengl32.dll + and always reports 0 as the last available pixelformat index). + Thanks to Michael Wimmer for pointing this out & providing the fix. + + (Oct 3, '01) + x Fixed bug in glXGetConfig(): pixelformats enumerated incorrectly. The + test was OpenGL support OR draw to window, but should be AND. Thanks + to Michael Wimmer for pointing this out & providing the fix. + + (Sep 28, '01) + x Fixed glutChangeToSubMenu()/glutChangeToMenuEntry() bug where if you + went back and forth between a submenu and a plain entry, the submenu + wouldn't be updated properly. + + (Sep 28, '01) + x glutSetIconTitle() is now a nop. + + (Sep 28, '01) + x glutFullScreen() now sets the window as TOPMOST, therefore, the + window will always be on top (this essentially disables alt-tabbing). + + (Sep 28, '01) + x The key repeat ignore flag is now honored correctly. + + (Sep 28, '01) + x Key presses are now reported more accurately and fully, in + particular, modified up events (i.e., SHIFT-2) are now reported + correctly. + + (Sep 28, '01) + x Subwindows nested arbitrarily deep get their keyboard callbacks + correctly now. + + (Sep 28, '01) + x Major rewrite of the window procedure code to clean it up and make + way for other bug fixes. + + (Sep 23, '01) + x Fixed noof example program to use RAND_MAX instead of assumed + max of 2147483647.0. (Now it looks _much_ better!) + + (Sep 22, '01) + x Fixed sunlight example program. globe.raw data file was corrupt, + added a new one. + + (Sep 22, '01) + x Fixed zcomposite example program to print message if overlay + support is not found (instead of crashing). + + (Jan 22, '01) + x Fixed malloc(0) bug in Win32 version of XGetVisualInfo. Thanks + to Kekoa Proudfoot for bringing this to my attention. + + (Dec 12, '00) + x Added data files for the advanced & advanced97 programs. + + (Dec 12, '00) + x Added Developer Studio 6 project and workspace files for pretty + much everything (the stuff left out was usually unix specific). + + (Dec 7, '00) + x Fixed several compilation problems & corrupt files. Thanks to + Alexander Stohr for bringing these to my attention and providing + detailed fixes. + + (Dec 6, '00) + x Fixed compiler support for lcc. Thanks to Gordon for bringing + this to my attention and debugging fixes. + + (Nov 8, '00) + x Fixed submenu problem (sometimes the menu callback was not + called for valid items). Thanks to Michael Keeley. + + (Oct 16, '00) + x Corrected corrupt duck.iv file. Thanks to Jon Willeke for finding + this problem. + + (Sept 27, '00) + x Fixed bug in processWorkList that could cause a hang. Thanks to + Bill Volz & Daniel Azuma. + + (Sept 26, '00) + x Added mui DLL project file (thanks to DMWeldy@ugsolutions.com). + + (Sept 9, '00) + x Fixed Delete key bug (crash when no keyboard callback was + registered, but a special key callback was). Thanks to + Kent Bowling (kent_bowling@hotmail.com) for finding this bug. + + (May 18, '00) + x Fixed subwindow keyboard callbacks. + + (May 22, '97) + o Menus don't work under Windows 95 + x Fixed! Added a unique identifier to each menu item, and a + search function to grab a menu item given the unique identifier. + + (May 21, '97) + o A few minor bug fixes here and there. + x Thanks to Bruce Silberman and Chris Vale for their help with + this. We now have a DLL! + + (Apr 25, '97) + o DLL version of the library is coming (as soon as I figure out + how to do it -- if you know, let me know). + x Thanks to Bruce Silberman and Chris Vale for their help with + this. We now have a DLL! + + (Apr 24, '97) + x Added returns to KEY_DOWN etc messages so that the F10 key + doesn't toggle the system menu anymore. + + (Apr 7, '97) + o Palette is incorrect for modes other than TrueColor. + x Fixed this by forcing a default palette in modes that aren't + Truecolor in order to 'simulate' it. The applications + program shouldn't have to do this IMHO, but I guess we + can't argue with Microsoft (well, we can, but what good + will it do?). + + (Apr 2, '97) + x Added glut.ide file for Borland users. + + (Apr 2, '97) + x Fixed a bug in the WM_QUERYNEWPALETTE message. Wasn't + checking for a null colormap, then de-ref'd it. Oops. + + (Mar 13, '97) + o glutTimerFunc: + Currently, GLUT for Win32 programs busy waits when there is + an outstanding timer event (i.e., there is no select() + call). I haven't found this to be a problem, but I plan to + fix it just because I can't bear the thought of a busy wait. + x Added a timer event and a wait in the main loop. This fixes + the CPU spike. + + (Mar 11, '97) + x Fixed subwindow visibility. The visibility callback of + subwindows wasn't being called, now it is. + + (Mar 11, '97) + o glutGetHDC, glutGetHWND: + In order to support additional dialog boxes, wgl fonts, and + a host of other Win32 dependent structures, two functions + have been added that operate on the current window in GLUT. + The first (glutGetHDC) returns a handle to the current + windows device context. The second (glutGetHWND) returns + handle to the current window. + x Took these out to preserve GLUT portability. + + (Mar 11, '97) + x Fixed the glutWarpPointer() coordinates. Were relative to + the screen, now relative to window (client area) origin + (which is what they're supposed to be). + + (Mar 11, '97) + o glutCreateMenu, glutIdleFunc: + Menu's are modal in Win32. That is, they don't allow any + messages to be processed while they are up. Therefore, if + an idle function exists, it will not be called while + processing a menu. + x Fixed! I've put in a timer function that fires every + millisecond while a menu is up. The timer function handles + idle and timer events only (which should be the only + functions that are firing when a menu is up anyway). + + (Mar 7 '97) + x Fixed minor bugs tracked down by the example programs. + + (Mar 6, '97) + x Merged 3.3 GLUT for X11 into 3.2 GLUT for Win32. New code + structure allows for EASY merging! + + o In Win32, the parent gets the right to set the cursor of + any of its children. Therefore, a child windows cursor + will 'blink' between its cursor and its parent. + x Fixed this by checking whether the cursor is in a child + window or not. + + (Feb 28 '97) + o On initial bringup apps are getting 2 display callbacks. + x Fixed by the Fev 28 re-write. + + o Some multiple window (not subwindow) functionality is messed up. + See the sphere.exe program. + x Fixed by the Feb 28 re-write. + + o GLUT for Win32 supports color index mode ONLY in a paletted + display mode (i.e., 256 or 16 color mode). + x Fixed this in the re-write. If you can get a color index + visual (pixel format) you can use color index mode. + + (Feb 28 '97) + o Quite a few bugs (and incompatibilities) were being caused + by the structure that I used in the previous port of GLUT. + Therefore I decided that it would be best to "get back to + the roots". I re-implemented most of glut trying to stick + with the structure layed out by Mark. The result is a much + more stable version that passes ALL (!) (except overlay) + the tests provided by Mark. In addition, this new + structure will allow future enhancements by Mark to be + integrated much more quickly into the Win32 version. Also, + I'm now ordering the bugs in reverse, so that the most + recently fixed appear at the top of the list. + + (9/8/96) + o Changed the glutGetModifiers code to produce an error if not + called in the core input callbacks. + + (9/11/96) + o If the alt key is pressed with more than one other modifier key + it acts as if it is stuck -- it stays selected until pressed + and released again. + x Fixed. + + (9/12/96) + o When a submenu is attached to a menu, sometimes a GPF occurs. + Fixed. Needed to set the submenu before referencing it's members. + + o Kenny: Also, one little problem, I attached the menu to the + right-button, but when the left-button is pressed I detach + it to give the right-button new meaning; if I pop-up the menu and I + don't want to select anything, like most users, I click off of the + menu to make it disappear. When I do this, I get a GLUT error and + the program terminates because I am altering the menu attachment + from within the button press while the menu is active. + x Fixed. Needed to finish the menu when the user presses the button, + not just when a button is released. + + o GLUT for Win32 emulates a middle mouse button by checking if + both mouse buttons are down. This causes a lot of problems with + the menu and other multiple mouse button things. + x Fixed. No more middle mouse button emulation. Perhaps it would + be a good idea to emulate the middle mouse button (if not present) + with a key? + + (9/15/96) + o Added code to accept a user defined icon. If no icon is provided, + a default icon is loaded. + + (9/19/96) + o Shane: Command line options seem to be screwed up. (9/13) + x Fixed. The geometry command line was broken, and so was the + gldebug command line. + + o Fixed a bug in the default glut reshape. It was looking for the + parent of the current window and GPF'ing if there wasn't a parent. + Put in a check for a parent, and if none is there, use the + child. + + o Idle function sucks up all processor cycles. (9/8/96) + x I don't know if this is avoidable. If you have a tight rendering + loop, it may be that the processor time is going to be sucked up + no matter what. You can add a sleep() to the end of your render + loop if you would like to yeild to other processes and you don't + care too much about the speed of your rendering loop. If you have + Hardware that supports OpenGL (like a 3Dpro card, or GLint card) + then this should be less of a problem, since it won't be rendering + in software. (9/11/96) + + o If a window is fully obscured by another window, the visibility + callback is NOT called. As far as I can tell, this is a limitation + of the Win32 api, but a workaround is being searched for. (9/8/96) + x Limitation of the Win32 API + + o Fixed the entry functions. They only work if the keyboard focus + changes. Therefore, in most Win32 systems, the mouse must be + pressed outside of the window to get a GLUT_LEFT message and + then pressed inside the window for a GLUT_ENTERED message. + + o Alt modifier key doesn't work with keyboard callback. (9/8/96) + x Probably okay, because the glut spec says that these keys can + be intercepted by the system (which the alt key is...) (9/11/96) + + (11/17/96) + o glutRemoveMenuItem() not working properly. + x Thanks to Gary (grc@maple.civeng.rutgers.edu) for the fix to + this one. + + o Timer functions are messed up. + x Thanks to Joseph Galbraith for the fix to this one. + + (12/9/96) + o One (minor) difference came up between the X version of glut + and the nt one which you should know about. It is not a new + problem, and it concerns co-ords returned to the pointer + callbacks. (glutMotionFunc, glutMouseFunc) + Under X, you get co-ords in the range 0 +/- 2^15, under NT + you get 0..2^16. This is only really a problem when moving + above or to the left of the window. + eg dragging one pixel ABOVE the window will give :- + under x11 : y = -1 + under nt : y = 2^16 -1 + x Put in fix provided by Shane Clauson. + + (12/17/96) + o Idle functions not working properly for multiple windows. + x Fixed this by posting an idle message to every window in the + window list when idle. + + (12/18/96) + o glutSetCursor() was misbehaving (lthomas@cco.caltech.edu). + x Win32 requires that the hCursor member of the window class + be set to NULL when the class is registered or whenever the + mouse is moved, the original cursor is replaced (go + figure!). Now sets the cursor whenever a WM_MOUSEMOVE message + is received, because the WM_SETCURSOR event resets the cursor + even when in the decoration area. + + o Geometry is not being handled quite right. The numbers don't + take into account the window decorations. That is, if I say + make a window 100x100, then the WHOLE window (not just the + client area) is 100x100. Therefore, the client (opengl) area + is smaller than 100x100. (9/8/96) + x Fixed. Added code to subtract the decoration size on glutGet() + and add the decoration size on glutReshapeWindow(). + + o Multiple glutPostRedisplay() calls are NOT being combined. + To get round the "coalesce" problem on glutPostRedisplay, + the easiest solution is to roll-your-own coalesce by + keeping a global "dirty" flag in the app (eg replace all + calls to glutPostRedisplay with image_dirty=TRUE;), and to + handle image_dirty with a single glutPostRedisplay in the + idle callback when required. (erk - but increases + performance for my particular app (a rendering engine on + the end of a pipleine with a stream of graphics updates) by + a couple of orders of magnitude ! ) (9/8/96) + x Added code to coalesce redisplays. Every idle cycle, a + check is made to see which windows need redisplay, if they + need it, a redisplay is posted. The glutPostRedisplay() + call is just a stub that sets a flag. + + +THANKS: + + Special thanks to the following people for extensive testing, + suggestions, fixes and help: + + Alexander Stohr + Shane Clauson + Kenny Hoff + Richard Readings + Paul McQuesten + Philip Winston + JaeWoo Ahn + Joseph Galbraith + Paula Higgins + Sam Fortin + Chris Vale + Bill Mitchell + + and of course, the original author of GLUT: + Mark Kilgard. + + and many others... + + +COPYRIGHT: + +The OpenGL Utility Toolkit distribution for Win32 (Windows NT & +Windows 95) contains source code modified from the original source +code for GLUT version 3.3 which was developed by Mark J. Kilgard. The +original source code for GLUT is Copyright 1997 by Mark J. Kilgard. +GLUT for Win32 is Copyright 1997 by Nate Robins and is not in the +public domain, but it is freely distributable without licensing fees. +It is provided without guarantee or warrantee expressed or implied. +It was ported with the permission of Mark J. Kilgard by Nate Robins. + +THIS SOURCE CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OR MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +OpenGL (R) is a registered trademark of Silicon Graphics, Inc. diff --git a/samples/glut/glut.def b/samples/glut/glut.def new file mode 100644 index 000000000..94da6ab85 --- /dev/null +++ b/samples/glut/glut.def @@ -0,0 +1,126 @@ +DESCRIPTION 'OpenGL Utility Toolkit for Win32' + +VERSION 3.7 + +EXPORTS + + glutAddMenuEntry + glutAddSubMenu + glutAttachMenu + glutBitmapCharacter + glutBitmapLength + glutBitmapWidth + glutButtonBoxFunc + glutChangeToMenuEntry + glutChangeToSubMenu + glutCopyColormap + glutCreateMenu + __glutCreateMenuWithExit + glutCreateSubWindow + glutCreateWindow + __glutCreateWindowWithExit + glutDestroyMenu + glutDestroyWindow + glutDetachMenu + glutDeviceGet + glutDialsFunc + glutDisplayFunc + glutEnterGameMode + glutEntryFunc + glutEstablishOverlay + glutExtensionSupported + glutForceJoystickFunc + glutFullScreen + glutGameModeGet + glutGameModeString + glutGet + glutGetColor + glutGetMenu + glutGetModifiers + glutGetWindow + glutHideOverlay + glutHideWindow + glutIconifyWindow + glutIdleFunc + glutIgnoreKeyRepeat + glutInit + __glutInitWithExit + glutInitDisplayMode + glutInitDisplayString + glutInitWindowPosition + glutInitWindowSize + glutJoystickFunc + glutKeyboardFunc + glutKeyboardUpFunc + glutLayerGet + glutLeaveGameMode + glutMainLoop + glutMenuStateFunc + glutMenuStatusFunc + glutMotionFunc + glutMouseFunc + glutOverlayDisplayFunc + glutPassiveMotionFunc + glutPopWindow + glutPositionWindow + glutPostOverlayRedisplay + glutPostRedisplay + glutPostWindowOverlayRedisplay + glutPostWindowRedisplay + glutPushWindow + glutRemoveMenuItem + glutRemoveOverlay + glutReportErrors + glutReshapeFunc + glutReshapeWindow + glutSetColor + glutSetCursor + glutSetIconTitle + glutSetKeyRepeat + glutSetMenu + glutSetWindow + glutSetWindowTitle + glutSetupVideoResizing + glutShowOverlay + glutShowWindow + glutSolidCone + glutSolidCube + glutSolidDodecahedron + glutSolidIcosahedron + glutSolidOctahedron + glutSolidSphere + glutSolidTeapot + glutSolidTetrahedron + glutSolidTorus + glutSpaceballButtonFunc + glutSpaceballMotionFunc + glutSpaceballRotateFunc + glutSpecialFunc + glutSpecialUpFunc + glutStopVideoResizing + glutStrokeCharacter + glutStrokeLength + glutStrokeWidth + glutSwapBuffers + glutTabletButtonFunc + glutTabletMotionFunc + glutTimerFunc + glutUseLayer + glutVideoPan + glutVideoResize + glutVideoResizeGet + glutVisibilityFunc + glutWarpPointer + glutWindowStatusFunc + glutWireCone + glutWireCube + glutWireDodecahedron + glutWireIcosahedron + glutWireOctahedron + glutWireSphere + glutWireTeapot + glutWireTetrahedron + glutWireTorus +; __glutSetFCB +; __glutGetFCB + diff --git a/samples/glut/glut32.lib b/samples/glut/glut32.lib new file mode 100644 index 000000000..c25583d44 Binary files /dev/null and b/samples/glut/glut32.lib differ