template project, first version

This commit is contained in:
rachelchu
2017-10-11 15:01:05 +02:00
commit 8e902224cf
794 changed files with 326190 additions and 0 deletions

28
AntTweakBar/.gitignore vendored Normal file
View File

@@ -0,0 +1,28 @@
*.[oa]
*~
*.ncb
*.sdf
*.suo
*.user
*.asp
*.pch
/src/debug32
/src/debug64
/src/release32
/src/release64
/src/ipch
/examples/debug32
/examples/debug64
/examples/tmp
/examples/bin32/*.exe
/examples/bin32/*.out
/examples/bin32/AntTweakBar.dll
/examples/bin64/*.exe
/examples/bin64/*.out
/examples/bin64/AntTweakBar64.dll
lib/debug
lib/*.lib
lib/*.dll
lib/*.exp
lib/*.so
lib/*.so.*

View File

@@ -0,0 +1,7 @@
[InternetShortcut]
URL=http://anttweakbar.sourceforge.net/doc
Modified=C043A0DCA0FFC801E7
HotKey=0
IDList=
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2

226
AntTweakBar/ChangeLog.txt Normal file
View File

@@ -0,0 +1,226 @@
--- AntTweakBar library change log ---
* Version 1.16 (2013/03/21)
- Moved AntTweakBar documentation to sourceforge, available at:
http://anttweakbar.sourceforge.net/doc
- AntTweakBar source code repository is now on sourceforge too at:
http://sourceforge.net/projects/anttweakbar
- Fixed several issues with the core profile on OSX 10.8 (Thanks to
Christoph G., George P. and Robert H. for their help).
- Fixed unwanted repeated key pressed (Thanks to Alec J. for the patch).
- Added Visual Studio 2012 projects to the repository.
- Memory representation of std::string has changed again with Visual Studio
2012. Handled it.
- Modified Linux and OSX Makefiles to build also static version of the library
in addition to dynamic library (Thanks to Luigi R.).
- Fonts can be scaled globally through the "fontscaling" parameter, may be
useful for high density display (Suggested by Eric RH.).
- Fixed compilation issue with different system locale (Reported by Arnaud M.)
* Version 1.15 (2012/07/22)
- Added support for OpenGL Core Profile (3.2 and higher); it is enabled by
setting the TwGraphAPI parameter of the TwInit function to TW_OPENGL_CORE
(Thanks to Oystein E. and Arnaud M. for their contribution).
- Added a simple example that uses OpenGL Core Profile and SDL; see
TwGLCoreSDL.c .
- Added helper function TwEventX11 to handle native X11 events (Thanks to
Greg P. for the code).
- Added builtin fixed-width font for tweak bars; it is enabled through
the fontstyle bar parameter; it is not resizable (Thanks to Jay D. for
the font).
- Store and restore states of OpenGL vertex attribute arrays (Thanks to
Jerry J. and Eduard B.).
- Fixed memory access violation caused by the popup bar (Thanks to Matthias R.
for reporting it).
- Added code to overcome issue caused by the memory representation change
of std::string that occurs between Visual Studio 2008 and 2010.
* Version 1.14 (2011/03/26)
- Added 64 bit version of the library.
- Added multiple windows support (Inspired by comments and code from Evan F.
and Ivo H.)
- Better MacOSX support (Thanks to Alexis DH., Fabrice N., Diederick H.,
Alec J.).
- Improved readability of overlapped transparent bars. Content of overlapped
regions is clipped and not drawn. This behavior can be disabled using
the bar parameter "overlap".
- Added support for Direct3D11 (Thanks to Jorge H., Lukasz M., Se1zen).
- Added an example based on DirectX 11.
- Added support for SDL 1.3 integration in addition to SDL 1.2.
ABI modification: TwEventSDL takes SDL version as an additional parameter.
- Added support for SFML 1.6 integration.
- Added support for GLFW 2.7 integration in addition to GLFW 2.6. This may
imply changing the calling convention of event callbacks. Can be done by
defining GLFW_CDECL before including AntTweakBar.h if needed.
- Added function TwKeyTest that checks if a key event would be processed by
AntTweakBar but without processing it. Needed to fix bad handling report of
WM_KEYUP and WM_KEYDOWN in TwEventWin (Thanks to Ryan DB. for reporting it).
- Added check sign for vars of type boolean.
- Added new bar parameter "buttonalign" to center or left-align buttons
(Suggested by Michael R.).
- Allowed values column width to be adjusted to fit its content. This is done
by setting the bar parameter valueswidth=fit (Requested by Koshmaar and
Michael R.). The user can also click in the left or right area near the
value width slider to fit column content.
- Added new helper function TwDefineEnumFromString to ease the defining of an
enum through a string of comma-separated enum values (Thanks to Bruno L.
for the suggestion and code).
- Fixed compilation issues with gcc4 (missing includes, warnings).
- Fixes for the fedora package maintained by Sean Middleditch.
- Fixed rotation widget display and interaction issues when the library is
compiled with gcc -O3 (Thanks to Ares L. for reporting this).
- Fixed SDL key event SDLK_RETURN handling after a bar is minimized (Thanks
to Sean M. for reporting this).
- Fixed issue with SDL_ShowCursor (Thanks to Hugues M. for reporting it).
- Fixed DirectX10 resource issue.
- Store and restore GL_TEXTURE_COORD_ARRAY state (Thanks to Jerry J. for
reporting this).
- Fixed mouse click repetition issue with passive event loop (Thanks to
Bruno L. for reporting it).
- Fixed issue with mouse button event when glut windows doesn't have focus
(Thanks to Scott J. for the fix).
- Reset enum content each time the var parameter "enum" is set using TwDefine
or TwSetParam (Following Carsten W. and Sulaiman remarks).
- Fixed memory corruption when more than one std_string are defined in a
custom struct (Thanks to Sulaiman for reporting it).
- Fixed mouse position issue with Direct3D9 fullscreen mode in TwSimpleDX9
(Thanks to Paolo S. for pointing this out).
- Fixed ignored double-click in TwEvenWin (Thanks to H. Seungho for this).
* Version 1.13 (2009/04/19)
- Now compiles on Mac OSX (Many thanks to Evan F. for rewriting the OS
specific code, and to Tyler S. and Konstantin L. for their feedback).
- Added functions TwGetBarCount, TwGetBarByIndex, TwGetBarByName,
TwRefreshBar.
- Fixed bug related to var of type TW_TYPE_STDSTRING on Windows: Microsoft
implementation of std::string does not have the same size in Debug and
Release mode (hidden member added for debugging), which caused a crash when
mixing the Release version of AntTweakBar with a program compiled in Debug
mode (Thanks to Minh D. for reporting it).
- Added function TwGetParam and TwSetParam to allow access to the parameters
defining the behavior of bars and variables.
- Changed the bar/var parameters without value (like "show"/"hide") to
parameters with value ("visible=true or false") to be compatible with the
new TwGetParam and TwSetParam functions (the old syntax is still kept
for backward compatibility).
- Arrow keys and Return key can now be used to navigate and tweak values.
- Bars can now be moved partly outside of the window. They can still be
constrained to be fully contained in the window by setting the parameter
"contained=true".
- Added another way to move a bar by pressing mouse middle button in the bar.
* Version 1.12 (2008/09/27)
- Added new var types TW_TYPE_QUAT* and TW_TYPE_DIR* allowing for the
interactive tweaking of rotations (through quaternions) and 3D vectors
(directions).
- Better management of transparent tweak bars. New bar parameters added:
alpha=n text=dark/light.
- Default color scheme changed (now transparent by default). To reactivate the
previous scheme, call TwDefine("GLOBAL colorscheme=0") before creating bars.
- Added paramters to manage the bar behavior: resizable, movable, iconifiable,
fontresizable, alwaystop, alwaysbottom, visible, iconified (following
Jeppe F. B. feedback).
- Added functions TwSetBottomBar and TwGetBottomBar.
- The library can now be recompiled without requiring to install GLUT, GLFW
and SDL.
- New var parameters arrow, arrowcolor, axisx, axusy, axisz and showval added
for quaternion and direction types.
- Msvc specific keyword removed from PrefTimer (thanks to Tim J. for pointing
this out).
- Fixed bug related to popup behavior when the help bar is visible.
- GL_TEXTURE_RECTANGLE_ARB/EXT state is now saved and restored by TwDraw
(thanks to Cyril C. for suggesting this).
- glBlendFunc and glBlendEquationEXT are now saved and restored by TwDraw
(thanks to Sebastion B. for reporting the problem).
- Fixed bug related cursor visibility state with SDL (Thanks to Jeppe F. B.
for reporting it).
* Version 1.11 (2007/12/10)
- Now DirectX10 is also supported in addition to OpenGL and DirectX9.
Initialization of AntTweakBar with DX10: TwInit(TW_DIRECT3D10, d3d10Device).
- A new example that uses DirectX10 has been added: see TwSimpleDX10 in the
examples directory.
- Recap for string variables added to the doc. See
http://anttweakbar.sourceforge.net/doc/tools:anttweakbar:varstring
- An example that illustrates the use of the different types of string
variables has been added. See TwString in the examples directory.
- Added some code for multi-thread safety (thanks to Daniel 'DrUiD' B. for
the tip).
- Cleanup of the Help bar. Now only variables having help are displayed in
the Help bar.
- Function TwHandleErrors documented.
- Separators don't require a name anymore.
- Var parameter 'order' becomes 'colororder', and its values become 'rgba' and
'argb' (order=ogl and order=dx still exist but are deprecated).
- A small icon added for variables of type bool.
- Function TwCopyCDStringToLibrary added.
- The keyword 'GLOBAL' has been added for TwDefine commands that don't apply
to a specific tweak bar (suggested by Koshmaar).
- TwEventWin32 becomes TwEventWin (a #define has been added to keep
compatibility with previous applications).
- TwWindowSize(0,0) now releases graphics resources allocated by AntTweakBar
(may be useful for Direct3D applications, before resizing for instance).
- A wrong assert removed from TwMgr.cpp (thanks to Chris W. for reporting it).
- Some slight cosmetic changes (again).
* Version 1.10 (2007/08/31)
- Variable values can now also be entered and edited via keyboard input
(implementation based on modifications made by Laury M., thank you Laury).
- Variables of type string are now handled: 3 types of string added
TW_TYPE_CSSTRING, TW_TYPE_CDSTRING and TW_STDSTRING.
- Text selection and copy/paste added.
- Position of bar icons is modifiable (cf. TwBar paramters iconPos, iconAlign
and iconMargin).
- Separators can be added in a bar (TwAddSeparator).
- OpenGL: states related to 3D textures and multitexturing are now saved and
restored by TwDraw (thanks to Dylan D. for pointing this out).
- Selected element of a listbox now highlighted.
- ReadOnly and ReadWrite behavior of buttons revisited.
- Documentation improved (examples for TwType, new functions documented,...).
- Some slight cosmetic changes.
* Version 1.05 (2007/03/01)
- Listbox and rotoslider buttons added.
- Icon resources (AntTweakBar.rc) no more required for static linkage (thanks
to Joe C. for pointing this out).
- Fixed a rotoslider precision problem when mouse button is released.
* Version 1.04 (2006/12/16)
- OpenGL: Vertex buffer object state and Vertex/fragment program and object
states are now reset and restored by TwDraw (thanks to Dylan D. and Siva K.
for pointing this out).
- Fixed problem that occurs when an initialized variable of type float/double
is displayed.
* Version 1.03 (2006/10/28)
- Medium font antialiased.
- Now also compiles on 64 bits x86 platform (thanks to Herling G. for this).
- Slight changes to avoid visual 8 secure crt warnings.
- Corrected behaviour if min/max values are not defined.
- Modif to avoid looping to max value when reaching zero with unsigned types.
- Min/max/step parameters for type TW_TYPE_CHAR now read ascii codes (not
characters).
- Added FPU precision control (because DirectX changes it).
- Fixed problem that occurs when the lib is initialized/uninitialized more
than once (thanks Lukasz P. for reporting it).
- Distribution follows Savannah's recommendations.
* Version 1.02 (2006/09/27)
- Library sources released.
* Version 1.01 (2006/09/14)
- First official release.

23
AntTweakBar/Clean.bat Normal file
View File

@@ -0,0 +1,23 @@
RMDIR /S /Q src\debug32
RMDIR /S /Q src\debug64
RMDIR /S /Q src\release32
RMDIR /S /Q src\release64
RMDIR /S /Q src\ipch
CD src
DEL *.ncb *.aps *.o *.bak *.user *.sdf
DEL /A:h *.suo
CD ..
RMDIR /S /Q lib\debug
RMDIR /S /Q examples\debug32
RMDIR /S /Q examples\debug64
RMDIR /S /Q examples\tmp
DEL lib\*.exp
CD examples
DEL *.ncb *.aps *.o *.bak *.user *.sdf
DEL /A:h *.suo
DEL /S BuildLog.htm
CD ..
PAUSE

22
AntTweakBar/License.txt Normal file
View File

@@ -0,0 +1,22 @@
--- AntTweakBar license ---
Copyright (C) 2005-2013 Philippe Decaudin
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the
use of this software.
Permission is granted to anyone to use this software for any purpose, including
commercial applications, and to alter it and redistribute it freely, subject to
the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim
that you wrote the original software. If you use this software in a product,
an acknowledgment in the product documentation would be appreciated but is not
required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

15
AntTweakBar/Readme.txt Normal file
View File

@@ -0,0 +1,15 @@
AntTweakBar development library
-------------------------------
AntTweakBar is a small and easy-to-use C/C++ library that allows programmers
to quickly add a light and intuitive GUI into OpenGL and DirectX based
graphic programs to interactively tweak parameters.
This package includes the development version of the AntTweakBar library
for Windows, GNU/Linux and OSX, and some program examples (sources + binaries).
For installation and documentation please refer to:
http://anttweakbar.sourceforge.net/doc

View File

@@ -0,0 +1,123 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwCopyDLL", "TwCopyDLL.vcproj", "{AB180E0E-0EFA-4AD4-8F08-4492D144D963}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwSimpleGLFW", "TwSimpleGLFW.vcproj", "{29C096AF-172E-4A36-A1FE-E15B259D6834}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwSimpleGLUT", "TwSimpleGLUT.vcproj", "{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwSimpleSDL", "TwSimpleSDL.vcproj", "{3B516919-D0DA-43CE-820E-8306368F605B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwSimpleDX9", "TwSimpleDX9.vcproj", "{6B414E54-701C-4ED3-9034-F5CD7BFC3451}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwAdvanced1", "TwAdvanced1.vcproj", "{008D1CEC-1586-4C89-B524-DF15D9605163}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwString", "TwString.vcproj", "{29C097AF-176E-4C36-A12E-E15B250D6835}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwSimpleDX10", "TwSimpleDX10.vcproj", "{6B412E54-70AC-40D3-903F-F5CD73FC3D51}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwSimpleDX11", "TwSimpleDX11.vcproj", "{6D417E54-50AC-40D3-913A-35CD73F93D51}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwDualGLUT", "TwDualGLUT.vcproj", "{DC6C7BF1-5AF3-295F-9385-C51E003A2856}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwGLCoreSDL", "TwGLCoreSDL.vcproj", "{3B5FCA22-D015-499E-8211-830ABC8F605B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwSimpleSFML", "TwSimpleSFML.vcproj", "{AA613E00-5339-4B87-9285-A53EFF3C9AB9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AB180E0E-0EFA-4AD4-8F08-4492D144D963}.Debug|Win32.ActiveCfg = Debug|Win32
{AB180E0E-0EFA-4AD4-8F08-4492D144D963}.Debug|Win32.Build.0 = Debug|Win32
{AB180E0E-0EFA-4AD4-8F08-4492D144D963}.Debug|x64.ActiveCfg = Debug|x64
{AB180E0E-0EFA-4AD4-8F08-4492D144D963}.Debug|x64.Build.0 = Debug|x64
{AB180E0E-0EFA-4AD4-8F08-4492D144D963}.Release|Win32.ActiveCfg = Release|Win32
{AB180E0E-0EFA-4AD4-8F08-4492D144D963}.Release|Win32.Build.0 = Release|Win32
{AB180E0E-0EFA-4AD4-8F08-4492D144D963}.Release|x64.ActiveCfg = Release|x64
{AB180E0E-0EFA-4AD4-8F08-4492D144D963}.Release|x64.Build.0 = Release|x64
{29C096AF-172E-4A36-A1FE-E15B259D6834}.Debug|Win32.ActiveCfg = Debug|Win32
{29C096AF-172E-4A36-A1FE-E15B259D6834}.Debug|Win32.Build.0 = Debug|Win32
{29C096AF-172E-4A36-A1FE-E15B259D6834}.Debug|x64.ActiveCfg = Debug|x64
{29C096AF-172E-4A36-A1FE-E15B259D6834}.Release|Win32.ActiveCfg = Release|Win32
{29C096AF-172E-4A36-A1FE-E15B259D6834}.Release|Win32.Build.0 = Release|Win32
{29C096AF-172E-4A36-A1FE-E15B259D6834}.Release|x64.ActiveCfg = Release|x64
{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}.Debug|Win32.ActiveCfg = Debug|Win32
{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}.Debug|Win32.Build.0 = Debug|Win32
{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}.Debug|x64.ActiveCfg = Debug|x64
{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}.Debug|x64.Build.0 = Debug|x64
{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}.Release|Win32.ActiveCfg = Release|Win32
{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}.Release|Win32.Build.0 = Release|Win32
{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}.Release|x64.ActiveCfg = Release|x64
{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}.Release|x64.Build.0 = Release|x64
{3B516919-D0DA-43CE-820E-8306368F605B}.Debug|Win32.ActiveCfg = Debug|Win32
{3B516919-D0DA-43CE-820E-8306368F605B}.Debug|Win32.Build.0 = Debug|Win32
{3B516919-D0DA-43CE-820E-8306368F605B}.Debug|x64.ActiveCfg = Debug|x64
{3B516919-D0DA-43CE-820E-8306368F605B}.Release|Win32.ActiveCfg = Release|Win32
{3B516919-D0DA-43CE-820E-8306368F605B}.Release|Win32.Build.0 = Release|Win32
{3B516919-D0DA-43CE-820E-8306368F605B}.Release|x64.ActiveCfg = Release|x64
{6B414E54-701C-4ED3-9034-F5CD7BFC3451}.Debug|Win32.ActiveCfg = Debug|Win32
{6B414E54-701C-4ED3-9034-F5CD7BFC3451}.Debug|Win32.Build.0 = Debug|Win32
{6B414E54-701C-4ED3-9034-F5CD7BFC3451}.Debug|x64.ActiveCfg = Debug|x64
{6B414E54-701C-4ED3-9034-F5CD7BFC3451}.Debug|x64.Build.0 = Debug|x64
{6B414E54-701C-4ED3-9034-F5CD7BFC3451}.Release|Win32.ActiveCfg = Release|Win32
{6B414E54-701C-4ED3-9034-F5CD7BFC3451}.Release|Win32.Build.0 = Release|Win32
{6B414E54-701C-4ED3-9034-F5CD7BFC3451}.Release|x64.ActiveCfg = Release|x64
{6B414E54-701C-4ED3-9034-F5CD7BFC3451}.Release|x64.Build.0 = Release|x64
{008D1CEC-1586-4C89-B524-DF15D9605163}.Debug|Win32.ActiveCfg = Debug|Win32
{008D1CEC-1586-4C89-B524-DF15D9605163}.Debug|Win32.Build.0 = Debug|Win32
{008D1CEC-1586-4C89-B524-DF15D9605163}.Debug|x64.ActiveCfg = Debug|x64
{008D1CEC-1586-4C89-B524-DF15D9605163}.Release|Win32.ActiveCfg = Release|Win32
{008D1CEC-1586-4C89-B524-DF15D9605163}.Release|Win32.Build.0 = Release|Win32
{008D1CEC-1586-4C89-B524-DF15D9605163}.Release|x64.ActiveCfg = Release|x64
{29C097AF-176E-4C36-A12E-E15B250D6835}.Debug|Win32.ActiveCfg = Debug|Win32
{29C097AF-176E-4C36-A12E-E15B250D6835}.Debug|Win32.Build.0 = Debug|Win32
{29C097AF-176E-4C36-A12E-E15B250D6835}.Debug|x64.ActiveCfg = Debug|x64
{29C097AF-176E-4C36-A12E-E15B250D6835}.Release|Win32.ActiveCfg = Release|Win32
{29C097AF-176E-4C36-A12E-E15B250D6835}.Release|Win32.Build.0 = Release|Win32
{29C097AF-176E-4C36-A12E-E15B250D6835}.Release|x64.ActiveCfg = Release|x64
{6B412E54-70AC-40D3-903F-F5CD73FC3D51}.Debug|Win32.ActiveCfg = Debug|Win32
{6B412E54-70AC-40D3-903F-F5CD73FC3D51}.Debug|Win32.Build.0 = Debug|Win32
{6B412E54-70AC-40D3-903F-F5CD73FC3D51}.Debug|x64.ActiveCfg = Debug|x64
{6B412E54-70AC-40D3-903F-F5CD73FC3D51}.Debug|x64.Build.0 = Debug|x64
{6B412E54-70AC-40D3-903F-F5CD73FC3D51}.Release|Win32.ActiveCfg = Release|Win32
{6B412E54-70AC-40D3-903F-F5CD73FC3D51}.Release|Win32.Build.0 = Release|Win32
{6B412E54-70AC-40D3-903F-F5CD73FC3D51}.Release|x64.ActiveCfg = Release|x64
{6B412E54-70AC-40D3-903F-F5CD73FC3D51}.Release|x64.Build.0 = Release|x64
{6D417E54-50AC-40D3-913A-35CD73F93D51}.Debug|Win32.ActiveCfg = Debug|Win32
{6D417E54-50AC-40D3-913A-35CD73F93D51}.Debug|Win32.Build.0 = Debug|Win32
{6D417E54-50AC-40D3-913A-35CD73F93D51}.Debug|x64.ActiveCfg = Debug|x64
{6D417E54-50AC-40D3-913A-35CD73F93D51}.Debug|x64.Build.0 = Debug|x64
{6D417E54-50AC-40D3-913A-35CD73F93D51}.Release|Win32.ActiveCfg = Release|Win32
{6D417E54-50AC-40D3-913A-35CD73F93D51}.Release|Win32.Build.0 = Release|Win32
{6D417E54-50AC-40D3-913A-35CD73F93D51}.Release|x64.ActiveCfg = Release|x64
{6D417E54-50AC-40D3-913A-35CD73F93D51}.Release|x64.Build.0 = Release|x64
{DC6C7BF1-5AF3-295F-9385-C51E003A2856}.Debug|Win32.ActiveCfg = Debug|Win32
{DC6C7BF1-5AF3-295F-9385-C51E003A2856}.Debug|Win32.Build.0 = Debug|Win32
{DC6C7BF1-5AF3-295F-9385-C51E003A2856}.Debug|x64.ActiveCfg = Debug|x64
{DC6C7BF1-5AF3-295F-9385-C51E003A2856}.Debug|x64.Build.0 = Debug|x64
{DC6C7BF1-5AF3-295F-9385-C51E003A2856}.Release|Win32.ActiveCfg = Release|Win32
{DC6C7BF1-5AF3-295F-9385-C51E003A2856}.Release|Win32.Build.0 = Release|Win32
{DC6C7BF1-5AF3-295F-9385-C51E003A2856}.Release|x64.ActiveCfg = Release|x64
{DC6C7BF1-5AF3-295F-9385-C51E003A2856}.Release|x64.Build.0 = Release|x64
{3B5FCA22-D015-499E-8211-830ABC8F605B}.Debug|Win32.ActiveCfg = Debug|Win32
{3B5FCA22-D015-499E-8211-830ABC8F605B}.Debug|Win32.Build.0 = Debug|Win32
{3B5FCA22-D015-499E-8211-830ABC8F605B}.Debug|x64.ActiveCfg = Debug|x64
{3B5FCA22-D015-499E-8211-830ABC8F605B}.Release|Win32.ActiveCfg = Release|Win32
{3B5FCA22-D015-499E-8211-830ABC8F605B}.Release|Win32.Build.0 = Release|Win32
{3B5FCA22-D015-499E-8211-830ABC8F605B}.Release|x64.ActiveCfg = Release|x64
{AA613E00-5339-4B87-9285-A53EFF3C9AB9}.Debug|Win32.ActiveCfg = Debug|Win32
{AA613E00-5339-4B87-9285-A53EFF3C9AB9}.Debug|Win32.Build.0 = Debug|Win32
{AA613E00-5339-4B87-9285-A53EFF3C9AB9}.Debug|x64.ActiveCfg = Debug|x64
{AA613E00-5339-4B87-9285-A53EFF3C9AB9}.Release|Win32.ActiveCfg = Release|Win32
{AA613E00-5339-4B87-9285-A53EFF3C9AB9}.Release|Win32.Build.0 = Release|Win32
{AA613E00-5339-4B87-9285-A53EFF3C9AB9}.Release|x64.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,115 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwCopyDLL", "TwCopyDLL.vcxproj", "{AB180E0E-0EFA-4AD4-8F08-4492D144D963}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwSimpleGLFW", "TwSimpleGLFW.vcxproj", "{29C096AF-172E-4A36-A1FE-E15B259D6834}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwSimpleGLUT", "TwSimpleGLUT.vcxproj", "{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwSimpleSDL", "TwSimpleSDL.vcxproj", "{3B516919-D0DA-43CE-820E-8306368F605B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwSimpleDX9", "TwSimpleDX9.vcxproj", "{6B414E54-701C-4ED3-9034-F5CD7BFC3451}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwAdvanced1", "TwAdvanced1.vcxproj", "{008D1CEC-1586-4C89-B524-DF15D9605163}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwString", "TwString.vcxproj", "{29C097AF-176E-4C36-A12E-E15B250D6835}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwSimpleDX10", "TwSimpleDX10.vcxproj", "{6B412E54-70AC-40D3-903F-F5CD73FC3D51}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwSimpleDX11", "TwSimpleDX11.vcxproj", "{6D417E54-50AC-40D3-913A-35CD73F93D51}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwDualGLUT", "TwDualGLUT.vcxproj", "{DC6C7BF1-5AF3-295F-9385-C51E003A2856}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TwGLCoreSDL", "TwGLCoreSDL.vcxproj", "{3B5FCA22-D015-499E-8211-830ABC8F605B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AB180E0E-0EFA-4AD4-8F08-4492D144D963}.Debug|Win32.ActiveCfg = Debug|Win32
{AB180E0E-0EFA-4AD4-8F08-4492D144D963}.Debug|Win32.Build.0 = Debug|Win32
{AB180E0E-0EFA-4AD4-8F08-4492D144D963}.Debug|x64.ActiveCfg = Debug|x64
{AB180E0E-0EFA-4AD4-8F08-4492D144D963}.Debug|x64.Build.0 = Debug|x64
{AB180E0E-0EFA-4AD4-8F08-4492D144D963}.Release|Win32.ActiveCfg = Release|Win32
{AB180E0E-0EFA-4AD4-8F08-4492D144D963}.Release|Win32.Build.0 = Release|Win32
{AB180E0E-0EFA-4AD4-8F08-4492D144D963}.Release|x64.ActiveCfg = Release|x64
{AB180E0E-0EFA-4AD4-8F08-4492D144D963}.Release|x64.Build.0 = Release|x64
{29C096AF-172E-4A36-A1FE-E15B259D6834}.Debug|Win32.ActiveCfg = Debug|Win32
{29C096AF-172E-4A36-A1FE-E15B259D6834}.Debug|Win32.Build.0 = Debug|Win32
{29C096AF-172E-4A36-A1FE-E15B259D6834}.Debug|x64.ActiveCfg = Debug|x64
{29C096AF-172E-4A36-A1FE-E15B259D6834}.Release|Win32.ActiveCfg = Release|Win32
{29C096AF-172E-4A36-A1FE-E15B259D6834}.Release|Win32.Build.0 = Release|Win32
{29C096AF-172E-4A36-A1FE-E15B259D6834}.Release|x64.ActiveCfg = Release|x64
{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}.Debug|Win32.ActiveCfg = Debug|Win32
{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}.Debug|Win32.Build.0 = Debug|Win32
{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}.Debug|x64.ActiveCfg = Debug|x64
{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}.Debug|x64.Build.0 = Debug|x64
{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}.Release|Win32.ActiveCfg = Release|Win32
{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}.Release|Win32.Build.0 = Release|Win32
{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}.Release|x64.ActiveCfg = Release|x64
{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}.Release|x64.Build.0 = Release|x64
{3B516919-D0DA-43CE-820E-8306368F605B}.Debug|Win32.ActiveCfg = Debug|Win32
{3B516919-D0DA-43CE-820E-8306368F605B}.Debug|Win32.Build.0 = Debug|Win32
{3B516919-D0DA-43CE-820E-8306368F605B}.Debug|x64.ActiveCfg = Debug|x64
{3B516919-D0DA-43CE-820E-8306368F605B}.Release|Win32.ActiveCfg = Release|Win32
{3B516919-D0DA-43CE-820E-8306368F605B}.Release|Win32.Build.0 = Release|Win32
{3B516919-D0DA-43CE-820E-8306368F605B}.Release|x64.ActiveCfg = Release|x64
{6B414E54-701C-4ED3-9034-F5CD7BFC3451}.Debug|Win32.ActiveCfg = Debug|Win32
{6B414E54-701C-4ED3-9034-F5CD7BFC3451}.Debug|Win32.Build.0 = Debug|Win32
{6B414E54-701C-4ED3-9034-F5CD7BFC3451}.Debug|x64.ActiveCfg = Debug|x64
{6B414E54-701C-4ED3-9034-F5CD7BFC3451}.Debug|x64.Build.0 = Debug|x64
{6B414E54-701C-4ED3-9034-F5CD7BFC3451}.Release|Win32.ActiveCfg = Release|Win32
{6B414E54-701C-4ED3-9034-F5CD7BFC3451}.Release|Win32.Build.0 = Release|Win32
{6B414E54-701C-4ED3-9034-F5CD7BFC3451}.Release|x64.ActiveCfg = Release|x64
{6B414E54-701C-4ED3-9034-F5CD7BFC3451}.Release|x64.Build.0 = Release|x64
{008D1CEC-1586-4C89-B524-DF15D9605163}.Debug|Win32.ActiveCfg = Debug|Win32
{008D1CEC-1586-4C89-B524-DF15D9605163}.Debug|Win32.Build.0 = Debug|Win32
{008D1CEC-1586-4C89-B524-DF15D9605163}.Debug|x64.ActiveCfg = Debug|x64
{008D1CEC-1586-4C89-B524-DF15D9605163}.Release|Win32.ActiveCfg = Release|Win32
{008D1CEC-1586-4C89-B524-DF15D9605163}.Release|Win32.Build.0 = Release|Win32
{008D1CEC-1586-4C89-B524-DF15D9605163}.Release|x64.ActiveCfg = Release|x64
{29C097AF-176E-4C36-A12E-E15B250D6835}.Debug|Win32.ActiveCfg = Debug|Win32
{29C097AF-176E-4C36-A12E-E15B250D6835}.Debug|Win32.Build.0 = Debug|Win32
{29C097AF-176E-4C36-A12E-E15B250D6835}.Debug|x64.ActiveCfg = Debug|x64
{29C097AF-176E-4C36-A12E-E15B250D6835}.Release|Win32.ActiveCfg = Release|Win32
{29C097AF-176E-4C36-A12E-E15B250D6835}.Release|Win32.Build.0 = Release|Win32
{29C097AF-176E-4C36-A12E-E15B250D6835}.Release|x64.ActiveCfg = Release|x64
{6B412E54-70AC-40D3-903F-F5CD73FC3D51}.Debug|Win32.ActiveCfg = Debug|Win32
{6B412E54-70AC-40D3-903F-F5CD73FC3D51}.Debug|Win32.Build.0 = Debug|Win32
{6B412E54-70AC-40D3-903F-F5CD73FC3D51}.Debug|x64.ActiveCfg = Debug|x64
{6B412E54-70AC-40D3-903F-F5CD73FC3D51}.Debug|x64.Build.0 = Debug|x64
{6B412E54-70AC-40D3-903F-F5CD73FC3D51}.Release|Win32.ActiveCfg = Release|Win32
{6B412E54-70AC-40D3-903F-F5CD73FC3D51}.Release|Win32.Build.0 = Release|Win32
{6B412E54-70AC-40D3-903F-F5CD73FC3D51}.Release|x64.ActiveCfg = Release|x64
{6B412E54-70AC-40D3-903F-F5CD73FC3D51}.Release|x64.Build.0 = Release|x64
{6D417E54-50AC-40D3-913A-35CD73F93D51}.Debug|Win32.ActiveCfg = Debug|Win32
{6D417E54-50AC-40D3-913A-35CD73F93D51}.Debug|Win32.Build.0 = Debug|Win32
{6D417E54-50AC-40D3-913A-35CD73F93D51}.Debug|x64.ActiveCfg = Debug|x64
{6D417E54-50AC-40D3-913A-35CD73F93D51}.Debug|x64.Build.0 = Debug|x64
{6D417E54-50AC-40D3-913A-35CD73F93D51}.Release|Win32.ActiveCfg = Release|Win32
{6D417E54-50AC-40D3-913A-35CD73F93D51}.Release|Win32.Build.0 = Release|Win32
{6D417E54-50AC-40D3-913A-35CD73F93D51}.Release|x64.ActiveCfg = Release|x64
{6D417E54-50AC-40D3-913A-35CD73F93D51}.Release|x64.Build.0 = Release|x64
{DC6C7BF1-5AF3-295F-9385-C51E003A2856}.Debug|Win32.ActiveCfg = Debug|Win32
{DC6C7BF1-5AF3-295F-9385-C51E003A2856}.Debug|Win32.Build.0 = Debug|Win32
{DC6C7BF1-5AF3-295F-9385-C51E003A2856}.Debug|x64.ActiveCfg = Debug|x64
{DC6C7BF1-5AF3-295F-9385-C51E003A2856}.Debug|x64.Build.0 = Debug|x64
{DC6C7BF1-5AF3-295F-9385-C51E003A2856}.Release|Win32.ActiveCfg = Release|Win32
{DC6C7BF1-5AF3-295F-9385-C51E003A2856}.Release|Win32.Build.0 = Release|Win32
{DC6C7BF1-5AF3-295F-9385-C51E003A2856}.Release|x64.ActiveCfg = Release|x64
{DC6C7BF1-5AF3-295F-9385-C51E003A2856}.Release|x64.Build.0 = Release|x64
{3B5FCA22-D015-499E-8211-830ABC8F605B}.Debug|Win32.ActiveCfg = Debug|Win32
{3B5FCA22-D015-499E-8211-830ABC8F605B}.Debug|Win32.Build.0 = Debug|Win32
{3B5FCA22-D015-499E-8211-830ABC8F605B}.Debug|x64.ActiveCfg = Debug|x64
{3B5FCA22-D015-499E-8211-830ABC8F605B}.Release|Win32.ActiveCfg = Release|Win32
{3B5FCA22-D015-499E-8211-830ABC8F605B}.Release|Win32.Build.0 = Release|Win32
{3B5FCA22-D015-499E-8211-830ABC8F605B}.Release|x64.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,104 @@
####### Compiler, tools and options
#---- Release
CXXCFG = -O3
LFLAGS = -L../lib
OUT_DIR = bin64
#---- Debug
#CXXCFG = -g -D_DEBUG
#LFLAGS = -Wl -L../lib/debug64
#OUT_DIR = debug64
CXX = g++
CXXFLAGS = $(CXXCFG) -Wall -fno-strict-aliasing
INCPATH = -I../include -I/usr/local/include -I/usr/X11R6/include -I/usr/include
LIBS = -L/usr/X11R6/lib -lAntTweakBar -lGL -lGLU -lX11 -lXext -lXmu -lXrandr -lpthread -lm
DEL_FILE = rm -f
DEL_DIR = rmdir
NO_STDERR = 2> /dev/null
EXP_SH = '\#!/bin/sh'
EXP_PATH = 'export LD_LIBRARY_PATH=`dirname $$0`/../../lib ; $$0.out'
####### Files
SRC_FILES = TwSimpleGLFW.c TwSimpleGLUT.c TwSimpleSDL.c TwAdvanced1.cpp TwString.cpp TwDualGLUT.c
####### Build rules
#first: depend all
first: all
all: Makefile $(SRC_FILES)
@echo "===== Build TwSimpleGLUT ===="
$(CXX) $(CXXFLAGS) $(INCPATH) TwSimpleGLUT.c $(LFLAGS) -lglut $(LIBS) -o $(OUT_DIR)/TwSimpleGLUT.out
@echo $(EXP_SH) > $(OUT_DIR)/TwSimpleGLUT
@echo $(EXP_PATH) >> $(OUT_DIR)/TwSimpleGLUT
@chmod +x $(OUT_DIR)/TwSimpleGLUT
@echo "To execute the example, run " $(OUT_DIR)/TwSimpleGLUT
@echo "===== Build TwSimpleSDL ===="
$(CXX) $(CXXFLAGS) $(INCPATH) TwSimpleSDL.c $(LFLAGS) -lSDL $(LIBS) -o $(OUT_DIR)/TwSimpleSDL.out
@echo $(EXP_SH) > $(OUT_DIR)/TwSimpleSDL
@echo $(EXP_PATH) >> $(OUT_DIR)/TwSimpleSDL
@chmod +x $(OUT_DIR)/TwSimpleSDL
@echo "To execute the example, run " $(OUT_DIR)/TwSimpleSDL
@echo "===== Build TwSimpleGLFW ===="
$(CXX) $(CXXFLAGS) $(INCPATH) TwSimpleGLFW.c $(LFLAGS) -lglfw $(LIBS) -o $(OUT_DIR)/TwSimpleGLFW.out
@echo $(EXP_SH) > $(OUT_DIR)/TwSimpleGLFW
@echo $(EXP_PATH) >> $(OUT_DIR)/TwSimpleGLFW
@chmod +x $(OUT_DIR)/TwSimpleGLFW
@echo "To execute the example, run " $(OUT_DIR)/TwSimpleGLFW
@echo "===== Build TwDualGLUT ===="
$(CXX) $(CXXFLAGS) $(INCPATH) TwDualGLUT.c $(LFLAGS) -lglut $(LIBS) -o $(OUT_DIR)/TwDualGLUT.out
@echo $(EXP_SH) > $(OUT_DIR)/TwDualGLUT
@echo $(EXP_PATH) >> $(OUT_DIR)/TwDualGLUT
@chmod +x $(OUT_DIR)/TwDualGLUT
@echo "To execute the example, run " $(OUT_DIR)/TwDualGLUT
@echo "===== Build TwAdvanced1 ===="
$(CXX) $(CXXFLAGS) $(INCPATH) TwAdvanced1.cpp $(LFLAGS) -lglfw $(LIBS) -o $(OUT_DIR)/TwAdvanced1.out
@echo $(EXP_SH) > $(OUT_DIR)/TwAdvanced1
@echo $(EXP_PATH) >> $(OUT_DIR)/TwAdvanced1
@chmod +x $(OUT_DIR)/TwAdvanced1
@echo "To execute the example, run " $(OUT_DIR)/TwAdvanced1
@echo "===== Build TwString ===="
$(CXX) $(CXXFLAGS) $(INCPATH) TwString.cpp $(LFLAGS) -lglut $(LIBS) -o $(OUT_DIR)/TwString.out
@echo $(EXP_SH) > $(OUT_DIR)/TwString
@echo $(EXP_PATH) >> $(OUT_DIR)/TwString
@chmod +x $(OUT_DIR)/TwString
@echo "To execute the example, run " $(OUT_DIR)/TwString
# append dependencies to this Makefile
#depend:
# @echo "===== Make dependencies ====="
# makedepend -Y
# makedepend -a -Y -- $(CXXFLAGS) $(INCPATH) -- $(SRC_FILES) $(NO_STDERR)
# clean temporary files
clean:
@echo "===== Clean ====="
-$(DEL_FILE) *.o
-$(DEL_FILE) *~ core *.core *.stackdump
-$(DEL_FILE) debug64/*
-$(DEL_DIR) debug64
####### DEPENDENCIES
TwSimpleGLFW.o: ../include/AntTweakBar.h
TwSimpleGLUT.o: ../include/AntTweakBar.h
TwDualGLUT.o: ../include/AntTweakBar.h
TwSimpleSDL.o: ../include/AntTweakBar.h
TwAdvanced1.o: ../include/AntTweakBar.h
TwString.o: ../include/AntTweakBar.h

View File

@@ -0,0 +1,100 @@
####### Compiler, tools and options
#---- Release
CXXCFG = -O3
LFLAGS = -L../lib
OUT_DIR = bin64
#---- Debug
#CXXCFG = -g -D_DEBUG
#LFLAGS = -Wl -L../lib/debug64
#OUT_DIR = debug64
#BASE = /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks
CXX = g++
CXXFLAGS = $(CXXCFG) -Wall -fno-strict-aliasing -D_MACOSX
INCPATH = -I../include -I/usr/local/include -I/usr/X11R6/include -I/usr/include
#-I$(BASE)/OpenGL.framework/Headers/ -I$(BASE)/AppKit.framework/Headers/
LIBS = ../lib/libAntTweakBar.dylib -lpthread -lm -framework AppKit -framework OpenGL
DEL_FILE = rm -f
DEL_DIR = rmdir
NO_STDERR = 2> /dev/null
EXP_PATH = 'export DYLD_LIBRARY_PATH=`dirname $$0`/../../lib ; $$0.out'
####### Files
SRC_FILES = TwSimpleGLUT.c TwSimpleSDL.c TwSimpleGLFW.c TwAdvanced1.cpp TwString.cpp TwDualGLUT.c TwGLCoreSDL.c
####### Build rules
#first: depend all
first: all
all: Makefile $(SRC_FILES)
@echo "===== Build TwSimpleGLUT ===="
$(CXX) $(CXXFLAGS) $(INCPATH) -I$(BASE)/GLUT.framework/Headers/ TwSimpleGLUT.c $(LFLAGS) $(LIBS) -framework GLUT -o $(OUT_DIR)/TwSimpleGLUT.out
@echo $(EXP_PATH) > $(OUT_DIR)/TwSimpleGLUT
@chmod +x $(OUT_DIR)/TwSimpleGLUT
@echo "To execute the example, run " $(OUT_DIR)/TwSimpleGLUT
@echo "===== Build TwDualGLUT ===="
$(CXX) $(CXXFLAGS) $(INCPATH) -I$(BASE)/GLUT.framework/Headers/ TwDualGLUT.c $(LFLAGS) $(LIBS) -framework GLUT -o $(OUT_DIR)/TwDualGLUT.out
@echo $(EXP_PATH) > $(OUT_DIR)/TwDualGLUT
@chmod +x $(OUT_DIR)/TwDualGLUT
@echo "To execute the example, run " $(OUT_DIR)/TwDualGLUT
@echo "===== Build TwString ===="
$(CXX) $(CXXFLAGS) $(INCPATH) -I$(BASE)/GLUT.framework/Headers/ TwString.cpp $(LFLAGS) $(LIBS) -framework GLUT -o $(OUT_DIR)/TwString.out
@echo $(EXP_PATH) > $(OUT_DIR)/TwString
@chmod +x $(OUT_DIR)/TwString
@echo "To execute the example, run " $(OUT_DIR)/TwString
# @echo "===== Build TwSimpleSDL ===="
# $(CXX) $(CXXFLAGS) $(INCPATH) -I$(BASE)/SDL.framework/Headers/ TwSimpleSDL.c $(LFLAGS) -framework SDL $(LIBS) -o $(OUT_DIR)/TwSimpleSDL.out
# @echo $(EXP_PATH) > $(OUT_DIR)/TwSimpleSDL
# @chmod +x $(OUT_DIR)/TwSimpleSDL
# @echo "===== Build TwSimpleGLFW ===="
# $(CXX) $(CXXFLAGS) $(INCPATH) TwSimpleGLFW.c $(LFLAGS) -lglfw -framework AGL -framework Carbon $(LIBS) -o $(OUT_DIR)/TwSimpleGLFW.out
# @echo $(EXP_PATH) > $(OUT_DIR)/TwSimpleGLFW
# @chmod +x $(OUT_DIR)/TwSimpleGLFW
# @echo "===== Build TwAdvanced1 ===="
# $(CXX) $(CXXFLAGS) $(INCPATH) TwAdvanced1.cpp $(LFLAGS) -lglfw -framework AGL -framework Carbon $(LIBS) -o $(OUT_DIR)/TwAdvanced1.out
# @echo $(EXP_PATH) > $(OUT_DIR)/TwAdvanced1
# @chmod +x $(OUT_DIR)/TwSimpleAdvanced1
# append dependencies to this Makefile
#depend:
# @echo "===== Make dependencies ====="
# makedepend -Y
# makedepend -a -Y -- $(CXXFLAGS) $(INCPATH) -- $(SRC_FILES) $(NO_STDERR)
# clean temporary files
clean:
@echo "===== Clean ====="
-$(DEL_FILE) *.o
-$(DEL_FILE) *~ core *.core *.stackdump
-$(DEL_FILE) debug64/*
-$(DEL_DIR) debug64
####### DEPENDENCIES
TwSimpleGLFW.o: ../include/AntTweakBar.h
TwSimpleGLUT.o: ../include/AntTweakBar.h
TwDualGLUT.o: ../include/AntTweakBar.h
TwSimpleSDL.o: ../include/AntTweakBar.h
TwAdvanced1.o: ../include/AntTweakBar.h
TwString.o: ../include/AntTweakBar.h
TwGLCoreSDL.o: ../include/AntTweakBar.h

View File

@@ -0,0 +1,26 @@
Compiled versions of the examples for 32-bit and 64-bit systems can be found in
the examples/bin32 and examples/bin64 directories.
Under GNU/Linux and OSX, you may need to rebuild the library and the examples.
To do so, under GNU/Linux, open a terminal, go in the src directory and type
make, then go in the examples directory and type make. Under OSX do the same
but type make -f Makefile.osx instead of make.
To recompile the examples you also need the following external libraries
(for convenience Windows versions are included in the examples directory).
- GLFW : http://www.glfw.org
- GLUT : http://opengl.org/resources/libraries/glut
the windows version can be found at
http://www.xmission.com/~nate/glut.html
- SDL : http://www.libsdl.org
- SFML : http://www.sfml-dev.org
- DirectX SDK if you want to recompile the Windows library & DX examples
http://msdn.microsoft.com/directx
The path to the DirectX shader compiler fxc.exe (included in the DirectX SDK)
must be listed in the VC++ directories.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,737 @@
// ---------------------------------------------------------------------------
//
// @file TwAdvanced1.cpp
// @brief An example showing many features of AntTweakBar,
// including variable accessed by callbacks and
// the definition of a custom structure type.
// It also uses OpenGL and GLFW windowing system
// but could be easily adapted to other frameworks.
//
// AntTweakBar: http://anttweakbar.sourceforge.net/doc
// OpenGL: http://www.opengl.org
// GLFW: http://www.glfw.org
//
//
// This example draws a simple scene that can be re-tesselated
// interactively, and illuminated dynamically by an adjustable
// number of moving lights.
//
//
// @author Philippe Decaudin
// @date 2006/05/20
//
// ---------------------------------------------------------------------------
#include <AntTweakBar.h>
#define GLFW_DLL // use GLFW as a dynamically linked library
#include "glfw.h"
#include <cmath>
#include <iostream>
#include <cstdlib>
#include <cstdio>
#if !defined(_WIN32) && !defined(_WIN64)
# define _snprintf snprintf
#endif
const float FLOAT_2PI = 6.283185307f; // 2*PI
// Light structure: embeds light parameters
struct Light
{
bool Active; // light On or Off
float Pos[4]; // light position (in homogeneous coordinates, ie. Pos[4]=1)
float Color[4]; // light color (no alpha, ie. Color[4]=1)
float Radius; // radius of the light influence area
float Dist0, Angle0, Height0, Speed0; // light initial cylindrical coordinates and speed
char Name[4]; // light short name (will be named "1", "2", "3",...)
enum AnimMode { ANIM_FIXED, ANIM_BOUNCE, ANIM_ROTATE, ANIM_COMBINED };
AnimMode Animation; // light animation mode
};
// Class that describes the scene and its methods
class Scene
{
public:
bool Wireframe; // draw scene in wireframe or filled
int Subdiv; // number of subdivisions used to tessellate the scene
int NumLights; // number of dynamic lights
float BgColor0[3], BgColor1[3]; // top and bottom background colors
float Ambient; // scene ambient factor
float Reflection; // ground plane reflection factor (0=no reflection, 1=full reflection)
double RotYAngle; // rotation angle of the scene around its Y axis (in degree)
enum RotMode { ROT_OFF, ROT_CW, ROT_CCW };
RotMode Rotation; // scene rotation mode (off, clockwise, counter-clockwise)
Scene(); // constructor
~Scene(); // destructor
void Init(bool changeLightPos); // (re)initialize the scene
void Draw() const; // draw scene
void Update(double time); // move lights
private:
void CreateBar(); // create a tweak bar for lights
// Some drawing subroutines
void DrawSubdivPlaneY(float xMin, float xMax, float y, float zMin, float zMax, int xSubdiv, int zSubdiv) const;
void DrawSubdivCylinderY(float xCenter, float yBottom, float zCenter, float height, float radiusBottom, float radiusTop, int sideSubdiv, int ySubdiv) const;
void DrawSubdivHaloZ(float x, float y, float z, float radius, int subdiv) const;
void DrawHalos(bool reflected) const;
GLuint objList, groundList, haloList; // OpenGL display list IDs
int maxLights; // maximum number of dynamic lights allowed by the graphic card
Light * lights; // array of lights
TwBar * lightsBar; // pointer to the tweak bar for lights created by CreateBar()
};
// Constructor
Scene::Scene()
{
// Set scene members.
// The scene will be created by Scene::Init( )
Wireframe = false;
Subdiv = 20;
NumLights = 0;
BgColor0[0] = 0.9f;
BgColor0[1] = 0.0f;
BgColor0[2] = 0.0f;
BgColor1[0] = 0.3f;
BgColor1[1] = 0.0f;
BgColor1[2] = 0.0f;
Ambient = 0.2f;
Reflection = 0.5f;
RotYAngle = 0;
Rotation = ROT_CCW;
objList = 0;
groundList = 0;
haloList = 0;
maxLights = 0;
lights = NULL;
lightsBar = NULL;
}
// Destructor
Scene::~Scene()
{
// delete all lights
if( lights )
delete[] lights;
}
// Create the scene, and (re)initialize lights if changeLights is true
void Scene::Init(bool changeLights)
{
// Get the max number of lights allowed by the graphic card
glGetIntegerv(GL_MAX_LIGHTS, &maxLights);
if( maxLights>16 )
maxLights = 16;
// Create the lights array
if( lights==NULL && maxLights>0 )
{
lights = new Light[maxLights];
NumLights = 3; // default number of lights
if( NumLights>maxLights )
NumLights = maxLights;
changeLights = true; // force lights initialization
// Create a tweak bar for lights
CreateBar();
}
// (Re)initialize lights if needed (uses random values)
if( changeLights )
for(int i=0; i<maxLights; ++i)
{
lights[i].Dist0 = 0.5f*(float)rand()/RAND_MAX + 0.55f;
lights[i].Angle0 = FLOAT_2PI*((float)rand()/RAND_MAX);
lights[i].Height0 = FLOAT_2PI*(float)rand()/RAND_MAX;
lights[i].Speed0 = 4.0f*(float)rand()/RAND_MAX - 2.0f;
lights[i].Animation = (Light::AnimMode)(Light::ANIM_BOUNCE + (rand()%3));
lights[i].Radius = (float)rand()/RAND_MAX+0.05f;
lights[i].Color[0] = (float)rand()/RAND_MAX;
lights[i].Color[1] = (float)rand()/RAND_MAX;
lights[i].Color[2] = (lights[i].Color[0]>lights[i].Color[1]) ? 1.0f-lights[i].Color[1] : 1.0f-lights[i].Color[0];
lights[i].Color[3] = 1;
lights[i].Active = true;
}
// Initialize some OpenGL states
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LIGHTING);
glEnable(GL_CULL_FACE);
glEnable(GL_NORMALIZE);
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
// Create objects display list using the current Subdiv parameter to control the tesselation
if( objList>0 )
glDeleteLists(objList, 1); // delete previously created display list
objList = glGenLists(1);
glNewList(objList, GL_COMPILE);
DrawSubdivCylinderY(-0.9f, 0, -0.9f, 1.4f, 0.15f, 0.12f, Subdiv/2+8, Subdiv);
DrawSubdivCylinderY(+0.9f, 0, -0.9f, 1.4f, 0.15f, 0.12f, Subdiv/2+8, Subdiv);
DrawSubdivCylinderY(+0.9f, 0, +0.9f, 1.4f, 0.15f, 0.12f, Subdiv/2+8, Subdiv);
DrawSubdivCylinderY(-0.9f, 0, +0.9f, 1.4f, 0.15f, 0.12f, Subdiv/2+8, Subdiv);
DrawSubdivCylinderY(0, 0, 0, 0.4f, 0.5f, 0.3f, Subdiv+16, Subdiv/8+1);
DrawSubdivCylinderY(0, 0.4f, 0, 0.05f, 0.3f, 0.0f, Subdiv+16, Subdiv/16+1);
glEndList();
// Create ground display list
if( groundList>0 )
glDeleteLists(groundList, 1); // delete previously created display list
groundList = glGenLists(1);
glNewList(groundList, GL_COMPILE);
DrawSubdivPlaneY(-1.2f, 1.2f, 0, -1.2f, 1.2f, (3*Subdiv)/2, (3*Subdiv)/2);
glEndList();
// Create display list to draw light halos
if( haloList>0 )
glDeleteLists(haloList, 1); // delete previously created display list
haloList = glGenLists(1);
glNewList(haloList, GL_COMPILE);
DrawSubdivHaloZ(0, 0, 0, 1, 32);
glEndList();
}
// Callback function associated to the 'Change lights' button of the lights tweak bar.
void TW_CALL ReinitCB(void *clientData)
{
Scene *scene = static_cast<Scene *>(clientData); // scene pointer is stored in clientData
scene->Init(true); // re-initialize the scene
}
// Create a tweak bar for lights.
// New enum type and struct type are defined and used by this bar.
void Scene::CreateBar()
{
// Create a new tweak bar and change its label, position and transparency
lightsBar = TwNewBar("Lights");
TwDefine(" Lights label='Lights TweakBar' position='580 16' alpha=0 help='Use this bar to edit the lights in the scene.' ");
// Add a variable of type int to control the number of lights
TwAddVarRW(lightsBar, "NumLights", TW_TYPE_INT32, &NumLights,
" label='Number of lights' keyIncr=l keyDecr=L help='Changes the number of lights in the scene.' ");
// Set the NumLights min value (=0) and max value (depends on the user graphic card)
int zero = 0;
TwSetParam(lightsBar, "NumLights", "min", TW_PARAM_INT32, 1, &zero);
TwSetParam(lightsBar, "NumLights", "max", TW_PARAM_INT32, 1, &maxLights);
// Note, TwDefine could also have been used for that pupose like this:
// char def[256];
// _snprintf(def, 255, "Lights/NumLights min=0 max=%d", maxLights);
// TwDefine(def); // min and max are defined using a definition string
// Add a button to re-initialize the lights; this button calls the ReinitCB callback function
TwAddButton(lightsBar, "Reinit", ReinitCB, this,
" label='Change lights' key=c help='Random changes of lights parameters.' ");
// Define a new enum type for the tweak bar
TwEnumVal modeEV[] = // array used to describe the Scene::AnimMode enum values
{
{ Light::ANIM_FIXED, "Fixed" },
{ Light::ANIM_BOUNCE, "Bounce" },
{ Light::ANIM_ROTATE, "Rotate" },
{ Light::ANIM_COMBINED, "Combined" }
};
TwType modeType = TwDefineEnum("Mode", modeEV, 4); // create a new TwType associated to the enum defined by the modeEV array
// Define a new struct type: light variables are embedded in this structure
TwStructMember lightMembers[] = // array used to describe tweakable variables of the Light structure
{
{ "Active", TW_TYPE_BOOLCPP, offsetof(Light, Active), " help='Enable/disable the light.' " }, // Light::Active is a C++ boolean value
{ "Color", TW_TYPE_COLOR4F, offsetof(Light, Color), " noalpha help='Light color.' " }, // Light::Color is represented by 4 floats, but alpha channel should be ignored
{ "Radius", TW_TYPE_FLOAT, offsetof(Light, Radius), " min=0 max=4 step=0.02 help='Light radius.' " },
{ "Animation", modeType, offsetof(Light, Animation), " help='Change the animation mode.' " }, // use the enum 'modeType' created before to tweak the Light::Animation variable
{ "Speed", TW_TYPE_FLOAT, offsetof(Light, Speed0), " readonly=true help='Light moving speed.' " } // Light::Speed is made read-only
};
TwType lightType = TwDefineStruct("Light", lightMembers, 5, sizeof(Light), NULL, NULL); // create a new TwType associated to the struct defined by the lightMembers array
// Use the newly created 'lightType' to add variables associated with lights
for(int i=0; i<maxLights; ++i) // Add 'maxLights' variables of type lightType;
{ // unused lights variables (over NumLights) will hidden by Scene::Update( )
_snprintf(lights[i].Name, sizeof(lights[i].Name), "%d", i+1); // Create a name for each light ("1", "2", "3",...)
TwAddVarRW(lightsBar, lights[i].Name, lightType, &lights[i], " group='Edit lights' "); // Add a lightType variable and group it into the 'Edit lights' group
// Set 'label' and 'help' parameters of the light
char paramValue[64];
_snprintf(paramValue, sizeof(paramValue), "Light #%d", i+1);
TwSetParam(lightsBar, lights[i].Name, "label", TW_PARAM_CSTRING, 1, paramValue); // Set label
_snprintf(paramValue, sizeof(paramValue), "Parameters of the light #%d", i+1);
TwSetParam(lightsBar, lights[i].Name, "help", TW_PARAM_CSTRING, 1, paramValue); // Set help
// Note, parameters could also have been set using the define string of TwAddVarRW like this:
// char def[256];
// _snprintf(def, sizeof(def), "group='Edit lights' label='Light #%d' help='Parameters of the light #%d' ", i+1, i+1);
// TwAddVarRW(lightsBar, lights[i].Name, lightType, &lights[i], def); // Add a lightType variable, group it into the 'Edit lights' group, and name it 'Light #n'
}
}
// Move lights
void Scene::Update(double time)
{
float horizSpeed, vertSpeed;
for(int i=0; i<NumLights; ++i)
{
// Change light position according to its current animation mode
if( lights[i].Animation==Light::ANIM_ROTATE || lights[i].Animation==Light::ANIM_COMBINED )
horizSpeed = lights[i].Speed0;
else
horizSpeed = 0;
if( lights[i].Animation==Light::ANIM_BOUNCE || lights[i].Animation==Light::ANIM_COMBINED )
vertSpeed = 1;
else
vertSpeed = 0;
lights[i].Pos[0] = lights[i].Dist0 * (float)cos(horizSpeed*time + lights[i].Angle0);
lights[i].Pos[1] = (float)fabs(cos(vertSpeed*time + lights[i].Height0));
lights[i].Pos[2] = lights[i].Dist0 * (float)sin(horizSpeed*time + lights[i].Angle0);
lights[i].Pos[3] = 1;
}
}
// Activate OpenGL lights; hide unused lights in the Lights tweak bar;
// and draw the scene. The scene is reflected by the ground plane, so it is
// drawn two times: first reflected, and second normal (unreflected).
void Scene::Draw() const
{
// Rotate the scene
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotated(RotYAngle, 0, 1, 0);
// Hide/active lights
int i, lightVisible;
for(i=0; i<maxLights; ++i)
{
if( i<NumLights )
{
// Lights under NumLights are shown in the Lights tweak bar
lightVisible = 1;
// Tell OpenGL to enable or disable the light
if( lights[i].Active )
glEnable(GL_LIGHT0+i);
else
glDisable(GL_LIGHT0+i);
// Update OpenGL light parameters (for the reflected scene)
float reflectPos[4] = { lights[i].Pos[0], -lights[i].Pos[1], lights[i].Pos[2], lights[i].Pos[3] };
glLightfv(GL_LIGHT0+i, GL_POSITION, reflectPos);
glLightfv(GL_LIGHT0+i, GL_DIFFUSE, lights[i].Color);
glLightf(GL_LIGHT0+i, GL_CONSTANT_ATTENUATION, 1);
glLightf(GL_LIGHT0+i, GL_LINEAR_ATTENUATION, 0);
glLightf(GL_LIGHT0+i, GL_QUADRATIC_ATTENUATION, 1.0f/(lights[i].Radius*lights[i].Radius));
}
else
{
// Lights over NumLights are hidden in the Lights tweak bar
lightVisible = 0;
// Disable the OpenGL light
glDisable(GL_LIGHT0+i);
}
// Show or hide the light variable in the Lights tweak bar
TwSetParam(lightsBar, lights[i].Name, "visible", TW_PARAM_INT32, 1, &lightVisible);
}
// Set global ambient and clear screen and depth buffer
float ambient[4] = { Ambient*(BgColor0[0]+BgColor1[0])/2, Ambient*(BgColor0[1]+BgColor1[1])/2,
Ambient*(BgColor0[2]+BgColor1[2])/2, 1 };
glClearColor(ambient[0], ambient[1], ambient[2], 1);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient);
// Draw the reflected scene
glPolygonMode(GL_FRONT_AND_BACK, (Wireframe ? GL_LINE : GL_FILL));
glCullFace(GL_FRONT);
glPushMatrix();
glScalef(1, -1, 1);
glColor3f(1, 1, 1);
glCallList(objList);
DrawHalos(true);
glPopMatrix();
glCullFace(GL_BACK);
// clear depth buffer again
glClear(GL_DEPTH_BUFFER_BIT);
// Draw the ground plane (using the Reflection parameter as transparency)
glColor4f(1, 1, 1, 1.0f-Reflection);
glCallList(groundList);
// Draw the gradient background (requires to switch to screen-space normalized coordinates)
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glDisable(GL_LIGHTING);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glBegin(GL_QUADS);
glColor3f(BgColor0[0], BgColor0[1], BgColor0[2]);
glVertex3f(-1, -1, 0.9f);
glVertex3f(1, -1, 0.9f);
glColor3f(BgColor1[0], BgColor1[1], BgColor1[2]);
glVertex3f(1, 1, 0.9f);
glVertex3f(-1, 1, 0.9f);
glEnd();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glEnable(GL_LIGHTING);
// Update light positions for unreflected scene
for(i=0; i<NumLights; ++i)
glLightfv(GL_LIGHT0+i, GL_POSITION, lights[i].Pos);
// Draw the unreflected scene
glPolygonMode(GL_FRONT_AND_BACK, (Wireframe ? GL_LINE : GL_FILL));
glColor3f(1, 1, 1);
glCallList(objList);
DrawHalos(false);
}
// Subroutine used to draw halos around light positions
void Scene::DrawHalos(bool reflected) const
{
//glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glDepthMask(GL_FALSE);
float prevAmbient[4];
glGetFloatv(GL_LIGHT_MODEL_AMBIENT, prevAmbient);
glPushMatrix();
glLoadIdentity();
if( reflected )
glScalef(1, -1 ,1);
float black[4] = {0, 0, 0, 1};
float cr = (float)cos(FLOAT_2PI*RotYAngle/360.0f);
float sr = (float)sin(FLOAT_2PI*RotYAngle/360.0f);
for(int i=0; i<NumLights; ++i)
{
if( lights[i].Active )
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lights[i].Color);
else
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, black);
glPushMatrix();
glTranslatef(cr*lights[i].Pos[0]+sr*lights[i].Pos[2], lights[i].Pos[1], -sr*lights[i].Pos[0]+cr*lights[i].Pos[2]);
//glScalef(0.5f*lights[i].Radius, 0.5f*lights[i].Radius, 1);
glScalef(0.05f, 0.05f, 1);
glCallList(haloList);
glPopMatrix();
}
glPopMatrix();
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, prevAmbient);
glDepthMask(GL_TRUE);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
// Subroutine used to build the ground plane display list (mesh subdivision is adjustable)
void Scene::DrawSubdivPlaneY(float xMin, float xMax, float y, float zMin, float zMax, int xSubdiv, int zSubdiv) const
{
const float FLOAT_EPS = 1.0e-5f;
float dx = (xMax-xMin)/xSubdiv;
float dz = (zMax-zMin)/zSubdiv;
glBegin(GL_QUADS);
glNormal3f(0, -1, 0);
for( float z=zMin; z<zMax-FLOAT_EPS; z+=dz )
for( float x=xMin; x<xMax-FLOAT_EPS; x+=dx )
{
glVertex3f(x, y, z);
glVertex3f(x, y, z+dz);
glVertex3f(x+dx, y, z+dz);
glVertex3f(x+dx, y, z);
}
glEnd();
}
// Subroutine used to build objects display list (mesh subdivision is adjustable)
void Scene::DrawSubdivCylinderY(float xCenter, float yBottom, float zCenter, float height, float radiusBottom, float radiusTop, int sideSubdiv, int ySubdiv) const
{
float h0, h1, y0, y1, r0, r1, a0, a1, cosa0, sina0, cosa1, sina1;
glBegin(GL_QUADS);
glNormal3f(0, 1, 0);
for( int j=0; j<ySubdiv; ++j )
for( int i=0; i<sideSubdiv; ++i )
{
h0 = (float)j/ySubdiv;
h1 = (float)(j+1)/ySubdiv;
y0 = yBottom + h0*height;
y1 = yBottom + h1*height;
r0 = radiusBottom + h0*(radiusTop-radiusBottom);
r1 = radiusBottom + h1*(radiusTop-radiusBottom);
a0 = FLOAT_2PI*(float)i/sideSubdiv;
a1 = FLOAT_2PI*(float)(i+1)/sideSubdiv;
cosa0 = (float)cos(a0);
sina0 = (float)sin(a0);
cosa1 = (float)cos(a1);
sina1 = (float)sin(a1);
glNormal3f(cosa0, 0, sina0);
glVertex3f(xCenter+r0*cosa0, y0, zCenter+r0*sina0);
glNormal3f(cosa0, 0, sina0);
glVertex3f(xCenter+r1*cosa0, y1, zCenter+r1*sina0);
glNormal3f(cosa1, 0, sina1);
glVertex3f(xCenter+r1*cosa1, y1, zCenter+r1*sina1);
glNormal3f(cosa1, 0, sina1);
glVertex3f(xCenter+r0*cosa1, y0, zCenter+r0*sina1);
}
glEnd();
}
// Subroutine used to build halo display list
void Scene::DrawSubdivHaloZ(float x, float y, float z, float radius, int subdiv) const
{
glBegin(GL_TRIANGLE_FAN);
glNormal3f(0, 0, 0);
glColor4f(1, 1, 1, 1);
glVertex3f(x, y, z);
for( int i=0; i<=subdiv; ++i )
{
glColor4f(1, 1, 1, 0);
glVertex3f(x+radius*(float)cos(FLOAT_2PI*(float)i/subdiv), x+radius*(float)sin(FLOAT_2PI*(float)i/subdiv), z);
}
glEnd();
}
// Callback function called by GLFW when a mouse button is clicked
void GLFWCALL OnMouseButton(int glfwButton, int glfwAction)
{
if( !TwEventMouseButtonGLFW(glfwButton, glfwAction) ) // Send event to AntTweakBar
{
// Event has not been handled by AntTweakBar
// Do something if needed.
}
}
// Callback function called by GLFW when mouse has moved
void GLFWCALL OnMousePos(int mouseX, int mouseY)
{
if( !TwEventMousePosGLFW(mouseX, mouseY) ) // Send event to AntTweakBar
{
// Event has not been handled by AntTweakBar
// Do something if needed.
}
}
// Callback function called by GLFW on mouse wheel event
void GLFWCALL OnMouseWheel(int pos)
{
if( !TwEventMouseWheelGLFW(pos) ) // Send event to AntTweakBar
{
// Event has not been handled by AntTweakBar
// Do something if needed.
}
}
// Callback function called by GLFW on key event
void GLFWCALL OnKey(int glfwKey, int glfwAction)
{
if( !TwEventKeyGLFW(glfwKey, glfwAction) ) // Send event to AntTweakBar
{
if( glfwKey==GLFW_KEY_ESC && glfwAction==GLFW_PRESS ) // Want to quit?
glfwCloseWindow();
else
{
// Event has not been handled
// Do something if needed.
}
}
}
// Callback function called by GLFW on char event
void GLFWCALL OnChar(int glfwChar, int glfwAction)
{
if( !TwEventCharGLFW(glfwChar, glfwAction) ) // Send event to AntTweakBar
{
// Event has not been handled by AntTweakBar
// Do something if needed.
}
}
// Callback function called by GLFW when window size changes
void GLFWCALL OnWindowSize(int width, int height)
{
// Set OpenGL viewport and camera
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(40, (double)width/height, 1, 10);
gluLookAt(-0.3,1,3.5, -0.3,0,0, 0,1,0);
glTranslated(0, -0.3, 0);
// Send the new window size to AntTweakBar
TwWindowSize(width, height);
}
// Callback function called when the 'Subdiv' variable value of the main tweak bar has changed.
void TW_CALL SetSubdivCB(const void *value, void *clientData)
{
Scene *scene = static_cast<Scene *>(clientData); // scene pointer is stored in clientData
scene->Subdiv = *static_cast<const int *>(value); // copy value to scene->Subdiv
scene->Init(false); // re-init scene with the new Subdiv parameter
}
// Callback function called by the main tweak bar to get the 'Subdiv' value
void TW_CALL GetSubdivCB(void *value, void *clientData)
{
Scene *scene = static_cast<Scene *>(clientData); // scene pointer is stored in clientData
*static_cast<int *>(value) = scene->Subdiv; // copy scene->Subdiv to value
}
// Main function
int main()
{
// Initialize GLFW
if( !glfwInit() )
{
// A fatal error occurred
std::cerr << "GLFW initialization failed" << std::endl;
return 1;
}
// Create a window
GLFWvidmode mode;
glfwGetDesktopMode(&mode);
if( !glfwOpenWindow(800, 600, mode.RedBits, mode.GreenBits, mode.BlueBits, 0, 16, 0, GLFW_WINDOW /* or GLFW_FULLSCREEN */) )
{
// A fatal error occurred
std::cerr << "Cannot open GLFW window" << std::endl;
glfwTerminate();
return 1;
}
glfwSwapInterval(0);
glfwEnable(GLFW_MOUSE_CURSOR);
glfwEnable(GLFW_KEY_REPEAT);
const char title[] = "AntTweakBar example: TwAdvanced1";
glfwSetWindowTitle(title);
// Set GLFW event callbacks
glfwSetWindowSizeCallback(OnWindowSize);
glfwSetMouseButtonCallback(OnMouseButton);
glfwSetMousePosCallback(OnMousePos);
glfwSetMouseWheelCallback(OnMouseWheel);
glfwSetKeyCallback(OnKey);
glfwSetCharCallback(OnChar);
// Initialize AntTweakBar
TwInit(TW_OPENGL, NULL);
// Change the font size, and add a global message to the Help bar.
TwDefine(" GLOBAL fontSize=3 help='This example illustrates the definition of custom structure type as well as many other features.' ");
// Initialize the 3D scene
Scene scene;
scene.Init(true);
// Create a tweak bar called 'Main' and change its refresh rate, position, size and transparency
TwBar *mainBar = TwNewBar("Main");
TwDefine(" Main label='Main TweakBar' refresh=0.5 position='16 16' size='260 320' alpha=0");
// Add some variables to the Main tweak bar
TwAddVarRW(mainBar, "Wireframe", TW_TYPE_BOOLCPP, &scene.Wireframe,
" group='Display' key=w help='Toggle wireframe display mode.' "); // 'Wireframe' is put in the group 'Display' (which is then created)
TwAddVarRW(mainBar, "BgTop", TW_TYPE_COLOR3F, &scene.BgColor1,
" group='Background' help='Change the top background color.' "); // 'BgTop' and 'BgBottom' are put in the group 'Background' (which is then created)
TwAddVarRW(mainBar, "BgBottom", TW_TYPE_COLOR3F, &scene.BgColor0,
" group='Background' help='Change the bottom background color.' ");
TwDefine(" Main/Background group='Display' "); // The group 'Background' of bar 'Main' is put in the group 'Display'
TwAddVarCB(mainBar, "Subdiv", TW_TYPE_INT32, SetSubdivCB, GetSubdivCB, &scene,
" group='Scene' label='Meshes subdivision' min=1 max=50 keyincr=s keyDecr=S help='Subdivide the meshes more or less (switch to wireframe to see the effect).' ");
TwAddVarRW(mainBar, "Ambient", TW_TYPE_FLOAT, &scene.Ambient,
" label='Ambient factor' group='Scene' min=0 max=1 step=0.001 keyIncr=a keyDecr=A help='Change scene ambient.' ");
TwAddVarRW(mainBar, "Reflection", TW_TYPE_FLOAT, &scene.Reflection,
" label='Reflection factor' group='Scene' min=0 max=1 step=0.001 keyIncr=r keyDecr=R help='Change ground reflection.' ");
// Create a new TwType called rotationType associated with the Scene::RotMode enum, and use it
TwEnumVal rotationEV[] = { { Scene::ROT_OFF, "Stopped"},
{ Scene::ROT_CW, "Clockwise" },
{ Scene::ROT_CCW, "Counter-clockwise" } };
TwType rotationType = TwDefineEnum( "Rotation Mode", rotationEV, 3 );
TwAddVarRW(mainBar, "Rotation", rotationType, &scene.Rotation,
" group='Scene' keyIncr=Backspace keyDecr=SHIFT+Backspace help='Stop or change the rotation mode.' ");
// Add a read-only float variable; its precision is 0 which means that the fractionnal part of the float value will not be displayed
TwAddVarRO(mainBar, "RotYAngle", TW_TYPE_DOUBLE, &scene.RotYAngle,
" group='Scene' label='Rot angle (degree)' precision=0 help='Animated rotation angle' ");
// Initialize time
double time = glfwGetTime(), dt = 0; // Current time and elapsed time
double frameDTime = 0, frameCount = 0, fps = 0; // Framerate
// Main loop (repeated while window is not closed)
while( glfwGetWindowParam(GLFW_OPENED) )
{
// Get elapsed time
dt = glfwGetTime() - time;
if (dt < 0) dt = 0;
time += dt;
// Rotate scene
if( scene.Rotation==Scene::ROT_CW )
scene.RotYAngle -= 5.0*dt;
else if( scene.Rotation==Scene::ROT_CCW )
scene.RotYAngle += 5.0*dt;
// Move lights
scene.Update(time);
// Draw scene
scene.Draw();
// Draw tweak bars
TwDraw();
// Present frame buffer
glfwSwapBuffers();
// Estimate framerate
frameCount++;
frameDTime += dt;
if( frameDTime>1.0 )
{
fps = frameCount/frameDTime;
char newTitle[128];
_snprintf(newTitle, sizeof(newTitle), "%s (%.1f fps)", title, fps);
//glfwSetWindowTitle(newTitle); // uncomment to display framerate
frameCount = frameDTime = 0;
}
}
// Terminate AntTweakBar and GLFW
TwTerminate();
glfwTerminate();
return 0;
}

View File

@@ -0,0 +1,378 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="TwAdvanced1"
ProjectGUID="{008D1CEC-1586-4C89-B524-DF15D9605163}"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="debug32"
IntermediateDirectory="tmp\debug32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glfwdll.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="../lib/debug,../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glfw\lib\win32\glfw.dll xcopy /y /f c:\sdk\glfw\lib\win32\glfw.dll debug32\.&#x0D;&#x0A;if exist bin32\glfw.dll xcopy /y /f bin32\glfw.dll debug32\.&#x0D;&#x0A;if exist ..\lib\AntTweakBar.dll xcopy /y /f ..\lib\AntTweakBar.dll debug32\.&#x0D;&#x0A;if exist ..\lib\debug\AntTweakBar.dll xcopy /y /f ..\lib\debug\AntTweakBar.dll debug32\.&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="debug64"
IntermediateDirectory="tmp\debug64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glfwdll64.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="../lib/debug,../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glfw\lib\win64\glfw.dll xcopy /y /f c:\sdk\glfw\lib\win64\glfw.dll debug64\.&#x0D;&#x0A;if exist bin64\glfw.dll xcopy /y /f bin64\glfw.dll debug64\.&#x0D;&#x0A;if exist ..\lib\AntTweakBar64.dll xcopy /y /f ..\lib\AntTweakBar64.dll debug64\.&#x0D;&#x0A;if exist ..\lib\debug\AntTweakBar64.dll xcopy /y /f ..\lib\debug\AntTweakBar64.dll debug64\.&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="bin32"
IntermediateDirectory="tmp\bin32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glfwdll.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glfw\lib\win32\glfw.dll xcopy /y /f c:\sdk\glfw\lib\win32\glfw.dll bin32\.&#x0D;&#x0A;if exist ..\lib\AntTweakBar.dll xcopy /y /f ..\lib\AntTweakBar.dll bin32\.&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="bin64"
IntermediateDirectory="tmp\bin64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glfwdll64.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glfw\lib\win64\glfw.dll xcopy /y /f c:\sdk\glfw\lib\win64\glfw.dll bin64\.&#x0D;&#x0A;if exist ..\lib\AntTweakBar64.dll xcopy /y /f ..\lib\AntTweakBar64.dll bin64\.&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="TwAdvanced1.cpp"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,242 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{008D1CEC-1586-4C89-B524-DF15D9605163}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>debug32\</OutDir>
<IntDir>tmp\debug32\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>debug64\</OutDir>
<IntDir>tmp\debug64\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin32\</OutDir>
<IntDir>tmp\bin32\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>bin64\</OutDir>
<IntDir>tmp\bin64\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glfwdll.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glfw\lib\win32\glfw.dll xcopy /y /f c:\sdk\glfw\lib\win32\glfw.dll debug32\.
if exist bin32\glfw.dll xcopy /y /f bin32\glfw.dll debug32\.
if exist ..\lib\AntTweakBar.dll xcopy /y /f ..\lib\AntTweakBar.dll debug32\.
if exist ..\lib\debug\AntTweakBar.dll xcopy /y /f ..\lib\debug\AntTweakBar.dll debug32\.
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glfwdll64.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glfw\lib\win64\glfw.dll xcopy /y /f c:\sdk\glfw\lib\win64\glfw.dll debug64\.
if exist bin64\glfw.dll xcopy /y /f bin64\glfw.dll debug64\.
if exist ..\lib\AntTweakBar64.dll xcopy /y /f ..\lib\AntTweakBar64.dll debug64\.
if exist ..\lib\debug\AntTweakBar64.dll xcopy /y /f ..\lib\debug\AntTweakBar64.dll debug64\.
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glfwdll.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glfw\lib\win32\glfw.dll xcopy /y /f c:\sdk\glfw\lib\win32\glfw.dll bin32\.
if exist ..\lib\AntTweakBar.dll xcopy /y /f ..\lib\AntTweakBar.dll bin32\.
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glfwdll64.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glfw\lib\win64\glfw.dll xcopy /y /f c:\sdk\glfw\lib\win64\glfw.dll bin64\.
if exist ..\lib\AntTweakBar64.dll xcopy /y /f ..\lib\AntTweakBar64.dll bin64\.
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="TwAdvanced1.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="TwCopyDLL"
ProjectGUID="{AB180E0E-0EFA-4AD4-8F08-4492D144D963}"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="debug32"
IntermediateDirectory="tmp\debug32"
ConfigurationType="10"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="if exist ..\lib\debug\AntTweakBar.dll ( xcopy /y /f ..\lib\debug\AntTweakBar.dll debug32 ) else ( xcopy /y /f ..\lib\AntTweakBar.dll debug32 )&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="debug64"
IntermediateDirectory="tmp\debug64"
ConfigurationType="10"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="if exist ..\lib\debug\AntTweakBar64.dll ( xcopy /y /f ..\lib\debug\AntTweakBar64.dll debug64 ) else ( xcopy /y /f ..\lib\AntTweakBar64.dll debug64 )&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="bin32"
IntermediateDirectory="tmp\bin32"
ConfigurationType="10"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="xcopy /y /f ..\lib\AntTweakBar.dll bin32"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="bin64"
IntermediateDirectory="tmp\bin64"
ConfigurationType="10"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="xcopy /y /f ..\lib\AntTweakBar64.dll bin64"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{AB180E0E-0EFA-4AD4-8F08-4492D144D963}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Utility</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Utility</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Utility</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Utility</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>debug32\</OutDir>
<IntDir>tmp\debug32\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>debug64\</OutDir>
<IntDir>tmp\debug64\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin32\</OutDir>
<IntDir>tmp\bin32\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>bin64\</OutDir>
<IntDir>tmp\bin64\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command>if exist ..\lib\debug\AntTweakBar.dll ( xcopy /y /f ..\lib\debug\AntTweakBar.dll debug32 ) else ( xcopy /y /f ..\lib\AntTweakBar.dll debug32 )
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PreBuildEvent>
<Command>if exist ..\lib\debug\AntTweakBar64.dll ( xcopy /y /f ..\lib\debug\AntTweakBar64.dll debug64 ) else ( xcopy /y /f ..\lib\AntTweakBar64.dll debug64 )
</Command>
</PreBuildEvent>
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Command>xcopy /y /f ..\lib\AntTweakBar.dll bin32</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PreBuildEvent>
<Command>xcopy /y /f ..\lib\AntTweakBar64.dll bin64</Command>
</PreBuildEvent>
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
</ItemDefinitionGroup>
<ItemGroup>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,465 @@
// ---------------------------------------------------------------------------
//
// @file TwDualGLUT.c
// @brief This example illustrates the use of AntTweakBar with multiple
// windows. Here we are using GLUT to create a main window having
// two sub-windows, each sub-window has a tweak bar.
// This example extends the TwSimpleGLUT example.
//
// AntTweakBar: http://anttweakbar.sourceforge.net/doc
// OpenGL: http://www.opengl.org
// GLUT: http://opengl.org/resources/libraries/glut
//
// ---------------------------------------------------------------------------
#include <AntTweakBar.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#if defined(_WIN32) || defined(_WIN64)
// MiniGLUT.h is provided to avoid the need of having GLUT installed to
// recompile this example. Do not use it in your own programs, better
// install and use the actual GLUT library SDK.
# define USE_MINI_GLUT
#endif
#if defined(USE_MINI_GLUT)
# include "../src/MiniGLUT.h"
#elif defined(_MACOSX)
# include <GLUT/glut.h>
#else
# include <GL/glut.h>
#endif
// This example displays one of the following shapes in each sub-window
typedef enum { SHAPE_TEAPOT=1, SHAPE_TORUS, SHAPE_CONE } Shape;
#define NUM_SHAPES 3
typedef struct
{
int WinID;
TwBar *Bar;
Shape ObjectShape;
float Zoom;
float Rotation[4];
int AutoRotate;
int RotateTime;
float RotateStart[4];
float MatAmbient[4];
float MatDiffuse[4];
float LightMultiplier;
float LightDirection[3];
} SubWindowData;
SubWindowData g_SubWindowData[2];
// Routine to set a quaternion from a rotation axis and angle
// ( input axis = float[3] angle = float output: quat = float[4] )
void SetQuaternionFromAxisAngle(const float *axis, float angle, float *quat)
{
float sina2, norm;
sina2 = (float)sin(0.5f * angle);
norm = (float)sqrt(axis[0]*axis[0] + axis[1]*axis[1] + axis[2]*axis[2]);
quat[0] = sina2 * axis[0] / norm;
quat[1] = sina2 * axis[1] / norm;
quat[2] = sina2 * axis[2] / norm;
quat[3] = (float)cos(0.5f * angle);
}
// Routine to convert a quaternion to a 4x4 matrix
// ( input: quat = float[4] output: mat = float[4*4] )
void ConvertQuaternionToMatrix(const float *quat, float *mat)
{
float yy2 = 2.0f * quat[1] * quat[1];
float xy2 = 2.0f * quat[0] * quat[1];
float xz2 = 2.0f * quat[0] * quat[2];
float yz2 = 2.0f * quat[1] * quat[2];
float zz2 = 2.0f * quat[2] * quat[2];
float wz2 = 2.0f * quat[3] * quat[2];
float wy2 = 2.0f * quat[3] * quat[1];
float wx2 = 2.0f * quat[3] * quat[0];
float xx2 = 2.0f * quat[0] * quat[0];
mat[0*4+0] = - yy2 - zz2 + 1.0f;
mat[0*4+1] = xy2 + wz2;
mat[0*4+2] = xz2 - wy2;
mat[0*4+3] = 0;
mat[1*4+0] = xy2 - wz2;
mat[1*4+1] = - xx2 - zz2 + 1.0f;
mat[1*4+2] = yz2 + wx2;
mat[1*4+3] = 0;
mat[2*4+0] = xz2 + wy2;
mat[2*4+1] = yz2 - wx2;
mat[2*4+2] = - xx2 - yy2 + 1.0f;
mat[2*4+3] = 0;
mat[3*4+0] = mat[3*4+1] = mat[3*4+2] = 0;
mat[3*4+3] = 1;
}
// Routine to multiply 2 quaternions (ie, compose rotations)
// ( input q1 = float[4] q2 = float[4] output: qout = float[4] )
void MultiplyQuaternions(const float *q1, const float *q2, float *qout)
{
float qr[4];
qr[0] = q1[3]*q2[0] + q1[0]*q2[3] + q1[1]*q2[2] - q1[2]*q2[1];
qr[1] = q1[3]*q2[1] + q1[1]*q2[3] + q1[2]*q2[0] - q1[0]*q2[2];
qr[2] = q1[3]*q2[2] + q1[2]*q2[3] + q1[0]*q2[1] - q1[1]*q2[0];
qr[3] = q1[3]*q2[3] - (q1[0]*q2[0] + q1[1]*q2[1] + q1[2]*q2[2]);
qout[0] = qr[0]; qout[1] = qr[1]; qout[2] = qr[2]; qout[3] = qr[3];
}
// Return elapsed time in milliseconds
int GetTimeMs()
{
#if !defined(_WIN32)
return glutGet(GLUT_ELAPSED_TIME);
#else
// glutGet(GLUT_ELAPSED_TIME) seems buggy on Windows
return (int)GetTickCount();
#endif
}
// Find the current WindowData
SubWindowData *GetCurrentSubWindowData()
{
int i, currWinID;
currWinID = glutGetWindow();
for (i = 0; i < 2; i++)
if (g_SubWindowData[i].WinID == currWinID)
return &g_SubWindowData[i];
return NULL;
}
// Callback function called by GLUT to render the main window content
void DisplayMainWindow(void)
{
// Clear frame buffer
glClearColor(1, 0.8f, 0.4f, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Present frame buffer
glutSwapBuffers();
}
// Callback function called by GLUT when the main window size has changed
void ReshapeMainWindow(int width, int height)
{
if (width > 32 && height > 32)
{
glutSetWindow(g_SubWindowData[0].WinID);
glutPositionWindow(8, 8);
glutReshapeWindow(width/2-16, height-16);
glutSetWindow(g_SubWindowData[1].WinID);
glutPositionWindow(width/2+8, 8);
glutReshapeWindow(width/2-16, height-16);
}
}
// Callback function called by GLUT to render sub-window content
void DisplaySubWindow(void)
{
float v[4]; // will be used to set light parameters
float mat[4*4]; // rotation matrix
SubWindowData *win;
win = GetCurrentSubWindowData();
if (win == NULL) return;
// Tell AntTweakBar which is the current window
TwSetCurrentWindow(win->WinID);
// Clear frame buffer
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glEnable(GL_NORMALIZE);
// Set light
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
v[0] = v[1] = v[2] = win->LightMultiplier*0.4f; v[3] = 1.0f;
glLightfv(GL_LIGHT0, GL_AMBIENT, v);
v[0] = v[1] = v[2] = win->LightMultiplier*0.8f; v[3] = 1.0f;
glLightfv(GL_LIGHT0, GL_DIFFUSE, v);
v[0] = -win->LightDirection[0]; v[1] = -win->LightDirection[1]; v[2] = -win->LightDirection[2]; v[3] = 0.0f;
glLightfv(GL_LIGHT0, GL_POSITION, v);
// Set material
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, win->MatAmbient);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, win->MatDiffuse);
// Rotate and draw shape
glPushMatrix();
glTranslatef(0.5f, -0.3f, 0.0f);
if( win->AutoRotate )
{
float axis[3] = { 0, 1, 0 };
float angle = (float)(GetTimeMs()-win->RotateTime)/1000.0f;
float quat[4];
SetQuaternionFromAxisAngle(axis, angle, quat);
MultiplyQuaternions(win->RotateStart, quat, win->Rotation);
}
ConvertQuaternionToMatrix(win->Rotation, mat);
glMultMatrixf(mat);
glScalef(win->Zoom, win->Zoom, win->Zoom);
glCallList(win->ObjectShape);
glPopMatrix();
// Draw tweak bars
TwDraw();
// Present frame buffer
glutSwapBuffers();
// Recall Display at next frame
glutPostRedisplay();
}
// Callback function called by GLUT when sub-window size has changed
void ReshapeSubWindow(int width, int height)
{
SubWindowData *win;
win = GetCurrentSubWindowData();
if (win == NULL) return;
// Set OpenGL viewport and camera
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(40, (double)width/height, 1, 10);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,5, 0,0,0, 0,1,0);
glTranslatef(0, 0.6f, -1);
// Send the new window size to AntTweakBar
TwSetCurrentWindow(win->WinID);
TwWindowSize(width, height);
}
// Function called at exit
void Terminate(void)
{
int i;
for (i=0; i<2; i++) {
glutSetWindow(g_SubWindowData[i].WinID);
glDeleteLists(SHAPE_TEAPOT, NUM_SHAPES);
}
TwTerminate();
}
// Callback function called when the 'AutoRotate' variable value of the tweak bar has changed
void TW_CALL SetAutoRotateCB(const void *value, void *clientData)
{
SubWindowData *win;
win = (SubWindowData *)clientData;
win->AutoRotate = *(const int *)value; // copy value to win->AutoRotate
if (win->AutoRotate != 0)
{
// init rotation
win->RotateTime = GetTimeMs();
win->RotateStart[0] = win->Rotation[0];
win->RotateStart[1] = win->Rotation[1];
win->RotateStart[2] = win->Rotation[2];
win->RotateStart[3] = win->Rotation[3];
}
// make Rotation variable read-only or read-write
TwSetCurrentWindow(win->WinID);
TwSetParam(win->Bar, "ObjRotation", "readonly", TW_PARAM_INT32, 1, &win->AutoRotate);
}
// Callback function called by the tweak bar to get the 'AutoRotate' value
void TW_CALL GetAutoRotateCB(void *value, void *clientData)
{
SubWindowData *win;
win = (SubWindowData *)clientData;
*(int *)value = win->AutoRotate; // copy win->AutoRotate to value
}
// Mouse Button event callbacks
int MouseButtonCB(int glutButton, int glutState, int mouseX, int mouseY)
{
TwSetCurrentWindow(glutGetWindow());
return TwEventMouseButtonGLUT(glutButton,glutState,mouseX,mouseY);
}
// Mouse Motion event callbacks
int MouseMotionCB(int mouseX, int mouseY)
{
TwSetCurrentWindow(glutGetWindow());
return TwEventMouseMotionGLUT(mouseX,mouseY);
}
// Keyboard event callbacks
int KeyboardCB(unsigned char glutKey, int mouseX, int mouseY)
{
TwSetCurrentWindow(glutGetWindow());
return TwEventKeyboardGLUT(glutKey,mouseX,mouseY);
}
// Special key event callbacks
int SpecialKeyCB(int glutKey, int mouseX, int mouseY)
{
TwSetCurrentWindow(glutGetWindow());
return TwEventSpecialGLUT(glutKey,mouseX,mouseY);
}
// Setup new sub-window
void SetupSubWindow(int subWinIdx)
{
float axis[] = { 0.7f, 0.7f, 0.0f }; // initial model rotation
float angle = 0.8f;
SubWindowData *win;
win = &g_SubWindowData[subWinIdx];
win->ObjectShape = (subWinIdx == 0) ? SHAPE_TEAPOT : SHAPE_TORUS;
win->Zoom = 1;
win->AutoRotate = (subWinIdx == 0);
win->MatAmbient[0] = (subWinIdx == 1) ? 0.0f : 0.5f;; win->MatAmbient[1] = win->MatAmbient[2] = 0.2f; win->MatAmbient[3] = 1;
win->MatDiffuse[0] = (subWinIdx == 1) ? 0.0f : 1.0f; win->MatDiffuse[1] = 1; win->MatDiffuse[2] = 0; win->MatDiffuse[3] = 1;
win->LightMultiplier = 1;
win->LightDirection[0] = win->LightDirection[1] = win->LightDirection[2] = -0.57735f;
win->RotateTime = GetTimeMs();
SetQuaternionFromAxisAngle(axis, angle, win->Rotation);
SetQuaternionFromAxisAngle(axis, angle, win->RotateStart);
glutSetWindow(win->WinID);
// Set GLUT callbacks
glutDisplayFunc(DisplaySubWindow);
glutReshapeFunc(ReshapeSubWindow);
// Set GLUT event callbacks
// - Register mouse button events callback
glutMouseFunc((GLUTmousebuttonfun)MouseButtonCB);
// - Register mouse motion events callback
glutMotionFunc((GLUTmousemotionfun)MouseMotionCB);
// - Register mouse "passive" motion events (same as Motion)
glutPassiveMotionFunc((GLUTmousemotionfun)MouseMotionCB);
// - Register keyboard events callback
glutKeyboardFunc((GLUTkeyboardfun)KeyboardCB);
// - Register special key events callback
glutSpecialFunc((GLUTspecialfun)SpecialKeyCB);
// - Send 'glutGetModifers' function pointer to AntTweakBar;
// required because the GLUT key event functions do not report key modifiers states.
TwGLUTModifiersFunc(glutGetModifiers);
// Create some 3D objects (stored in display lists)
glNewList(SHAPE_TEAPOT, GL_COMPILE);
glutSolidTeapot(1.0);
glEndList();
glNewList(SHAPE_TORUS, GL_COMPILE);
glutSolidTorus(0.3, 1.0, 16, 32);
glEndList();
glNewList(SHAPE_CONE, GL_COMPILE);
glutSolidCone(1.0, 1.5, 64, 4);
glEndList();
// Declare this window as current for AntTweakBar.
// Here, this will create a new AntTweakBar context for this window,
// which will be identified by the number WinID.
TwSetCurrentWindow(win->WinID);
// Create a tweak bar
win->Bar = TwNewBar("TweakBar");
TwDefine(" GLOBAL help='This example shows how to use AntTweakBar with multiple windows.' "); // Message added to the help bar.
TwDefine(" TweakBar size='200 400' color='96 216 224' "); // change default tweak bar size and color
// Add 'win->Zoom' to 'bar': this is a modifable (RW) variable of type TW_TYPE_FLOAT. Its key shortcuts are [z] and [Z].
TwAddVarRW(win->Bar, "Zoom", TW_TYPE_FLOAT, &win->Zoom,
" min=0.01 max=2.5 step=0.01 keyIncr=z keyDecr=Z help='Scale the object (1=original size).' ");
// Add 'win->Rotation' to 'bar': this is a variable of type TW_TYPE_QUAT4F which defines the object's orientation
TwAddVarRW(win->Bar, "ObjRotation", TW_TYPE_QUAT4F, &win->Rotation,
" label='Object rotation' open help='Change the object orientation.' ");
// Add callback to toggle auto-rotate mode (callback functions are defined above).
TwAddVarCB(win->Bar, "AutoRotate", TW_TYPE_BOOL32, SetAutoRotateCB, GetAutoRotateCB, win,
" label='Auto-rotate' key=space help='Toggle auto-rotate mode.' ");
// Add 'win->LightMultiplier' to 'bar': this is a variable of type TW_TYPE_FLOAT. Its key shortcuts are [+] and [-].
TwAddVarRW(win->Bar, "Multiplier", TW_TYPE_FLOAT, &win->LightMultiplier,
" label='Light booster' min=0.1 max=4 step=0.02 keyIncr='+' keyDecr='-' help='Increase/decrease the light power.' ");
// Add 'win->LightDirection' to 'bar': this is a variable of type TW_TYPE_DIR3F which defines the light direction
TwAddVarRW(win->Bar, "LightDir", TW_TYPE_DIR3F, &win->LightDirection,
" label='Light direction' open help='Change the light direction.' ");
// Add 'win->MatAmbient' to 'bar': this is a variable of type TW_TYPE_COLOR3F (3 floats color, alpha is ignored)
// and is inserted into a group named 'Material'.
TwAddVarRW(win->Bar, "Ambient", TW_TYPE_COLOR3F, &win->MatAmbient, " group='Material' ");
// Add 'win->MatDiffuse' to 'bar': this is a variable of type TW_TYPE_COLOR3F (3 floats color, alpha is ignored)
// and is inserted into group 'Material'.
TwAddVarRW(win->Bar, "Diffuse", TW_TYPE_COLOR3F, &win->MatDiffuse, " group='Material' ");
// Add the enum variable 'win->ObjectShape' to 'bar'
// (before adding an enum variable, its enum type must be declared to AntTweakBar as follow)
{
// ShapeEV associates Shape enum values with labels that will be displayed instead of enum values
TwEnumVal shapeEV[NUM_SHAPES] = { {SHAPE_TEAPOT, "Teapot"}, {SHAPE_TORUS, "Torus"}, {SHAPE_CONE, "Cone"} };
// Create a type for the enum shapeEV
TwType shapeType = TwDefineEnum("ShapeType", shapeEV, NUM_SHAPES);
// add 'win->CurrentShape' to 'bar': this is a variable of type ShapeType. Its key shortcuts are [<] and [>].
TwAddVarRW(win->Bar, "Shape", shapeType, &win->ObjectShape, " keyIncr='<' keyDecr='>' help='Change object shape.' ");
}
}
// Main
int main(int argc, char *argv[])
{
int mainWinID;
// Initialize GLUT
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(960, 480);
mainWinID = glutCreateWindow("AntTweakBar multi-window example");
glutCreateMenu(NULL);
glutDisplayFunc(DisplayMainWindow);
glutReshapeFunc(ReshapeMainWindow);
// Initialize AntTweakBar
TwInit(TW_OPENGL, NULL);
// Create two sub-windows
g_SubWindowData[0].WinID = glutCreateSubWindow(mainWinID, 8, 8, 480, 464);
SetupSubWindow(0);
g_SubWindowData[1].WinID = glutCreateSubWindow(mainWinID, 488, 8, 464, 464);
SetupSubWindow(1);
atexit(Terminate); // Called after glutMainLoop ends
// Call the GLUT main loop
glutMainLoop();
return 0;
}

View File

@@ -0,0 +1,390 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="TwDualGLUT"
ProjectGUID="{DC6C7BF1-5AF3-295F-9385-C51E003A2856}"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="debug32"
IntermediateDirectory="tmp\debug32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glut32.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib/debug;../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(InputName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glut\lib\glut32.dll xcopy /y /f c:\sdk\glut\lib\glut32.dll debug32\.&#x0D;&#x0A;if exist bin32\glut32.dll xcopy /y /f bin32\glut32.dll debug32\.&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="debug64"
IntermediateDirectory="tmp\debug64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glut64.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib/debug;../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(InputName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glut\lib\glut64.dll xcopy /y /f c:\sdk\glut\lib\glut64.dll debug64\.&#x0D;&#x0A;if exist bin64\glut64.dll xcopy /y /f bin64\glut64.dll debug64\.&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="bin32"
IntermediateDirectory="tmp\bin32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="true"
ExceptionHandling="0"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
DisableLanguageExtensions="false"
UsePrecompiledHeader="0"
AssemblerListingLocation="$(IntDir)/"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glut32.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glut\lib\glut32.dll xcopy /y /f c:\sdk\glut\lib\glut32.dll bin32\."
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="bin64"
IntermediateDirectory="tmp\bin64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;NDEBUG;_CONSOLE"
StringPooling="true"
ExceptionHandling="0"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
DisableLanguageExtensions="false"
UsePrecompiledHeader="0"
AssemblerListingLocation="$(IntDir)/"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glut64.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glut\lib\glut64.dll xcopy /y /f c:\sdk\glut\lib\glut64.dll bin64\."
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="TwDualGLUT.c"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,246 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{DC6C7BF1-5AF3-295F-9385-C51E003A2856}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>debug32\</OutDir>
<IntDir>tmp\debug32\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>debug64\</OutDir>
<IntDir>tmp\debug64\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin32\</OutDir>
<IntDir>tmp\bin32\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>bin64\</OutDir>
<IntDir>tmp\bin64\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glut32.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glut\lib\glut32.dll xcopy /y /f c:\sdk\glut\lib\glut32.dll debug32\.
if exist bin32\glut32.dll xcopy /y /f bin32\glut32.dll debug32\.
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glut64.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glut\lib\glut64.dll xcopy /y /f c:\sdk\glut\lib\glut64.dll debug64\.
if exist bin64\glut64.dll xcopy /y /f bin64\glut64.dll debug64\.
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling />
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<PrecompiledHeader />
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat />
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glut32.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glut\lib\glut32.dll xcopy /y /f c:\sdk\glut\lib\glut32.dll bin32\.</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling />
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<PrecompiledHeader />
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat />
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glut64.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glut\lib\glut64.dll xcopy /y /f c:\sdk\glut\lib\glut64.dll bin64\.</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="TwDualGLUT.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,410 @@
// ---------------------------------------------------------------------------
//
// @file TwGLCoreSDL.c
// @brief An example that uses AntTweakBar with OpenGL Core Profile
// and SDL 1.3.
//
// AntTweakBar: http://anttweakbar.sourceforge.net/doc
// OpenGL: http://www.opengl.org
// SDL: http://www.libsdl.org
//
// @author Philippe Decaudin
//
// ---------------------------------------------------------------------------
#include <AntTweakBar.h>
#ifdef _WIN32
// MiniSDL13.h is provided to avoid the need of having SDL installed to
// recompile this example. Do not use it in your own programs, better
// install and use the actual SDL library SDK.
# define USE_MINI_SDL
#endif
//#define GL3_PROTOTYPES 1 ////
//#include <GL3/gl3.h> ////
#ifdef USE_MINI_SDL
# include "../src/MiniSDL13.h"
#else
# include <SDL/SDL.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#ifdef _WIN32
# include <windows.h> // required by gl.h
#endif
#include <GL/gl.h>
#include <GL/glu.h>
// In this example, we draw a simple rotating square using the OpenGL core profile
// (which requires much more code than with the compatibility profile).
// A tweak bar is created to allow the user to change the color of the
// rectangle and see its rotation.
// Part of OpenGL core interface is not directly accessible from the common
// OpenGL header and library (at least on windows) so we have to retrieve the
// core functions using glGetProcAddress. These functions are prefixed by
// underscore to avoid possible confict if a modified gl.h has been installed.
#ifdef _WIN32
# define glGetProcAddress wglGetProcAddress
#else
# define GLX_GLXEXT_LEGACY
# include <GL/glx.h>
# define glGetProcAddress glXGetProcAddressARB
#endif
#ifndef APIENTRY
# define APIENTRY
#endif
typedef GLuint (APIENTRY *PFNGLCreateShader)(GLenum type);
typedef void (APIENTRY *PFNGLDeleteShader)(GLuint shader);
typedef void (APIENTRY *PFNGLShaderSource)(GLuint shader, GLsizei count, const char* *str, const GLint *length);
typedef void (APIENTRY *PFNGLCompileShader)(GLuint shader);
typedef void (APIENTRY *PFNGLAttachShader)(GLuint program, GLuint shader);
typedef GLuint (APIENTRY *PFNGLCreateProgram)(void);
typedef void (APIENTRY *PFNGLLinkProgram)(GLuint program);
typedef void (APIENTRY *PFNGLUseProgram)(GLuint program);
typedef void (APIENTRY *PFNGLDeleteProgram)(GLuint program);
typedef void (APIENTRY *PFNGLGenBuffers)(GLsizei n, GLuint *buffers);
typedef void (APIENTRY *PFNGLBindBuffer)(GLenum target, GLuint buffer);
typedef void (APIENTRY *PFNGLVertexAttribPointer)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
typedef void (APIENTRY *PFNGLEnableVertexAttribArray)(GLuint index);
typedef void (APIENTRY *PFNGLGenVertexArrays)(GLsizei n, GLuint *arrays);
typedef void (APIENTRY *PFNGLBindVertexArray)(GLuint array);
typedef void (APIENTRY *PFNGLDeleteVertexArrays)(GLsizei n, const GLuint *arrays);
typedef GLint (APIENTRY *PFNGLGetAttribLocation)(GLuint program, const char *name);
typedef GLint (APIENTRY *PFNGLGetUniformLocation)(GLuint program, const char *name);
typedef void (APIENTRY *PFNGLUniform1f)(GLint location, GLfloat v0);
typedef void (APIENTRY *PFNGLUniform3f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
typedef void (APIENTRY *PFNGLBufferData)(GLenum target, ptrdiff_t size, const GLvoid *data, GLenum usage);
typedef void (APIENTRY *PFNGLDeleteBuffers)(GLsizei n, const GLuint *buffers);
PFNGLCreateShader _glCreateShader;
PFNGLDeleteShader _glDeleteShader;
PFNGLShaderSource _glShaderSource;
PFNGLCompileShader _glCompileShader;
PFNGLAttachShader _glAttachShader;
PFNGLCreateProgram _glCreateProgram;
PFNGLLinkProgram _glLinkProgram;
PFNGLUseProgram _glUseProgram;
PFNGLDeleteProgram _glDeleteProgram;
PFNGLGenBuffers _glGenBuffers;
PFNGLBindBuffer _glBindBuffer;
PFNGLVertexAttribPointer _glVertexAttribPointer;
PFNGLEnableVertexAttribArray _glEnableVertexAttribArray;
PFNGLGenVertexArrays _glGenVertexArrays;
PFNGLBindVertexArray _glBindVertexArray;
PFNGLDeleteVertexArrays _glDeleteVertexArrays;
PFNGLGetAttribLocation _glGetAttribLocation;
PFNGLGetUniformLocation _glGetUniformLocation;
PFNGLUniform1f _glUniform1f;
PFNGLUniform3f _glUniform3f;
PFNGLBufferData _glBufferData;
PFNGLDeleteBuffers _glDeleteBuffers;
#ifndef GL_ARRAY_BUFFER
# define GL_ARRAY_BUFFER 0x8892
#endif
#ifndef GL_STATIC_DRAW
# define GL_STATIC_DRAW 0x88E4
#endif
#ifndef GL_VERTEX_SHADER
# define GL_VERTEX_SHADER 0x8B31
#endif
#ifndef GL_FRAGMENT_SHADER
# define GL_FRAGMENT_SHADER 0x8B30
#endif
int LoadGLCoreFunctions()
{
_glCreateShader = (PFNGLCreateShader)glGetProcAddress("glCreateShader");
_glDeleteShader = (PFNGLDeleteShader)glGetProcAddress("glDeleteShader");
_glShaderSource = (PFNGLShaderSource)glGetProcAddress("glShaderSource");
_glCompileShader = (PFNGLCompileShader)glGetProcAddress("glCompileShader");
_glAttachShader = (PFNGLAttachShader)glGetProcAddress("glAttachShader");
_glCreateProgram = (PFNGLCreateProgram)glGetProcAddress("glCreateProgram");
_glLinkProgram = (PFNGLLinkProgram)glGetProcAddress("glLinkProgram");
_glUseProgram = (PFNGLUseProgram)glGetProcAddress("glUseProgram");
_glDeleteProgram = (PFNGLDeleteProgram)glGetProcAddress("glDeleteProgram");
_glGenBuffers = (PFNGLGenBuffers)glGetProcAddress("glGenBuffers");
_glBindBuffer = (PFNGLBindBuffer)glGetProcAddress("glBindBuffer");
_glVertexAttribPointer = (PFNGLVertexAttribPointer)glGetProcAddress("glVertexAttribPointer");
_glEnableVertexAttribArray = (PFNGLEnableVertexAttribArray)glGetProcAddress("glEnableVertexAttribArray");
_glGenVertexArrays = (PFNGLGenVertexArrays)glGetProcAddress("glGenVertexArrays");
_glBindVertexArray = (PFNGLBindVertexArray)glGetProcAddress("glBindVertexArray");
_glDeleteVertexArrays = (PFNGLDeleteVertexArrays)glGetProcAddress("glDeleteVertexArrays");
_glGetAttribLocation = (PFNGLGetAttribLocation)glGetProcAddress("glGetAttribLocation");
_glGetUniformLocation = (PFNGLGetUniformLocation)glGetProcAddress("glGetUniformLocation");
_glUniform1f = (PFNGLUniform1f)glGetProcAddress("glUniform1f");
_glUniform3f = (PFNGLUniform3f)glGetProcAddress("glUniform3f");
_glBufferData = (PFNGLBufferData)glGetProcAddress("glBufferData");
_glDeleteBuffers = (PFNGLDeleteBuffers)glGetProcAddress("glDeleteBuffers");
if (_glCreateShader == NULL || _glDeleteShader == NULL || _glShaderSource == NULL || _glCompileShader == NULL
|| _glAttachShader == NULL || _glCreateProgram == NULL || _glLinkProgram == NULL || _glUseProgram == NULL
|| _glDeleteProgram == NULL || _glGenBuffers == NULL || _glBindBuffer == NULL || _glVertexAttribPointer == NULL
|| _glEnableVertexAttribArray == NULL || _glGenVertexArrays == NULL || _glBindVertexArray == NULL
|| _glDeleteVertexArrays == NULL || _glGetAttribLocation == NULL || _glGetUniformLocation == NULL
|| _glUniform1f == NULL || _glUniform3f == NULL || _glBufferData == NULL || _glDeleteBuffers == NULL)
return 0;
else
return 1;
}
// Shaders globals
GLuint vshader, fshader, program, varray, buffer;
GLint cosa, sina, colorloc;
float angle = 0, quat[4];
float color[] = {0.8f, 1.0f, 0.2f};
float FLOAT_PI = 3.14159265f;
void InitRender()
{
// Vertex shader
char *vsource[] = {
"#version 150 core\n"
"uniform float cosa, sina;"
"in vec3 vertex;"
"void main() { gl_Position = vec4(cosa*vertex.x-sina*vertex.y, sina*vertex.x+cosa*vertex.y, 0, 1); }"
};
// Fragment shader
char *fsource[] = {
"#version 150 core\n"
"uniform vec3 color;"
"out vec4 fcolor;"
"void main() { fcolor = vec4(color, 1); }"
};
// Geometry vertex array
GLfloat vertices[] = {
-0.5f, 0.5f, 0,
-0.5f, -0.5f, 0,
0.5f, 0.5f, 0,
0.5f, -0.5f, 0
};
GLint vlocation;
// Compile and bind shaders
vshader = _glCreateShader(GL_VERTEX_SHADER);
fshader = _glCreateShader(GL_FRAGMENT_SHADER);
program = _glCreateProgram();
_glShaderSource(vshader, 1, vsource, NULL);
_glShaderSource(fshader, 1, fsource, NULL);
_glCompileShader(vshader);
_glCompileShader(fshader);
_glAttachShader(program, vshader);
_glAttachShader(program, fshader);
_glLinkProgram(program);
_glUseProgram(program);
cosa = _glGetUniformLocation(program, "cosa");
sina = _glGetUniformLocation(program, "sina");
colorloc = _glGetUniformLocation(program, "color");
// Create and bind vertex buffer
_glGenVertexArrays(1, &varray);
_glBindVertexArray(varray);
_glGenBuffers(1, &buffer);
_glBindBuffer(GL_ARRAY_BUFFER, buffer);
_glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
vlocation = _glGetAttribLocation(program, "vertex");
_glVertexAttribPointer(vlocation, 3, GL_FLOAT, GL_TRUE, 0, NULL);
_glEnableVertexAttribArray(vlocation);
// GL states
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
}
void UninitRender()
{
_glDeleteProgram(program);
_glDeleteShader(fshader);
_glDeleteShader(vshader);
_glDeleteBuffers(1, &buffer);
_glDeleteVertexArrays(1, &varray);
}
void Render()
{
_glUniform1f(cosa, (float)cos(angle));
_glUniform1f(sina, (float)sin(angle));
_glUniform3f(colorloc, color[0], color[1], color[2]);
_glBindVertexArray(varray);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
TwBar *CreateTweakBar()
{
TwBar *bar;
// Create a tweak bar
bar = TwNewBar("TweakBar");
TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar with SDL and OpenGL Core Profile.\n' "); // Message added to the help bar.
// Add variables
TwAddVarRW(bar, "Rotation", TW_TYPE_QUAT4F, &quat, " opened=true help='Rectangle rotation' ");
TwAddVarRW(bar, "Color", TW_TYPE_COLOR3F, &color, " opened=true help='Rectangle color' ");
return bar;
}
// SDL redefines main
#ifdef main
# undef main
#endif
int main()
{
const SDL_VideoInfo* video = NULL;
int width = 480, height = 480;
int bpp, flags;
int quit = 0;
// Initialize SDL, then get the current video mode and use it to create a SDL window.
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
fprintf(stderr, "Video initialization failed: %s\n", SDL_GetError());
SDL_Quit();
exit(1);
}
video = SDL_GetVideoInfo();
if (!video)
{
fprintf(stderr, "Video query failed: %s\n", SDL_GetError());
SDL_Quit();
exit(1);
}
// Request GL context to be OpenGL 3.2 Core Profile
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
// Other GL attributes
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
//SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
bpp = video->vfmt->BitsPerPixel;
flags = SDL_OPENGL | SDL_HWSURFACE;
if (!SDL_SetVideoMode(width, height, bpp, flags))
{
fprintf(stderr, "Video mode set failed: %s\n", SDL_GetError());
SDL_Quit();
exit(1);
}
SDL_WM_SetCaption("AntTweakBar example using OpenGL Core Profile and SDL", "AntTweakBar+GLCore+SDL");
// Enable SDL unicode and key-repeat
SDL_EnableUNICODE(1);
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
// Load some OpenGL core functions
if (!LoadGLCoreFunctions())
{
fprintf(stderr, "OpenGL 3.2 not supported.\n");
SDL_Quit();
exit(1);
}
// Initialize AntTweakBar
if (!TwInit(TW_OPENGL_CORE, NULL)) {
fprintf(stderr, "AntTweakBar initialization failed: %s\n", TwGetLastError());
SDL_Quit();
exit(1);
}
// Tell the window size to AntTweakBar
TwWindowSize(width, height);
// Create a tweak bar
CreateTweakBar();
// Set OpenGL viewport
glViewport(0, 0, width, height);
// Prepare GL shaders and programs for drawing
InitRender();
// Main loop:
// - Draw scene
// - Process events
while (!quit)
{
SDL_Event event;
int handled;
GLenum error;
// Clear screen
glClearColor(0.5f, 0.75f, 0.8f, 1);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
// Update angle and draw geometry
angle = (float)SDL_GetTicks()/25.0f * (FLOAT_PI/180.0f);
quat[0] = quat[1] = 0;
quat[2] = (float)sin(angle/2.0f);
quat[3] = (float)cos(angle/2.0f);
Render();
// Draw tweak bars
TwDraw();
// Present frame buffer
SDL_GL_SwapBuffers();
// Process incoming events
while (SDL_PollEvent(&event))
{
// Send event to AntTweakBar
handled = TwEventSDL(&event, SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
// If event has not been handled by AntTweakBar, process it
if (!handled)
{
switch (event.type)
{
case SDL_QUIT: // Window is closed
quit = 1;
break;
case SDL_VIDEORESIZE: // Window size has changed
// Resize SDL video mode
width = event.resize.w;
height = event.resize.h;
if (!SDL_SetVideoMode(width, height, bpp, flags))
fprintf(stderr, "WARNING: Video mode set failed: %s\n", SDL_GetError());
// Resize OpenGL viewport
glViewport(0, 0, width, height);
// Restore OpenGL states
InitRender();
// TwWindowSize has been called by TwEventSDL,
// so it is not necessary to call it again here.
break;
}
}
}
while ((error = glGetError()) != GL_NO_ERROR)
fprintf(stderr, "GL error detected: 0x%04X\n", error);
} // End of main loop
// Terminate AntTweakBar
TwTerminate();
// Delete GL shaders and buffer
UninitRender();
// Terminate SDL
SDL_Quit();
return 0;
}

View File

@@ -0,0 +1,467 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="TwGLCoreSDL"
ProjectGUID="{3B5FCA22-D015-499E-8211-830ABC8F605B}"
RootNamespace="TwGLCoreSDL"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="bin32"
IntermediateDirectory="tmp\bin32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName="$(OutDir)/TwGLCoreSDL.tlb"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
WarningLevel="4"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="false"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="false"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="SDL-1.3.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
ProgramDatabaseFile=""
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\sdl-1.3\lib\sdl.dll xcopy /y /f c:\sdk\sdl-1.3\lib\sdl.dll bin32\."
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="bin64"
IntermediateDirectory="tmp\bin64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
TypeLibraryName="$(OutDir)/TwGLCoreSDL.tlb"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;NDEBUG;_CONSOLE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
WarningLevel="4"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="false"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="false"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="SDL-1.3-64.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
ProgramDatabaseFile=""
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk-1.3\sdl\lib\sdl64.dll xcopy /y /f c:\sdk-1.3\sdl\lib\sdl64.dll bin64\."
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory="debug32"
IntermediateDirectory="tmp\debug32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName="$(OutDir)/TwGLCoreSDL.tlb"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
WarningLevel="4"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="SDL-1.3.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib/debug;../lib"
GenerateManifest="false"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk-1.3\sdl\lib\sdl.dll xcopy /y /f c:\sdk-1.3\sdl\lib\sdl.dll debug32\.&#x0D;&#x0A;if exist bin32\sdl-1.3.dll xcopy /y /f bin32\sdl-1.3.dll debug32\.&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="debug64"
IntermediateDirectory="tmp\debug64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
TypeLibraryName="$(OutDir)/TwGLCoreSDL.tlb"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64,_DEBUG,_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
WarningLevel="4"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="SDL-1.3-64.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib/debug;../lib"
GenerateManifest="false"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk-1.3\sdl\lib\sdl64.dll xcopy /y /f c:\sdk\sdl-1.3\lib\sdl64.dll debug64\.&#x0D;&#x0A;if exist bin64\sdl-1.3-64.dll xcopy /y /f bin64\sdl-1.3-64.dll debug64\.&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="TwGLCoreSDL.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/"
/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,300 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{3B5FCA22-D015-499E-8211-830ABC8F605B}</ProjectGuid>
<RootNamespace>TwGLCoreSDL</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin32\</OutDir>
<IntDir>tmp\bin32\$(ProjectName)\</IntDir>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>bin64\</OutDir>
<IntDir>tmp\bin64\$(ProjectName)\</IntDir>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>debug32\</OutDir>
<IntDir>tmp\debug32\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>debug64\</OutDir>
<IntDir>tmp\debug64\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Midl>
<TypeLibraryName>$(OutDir)TwGLCoreSDL.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<PrecompiledHeaderOutputFile />
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)vc70.pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>SDL-1.3.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<ProgramDatabaseFile />
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\sdl-1.3\lib\sdl.dll xcopy /y /f c:\sdk\sdl-1.3\lib\sdl.dll bin32\.</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
<TypeLibraryName>$(OutDir)TwGLCoreSDL.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<PrecompiledHeaderOutputFile />
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)vc70.pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>SDL-1.3-64.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<ProgramDatabaseFile />
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk-1.3\sdl\lib\sdl64.dll xcopy /y /f c:\sdk-1.3\sdl\lib\sdl64.dll bin64\.</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Midl>
<TypeLibraryName>$(OutDir)TwGLCoreSDL.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<PrecompiledHeaderOutputFile />
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)vc70.pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>SDL-1.3.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk-1.3\sdl\lib\sdl.dll xcopy /y /f c:\sdk-1.3\sdl\lib\sdl.dll debug32\.
if exist bin32\sdl-1.3.dll xcopy /y /f bin32\sdl-1.3.dll debug32\.
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
<TypeLibraryName>$(OutDir)TwGLCoreSDL.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<PrecompiledHeaderOutputFile />
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)vc70.pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>SDL-1.3-64.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk-1.3\sdl\lib\sdl64.dll xcopy /y /f c:\sdk\sdl-1.3\lib\sdl64.dll debug64\.
if exist bin64\sdl-1.3-64.dll xcopy /y /f bin64\sdl-1.3-64.dll debug64\.
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="TwGLCoreSDL.c">
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)</ObjectFileName>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,486 @@
// ---------------------------------------------------------------------------
//
// @file TwSimpleDX10.cpp
// @brief A simple example that uses AntTweakBar with DirectX10.
// This example draws a triangle and allow the user to tweak its
// vertex positions and colors.
//
// AntTweakBar: http://anttweakbar.sourceforge.net/doc
// DirectX: http://msdn.microsoft.com/directx
//
// @author Philippe Decaudin
//
// ---------------------------------------------------------------------------
#include <AntTweakBar.h>
#include <cmath>
#include "d3d10vs2003.h" // workaround to include D3D10.h with VS2003
#include <d3d10.h>
// D3D interface pointers
ID3D10Device * g_D3DDevice = NULL;
IDXGISwapChain * g_SwapChain = NULL;
DXGI_SWAP_CHAIN_DESC g_SwapChainDesc;
ID3D10RenderTargetView *g_RenderTargetView = NULL;
ID3D10Effect * g_Effect = NULL;
ID3D10EffectTechnique * g_Technique = NULL;
ID3D10InputLayout * g_VertexLayout = NULL;
ID3D10Buffer * g_VertexBuffer = NULL;
ID3D10BlendState * g_BlendState = NULL;
ID3D10RasterizerState * g_RasterState = NULL;
const int NB_VERTS = 3;
// Forward declarations
HRESULT InitDevice(HWND wnd);
HRESULT InitScene();
void Cleanup();
LRESULT CALLBACK MessageProc(HWND, UINT, WPARAM, LPARAM);
void Render();
// Variables
int g_Angle = 0;
float g_Scale = 1;
struct Point { float X, Y; };
Point g_Positions[NB_VERTS] = { {0.0f, 0.5f}, {0.5f, -0.5f}, {-0.5f, -0.5f} };
float g_Colors[NB_VERTS][4] = { {0, 1, 1, 1}, {1, 0, 1, 1}, {1, 1, 0, 1} };
// Main
int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int cmdShow)
{
// Register our window class
WNDCLASSEX wcex = { sizeof(WNDCLASSEX), CS_HREDRAW|CS_VREDRAW, MessageProc,
0L, 0L, instance, NULL, NULL, NULL, NULL, L"TwDX10", NULL };
RegisterClassEx(&wcex);
// Create a window
RECT rc = { 0, 0, 640, 480 };
AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, FALSE);
HWND wnd = CreateWindow(L"TwDX10", L"AntTweakBar simple example using DirectX10",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
rc.right-rc.left, rc.bottom-rc.top, NULL, NULL, instance, NULL);
if( !wnd )
{
MessageBox(NULL, L"Cannot create window", L"Error", MB_OK|MB_ICONERROR);
return 0;
}
// Initialize D3D10
if( FAILED(InitDevice(wnd)) )
{
Cleanup();
MessageBox(wnd, L"Cannot create D3D10 device", L"Error", MB_OK|MB_ICONERROR);
return 0;
}
// Initialize the 3D scene
if( FAILED(InitScene()) )
{
Cleanup();
MessageBox(wnd, L"Scene initialization failed.", L"Error", MB_OK|MB_ICONERROR);
return 0;
}
// Initialize AntTweakBar
if( !TwInit(TW_DIRECT3D10, g_D3DDevice) )
{
Cleanup();
MessageBoxA(wnd, TwGetLastError(), "AntTweakBar initialization failed", MB_OK|MB_ICONERROR);
return 0;
}
// Create a tweak bar
TwBar *bar = TwNewBar("TweakBar");
TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar in a DirectX10 application.' "); // Message added to the help bar.
// Add rotation and scale vars to bar
TwAddVarRW(bar, "Rotation", TW_TYPE_INT32, &g_Angle,
" KeyIncr=r KeyDecr=R Help='Rotates the triangle (angle in degree).' ");
TwAddVarRW(bar, "Scale", TW_TYPE_FLOAT, &g_Scale,
" Min=-2 Max=2 Step=0.01 KeyIncr=s KeyDecr=S Help='Scales the triangle (1=original size).' ");
// Create a new TwType to edit 2D points: a struct that contains two floats
TwStructMember pointMembers[] = {
{ "X", TW_TYPE_FLOAT, offsetof(Point, X), " Min=-1 Max=1 Step=0.01 " },
{ "Y", TW_TYPE_FLOAT, offsetof(Point, Y), " Min=-1 Max=1 Step=0.01 " } };
TwType pointType = TwDefineStruct("POINT", pointMembers, 2, sizeof(Point), NULL, NULL);
// Add color and position of the 3 vertices of the triangle
TwAddVarRW(bar, "Color0", TW_TYPE_COLOR4F, &g_Colors[0], " Alpha HLS Group='Vertex 0' Label=Color ");
TwAddVarRW(bar, "Pos0", pointType, &g_Positions[0], " Group='Vertex 0' Label='Position' ");
TwAddVarRW(bar, "Color1", TW_TYPE_COLOR4F, &g_Colors[1], " Alpha HLS Group='Vertex 1' Label=Color ");
TwAddVarRW(bar, "Pos1", pointType, &g_Positions[1], " Group='Vertex 1' Label='Position' ");
TwAddVarRW(bar, "Color2", TW_TYPE_COLOR4F, &g_Colors[2], " Alpha HLS Group='Vertex 2' Label=Color ");
TwAddVarRW(bar, "Pos2", pointType, &g_Positions[2], " Group='Vertex 2' Label='Position' ");
// Show and update the window
ShowWindow(wnd, cmdShow);
UpdateWindow(wnd);
// Main message loop.
// Passive loop: Content is repaint only when needed.
MSG msg = {0};
while( GetMessage(&msg, NULL, 0, 0) > 0 )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
TwTerminate();
Cleanup();
return (int)msg.wParam;
}
// Create Direct3D device and swap chain
HRESULT InitDevice(HWND wnd)
{
HRESULT hr = S_OK;
RECT rc;
GetClientRect(wnd, &rc);
UINT width = rc.right - rc.left;
UINT height = rc.bottom - rc.top;
UINT createDeviceFlags = 0;
#ifdef _DEBUG
createDeviceFlags |= D3D10_CREATE_DEVICE_DEBUG;
#endif
ZeroMemory(&g_SwapChainDesc, sizeof(g_SwapChainDesc));
g_SwapChainDesc.BufferCount = 1;
g_SwapChainDesc.BufferDesc.Width = width;
g_SwapChainDesc.BufferDesc.Height = height;
g_SwapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
g_SwapChainDesc.BufferDesc.RefreshRate.Numerator = 60;
g_SwapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
g_SwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
g_SwapChainDesc.OutputWindow = wnd;
g_SwapChainDesc.SampleDesc.Count = 1;
g_SwapChainDesc.SampleDesc.Quality = 0;
g_SwapChainDesc.Windowed = TRUE;
g_SwapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
// Try to create a hardware accelerated device first
hr = D3D10CreateDeviceAndSwapChain(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, createDeviceFlags,
D3D10_SDK_VERSION, &g_SwapChainDesc, &g_SwapChain, &g_D3DDevice);
if( FAILED(hr) )
{
// If failed, try to create a reference device
hr = D3D10CreateDeviceAndSwapChain(NULL, D3D10_DRIVER_TYPE_REFERENCE, NULL, createDeviceFlags,
D3D10_SDK_VERSION, &g_SwapChainDesc, &g_SwapChain, &g_D3DDevice);
if( SUCCEEDED(hr) )
MessageBox(wnd, L"No DX10 hardware acceleration found.\nSwitching to REFERENCE driver (very slow).",
L"Warning", MB_OK|MB_ICONWARNING);
else
return hr;
}
// Create a render target view
ID3D10Texture2D *buffer;
hr = g_SwapChain->GetBuffer( 0, __uuidof( ID3D10Texture2D ), (LPVOID*)&buffer );
if( FAILED(hr) )
return hr;
hr = g_D3DDevice->CreateRenderTargetView( buffer, NULL, &g_RenderTargetView );
buffer->Release();
if( FAILED(hr) )
return hr;
g_D3DDevice->OMSetRenderTargets( 1, &g_RenderTargetView, NULL );
// Setup the viewport
D3D10_VIEWPORT vp;
vp.Width = width;
vp.Height = height;
vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f;
vp.TopLeftX = 0;
vp.TopLeftY = 0;
g_D3DDevice->RSSetViewports( 1, &vp );
return S_OK;
}
// Initialize the 3D objects & effects
HRESULT InitScene()
{
HRESULT hr = S_OK;
// Create effect
DWORD shaderFlags = D3D10_SHADER_ENABLE_STRICTNESS;
#if defined( DEBUG ) || defined( _DEBUG )
// shaderFlags |= D3D10_SHADER_DEBUG;
#endif
// DX10 requires shaders (no fixed function anymore). We will read the shaders from the following string.
char shaderFX[] = " struct PSInput { float4 Pos : SV_POSITION; float4 Col : COLOR0; }; \n"
" PSInput VertShad(float4 pos : POSITION, float4 col : COLOR) { \n"
" PSInput ps; ps.Pos=pos; ps.Col=col; return ps; } \n"
" float4 PixShad(PSInput input) : SV_Target { return input.Col; } \n"
" technique10 Render { pass P0 { \n"
" SetVertexShader( CompileShader( vs_4_0, VertShad() ) ); \n"
" SetGeometryShader( NULL ); \n"
" SetPixelShader( CompileShader( ps_4_0, PixShad() ) ); \n"
" } }\n";
ID3D10Blob *compiledFX = NULL;
ID3D10Blob *errors = NULL;
hr = D3D10CompileEffectFromMemory(shaderFX, strlen(shaderFX), "TestDX10",
NULL, NULL, shaderFlags, 0, &compiledFX, &errors);
if( FAILED(hr) )
{
char *errMsg = static_cast<char *>(errors->GetBufferPointer());
errMsg[errors->GetBufferSize()-1] = '\0';
MessageBoxA( NULL, errMsg, "Effect compilation failed", MB_OK|MB_ICONERROR );
errors->Release();
return hr;
}
hr = D3D10CreateEffectFromMemory(compiledFX->GetBufferPointer(), compiledFX->GetBufferSize(),
0, g_D3DDevice, NULL, &g_Effect);
compiledFX->Release();
if( FAILED( hr ) )
{
MessageBox( NULL, L"Effect creation failed", L"Error", MB_OK );
return hr;
}
// Obtain the technique
g_Technique = g_Effect->GetTechniqueByName("Render");
// Define the input layout
D3D10_INPUT_ELEMENT_DESC layout[] =
{
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 3*sizeof(float), D3D10_INPUT_PER_VERTEX_DATA, 0 }
};
// Create the input layout
D3D10_PASS_DESC passDesc;
g_Technique->GetPassByIndex(0)->GetDesc(&passDesc);
hr = g_D3DDevice->CreateInputLayout(layout, sizeof(layout)/sizeof(layout[0]), passDesc.pIAInputSignature,
passDesc.IAInputSignatureSize, &g_VertexLayout);
if( FAILED( hr ) )
return hr;
const int VERTEX_SIZE = (3 + 4)*sizeof(float); // 3 floats for POSITION + 4 floats for COLOR
// Set the input layout
g_D3DDevice->IASetInputLayout(g_VertexLayout);
// Create vertex buffer
D3D10_BUFFER_DESC bd;
bd.Usage = D3D10_USAGE_DYNAMIC;
bd.ByteWidth = VERTEX_SIZE * NB_VERTS;
bd.BindFlags = D3D10_BIND_VERTEX_BUFFER;
bd.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
bd.MiscFlags = 0;
hr = g_D3DDevice->CreateBuffer(&bd, NULL, &g_VertexBuffer);
if( FAILED( hr ) )
return hr;
// Set vertex buffer
UINT stride = VERTEX_SIZE;
UINT offset = 0;
g_D3DDevice->IASetVertexBuffers(0, 1, &g_VertexBuffer, &stride, &offset);
// Set primitive topology
g_D3DDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
// Blend state
D3D10_BLEND_DESC bsd;
bsd.AlphaToCoverageEnable = FALSE;
for(int i=0; i<8; ++i)
{
bsd.BlendEnable[i] = TRUE;
bsd.RenderTargetWriteMask[i] = D3D10_COLOR_WRITE_ENABLE_ALL;
}
bsd.SrcBlend = D3D10_BLEND_SRC_ALPHA;
bsd.DestBlend = D3D10_BLEND_INV_SRC_ALPHA;
bsd.BlendOp = D3D10_BLEND_OP_ADD;
bsd.SrcBlendAlpha = D3D10_BLEND_SRC_ALPHA;
bsd.DestBlendAlpha = D3D10_BLEND_INV_SRC_ALPHA;
bsd.BlendOpAlpha = D3D10_BLEND_OP_ADD;
g_D3DDevice->CreateBlendState(&bsd, &g_BlendState);
float blendFactors[4] = { 1, 1, 1, 1 };
g_D3DDevice->OMSetBlendState(g_BlendState, blendFactors, 0xffffffff);
// Rasterizer state
D3D10_RASTERIZER_DESC rs;
ZeroMemory(&rs, sizeof(rs));
rs.FillMode = D3D10_FILL_SOLID;
rs.CullMode = D3D10_CULL_NONE;
g_D3DDevice->CreateRasterizerState(&rs, &g_RasterState);
g_D3DDevice->RSSetState(g_RasterState);
return S_OK;
}
// Clean up D3D objects
void Cleanup()
{
if( g_D3DDevice )
g_D3DDevice->ClearState();
if( g_BlendState )
g_BlendState->Release();
if( g_RasterState )
g_RasterState->Release();
if( g_VertexBuffer )
g_VertexBuffer->Release();
if( g_VertexLayout )
g_VertexLayout->Release();
if( g_Effect )
g_Effect->Release();
if( g_RenderTargetView )
g_RenderTargetView->Release();
if( g_SwapChain && g_SwapChainDesc.Windowed )
g_SwapChain->Release();
if( g_D3DDevice )
g_D3DDevice->Release();
}
// Called every time the application receives a message
LRESULT CALLBACK MessageProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lParam)
{
// Send event message to AntTweakBar
if( TwEventWin(wnd, message, wParam, lParam) )
{
// Event has been handled by AntTweakBar.
// Note: TwEventWin send a WM_PAINT in this case and
// the window will be repaint next time.
return 0;
}
switch(message)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
BeginPaint(wnd, &ps);
if( g_D3DDevice )
Render();
EndPaint(wnd, &ps);
}
return 0;
case WM_SIZE: // Window size has been changed
if( g_D3DDevice ) // Resize D3D render target
{
// Release render target
ID3D10RenderTargetView *nullRTV = NULL;
g_D3DDevice->OMSetRenderTargets(1, &nullRTV, NULL);
if( g_RenderTargetView )
{
g_RenderTargetView->Release();
g_RenderTargetView = NULL;
}
if( g_SwapChain )
{
// Resize swap chain
g_SwapChainDesc.BufferDesc.Width = LOWORD(lParam);
g_SwapChainDesc.BufferDesc.Height = HIWORD(lParam);
g_SwapChain->ResizeBuffers(g_SwapChainDesc.BufferCount, g_SwapChainDesc.BufferDesc.Width,
g_SwapChainDesc.BufferDesc.Height, g_SwapChainDesc.BufferDesc.Format, g_SwapChainDesc.Flags);
// Re-create a render target view
ID3D10Texture2D *buffer;
g_SwapChain->GetBuffer(0, __uuidof( ID3D10Texture2D ), (LPVOID*)&buffer);
g_D3DDevice->CreateRenderTargetView(buffer, NULL, &g_RenderTargetView);
buffer->Release();
g_D3DDevice->OMSetRenderTargets(1, &g_RenderTargetView, NULL);
// Setup the viewport
D3D10_VIEWPORT vp;
vp.Width = g_SwapChainDesc.BufferDesc.Width;
vp.Height = g_SwapChainDesc.BufferDesc.Height;
vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f;
vp.TopLeftX = 0;
vp.TopLeftY = 0;
g_D3DDevice->RSSetViewports(1, &vp);
}
// TwWindowSize has been called by TwEventWin32, so it is not necessary to call it again here.
}
return 0;
case WM_CHAR:
if( wParam==VK_ESCAPE )
PostQuitMessage(0);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(wnd, message, wParam, lParam);
}
}
// Render scene
void Render()
{
// Update the vertex buffer
float a = (float)g_Angle * (3.14159265358979f/180.0f);
float ca = cosf(a);
float sa = sinf(a);
float ratio = (float)g_SwapChainDesc.BufferDesc.Height/g_SwapChainDesc.BufferDesc.Width;
float *vertices;
g_VertexBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, (void **)&vertices);
// Vertex 0 (3 floats for POSITION + 4 floats for COLOR)
vertices[0*7 + 0] = g_Scale*(ca*g_Positions[0].X - sa*g_Positions[0].Y)*ratio;
vertices[0*7 + 1] = g_Scale*(sa*g_Positions[0].X + ca*g_Positions[0].Y);
vertices[0*7 + 2] = 0;
vertices[0*7 + 3] = g_Colors[0][0];
vertices[0*7 + 4] = g_Colors[0][1];
vertices[0*7 + 5] = g_Colors[0][2];
vertices[0*7 + 6] = g_Colors[0][3];
// Vertex 1 (3 floats for POSITION + 4 floats for COLOR)
vertices[1*7 + 0] = g_Scale*(ca*g_Positions[1].X - sa*g_Positions[1].Y)*ratio;
vertices[1*7 + 1] = g_Scale*(sa*g_Positions[1].X + ca*g_Positions[1].Y);
vertices[1*7 + 2] = 0;
vertices[1*7 + 3] = g_Colors[1][0];
vertices[1*7 + 4] = g_Colors[1][1];
vertices[1*7 + 5] = g_Colors[1][2];
vertices[1*7 + 6] = g_Colors[1][3];
// Vertex 2 (3 floats for POSITION + 4 floats for COLOR)
vertices[2*7 + 0] = g_Scale*(ca*g_Positions[2].X - sa*g_Positions[2].Y)*ratio;
vertices[2*7 + 1] = g_Scale*(sa*g_Positions[2].X + ca*g_Positions[2].Y);
vertices[2*7 + 2] = 0;
vertices[2*7 + 3] = g_Colors[2][0];
vertices[2*7 + 4] = g_Colors[2][1];
vertices[2*7 + 5] = g_Colors[2][2];
vertices[2*7 + 6] = g_Colors[2][3];
g_VertexBuffer->Unmap();
// Clear the back buffer
float clearColor[4] = {0.125f, 0.125f, 0.3f, 1.0f};
g_D3DDevice->ClearRenderTargetView(g_RenderTargetView, clearColor);
// Render a triangle
D3D10_TECHNIQUE_DESC techDesc;
g_Technique->GetDesc(&techDesc);
for( UINT p=0; p<techDesc.Passes; ++p )
{
g_Technique->GetPassByIndex(p)->Apply(0);
g_D3DDevice->Draw(3, 0);
}
// Draw tweak bars
TwDraw();
// Present the information rendered to the back buffer to the front buffer (the screen)
g_SwapChain->Present(0, 0);
}

View File

@@ -0,0 +1,380 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="TwSimpleDX10"
ProjectGUID="{6B412E54-70AC-40D3-903F-F5CD73FC3D51}"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="debug32"
IntermediateDirectory="tmp\debug32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d10.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="../lib/debug,../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="debug64"
IntermediateDirectory="tmp\debug64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d10.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="../lib/debug,../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="bin32"
IntermediateDirectory="tmp\bin32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d10.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="bin64"
IntermediateDirectory="tmp\bin64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;NDEBUG;_WINDOWS"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d10.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="TwSimpleDX10.cpp"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,224 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{6B412E54-70AC-40D3-903F-F5CD73FC3D51}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>debug32\</OutDir>
<IntDir>tmp\debug32\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>debug64\</OutDir>
<IntDir>tmp\debug64\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin32\</OutDir>
<IntDir>tmp\bin32\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>bin64\</OutDir>
<IntDir>tmp\bin64\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d10.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d10.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat />
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>d3d10.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat />
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>d3d10.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="TwSimpleDX10.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,985 @@
// ---------------------------------------------------------------------------
//
// @file TwSimpleDX11.cpp
//
// @brief Example that uses AntTweakBar with DirectX11.
//
// It draws a Menger sponge, aka Sierpinski cube:
// http://en.wikipedia.org/wiki/Menger_sponge .
//
// Cubes shading is augmented with some simple ambient occlusion
// applied by subdividing each cube face into a 3x3 grid.
// AntTweakBar is used to add some interacitve controls.
//
// Note that most of the code here is related to DirectX and
// Menger sponge generation. AntTweakBar calls are localized
// in the WinMain function.
//
// AntTweakBar: http://anttweakbar.sourceforge.net/doc
// DirectX: http://msdn.microsoft.com/directx
//
// @author Philippe Decaudin
//
// ---------------------------------------------------------------------------
#include <AntTweakBar.h>
#include <cmath>
#include <vector>
#include <cassert>
#include "d3d10vs2003.h" // workaround to include D3D10.h and D3D11.h with VS2003
#include <d3d11.h>
// Shaders:
// Vertex and pixel shaders are defined in TwSimpleDX11.hlsl and are compiled
// in a pre-build step using the fxc.exe compiler (from the DirectX SDK Aug'09 or later).
// Pre-build commands are:
// fxc /T vs_4_0_level_9_1 /E MainVS /Fh $(IntDir)\TwSimpleDX11_VS.h TwSimpleDX11.hlsl
// fxc /T ps_4_0_level_9_1 /E MainPS /Fh $(IntDir)\TwSimpleDX11_PS.h TwSimpleDX11.hlsl
//
#include "TwSimpleDX11_VS.h"
#include "TwSimpleDX11_PS.h"
// D3D objects
ID3D11Device * g_D3DDev = NULL;
ID3D11DeviceContext * g_D3DDevCtx = NULL;
IDXGISwapChain * g_SwapChain = NULL;
DXGI_SWAP_CHAIN_DESC g_SwapChainDesc;
ID3D11RenderTargetView *g_RenderTargetView = NULL;
ID3D11DepthStencilView *g_DepthStencilView = NULL;
D3D11_TEXTURE2D_DESC g_DepthStencilDesc;
ID3D11VertexShader * g_VertexShader = NULL;
ID3D11PixelShader * g_PixelShader = NULL;
ID3D11InputLayout * g_InputLayout = NULL;
ID3D11Buffer * g_VertexBuffer = NULL;
ID3D11Buffer * g_IndexBuffer = NULL;
ID3D11BlendState * g_BlendState = NULL;
ID3D11DepthStencilState*g_DepthStencilState = NULL;
ID3D11RasterizerState * g_RasterState = NULL;
ID3D11Buffer * g_ConstantBuffer = NULL;
// Geometry data structures and objects
struct Vector3
{
float v[3];
static Vector3 ZERO;
};
Vector3 Vector3::ZERO = { 0, 0, 0 };
struct Matrix4x4
{
float m[4][4];
static Matrix4x4 IDENTITY;
};
Matrix4x4 Matrix4x4::IDENTITY = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
struct Quaternion
{
float q[4];
static Quaternion IDENTITY;
};
Quaternion Quaternion::IDENTITY = { 0, 0, 0, 1 };
const float FLOAT_PI = 3.14159265f;
struct Vertex
{
Vector3 Position;
Vector3 Normal;
unsigned int AmbientColor;
};
struct ShaderConstants
{
Matrix4x4 WorldViewProj;
Matrix4x4 WorldNorm;
Vector3 LightDir;
float LightCoeff;
};
// Each cube face is split into a 3x3 grid
const int CUBE_FACE_VERTEX_COUNT = 4 * 4; // 16 vertices per face
const int CUBE_FACE_TRIANGLE_COUNT = 2 * 3 * 3; // 18 triangles to be drawn for each face
// Faces color of the sponge wrt to recursion level
const unsigned int COLORS[] = { 0xffffffff, 0xff007fff, 0xff7fff00, 0xffff007f, 0xff0000ff, 0xff00ff00, 0xffff0000 };
// Scene globals
Quaternion g_SpongeRotation; // model rotation, set by InitScene
int g_SpongeLevel = 2; // number of recursions
bool g_SpongeAO = true; // apply ambient occlusion
unsigned int g_SpongeIndicesCount = 0; // set by BuildSponge
Vector3 g_LightDir = {-0.5f, -0.2f, 1}; // light direction vector
float g_CamDistance = 0.7f; // camera distance
float g_BackgroundColor[] = {0, 0, 0.5f, 1}; // background color
bool g_Animate = true; // enable animation
float g_AnimationSpeed = 0.2f; // animation speed
// Some math operators and functions.
// They are defined here to avoid linking with D3DX.
Vector3 operator+(const Vector3& a, const Vector3& b)
{
Vector3 out;
out.v[0] = a.v[0] + b.v[0];
out.v[1] = a.v[1] + b.v[1];
out.v[2] = a.v[2] + b.v[2];
return out;
}
Vector3 operator*(float s, const Vector3& a)
{
Vector3 out;
out.v[0] = s * a.v[0];
out.v[1] = s * a.v[1];
out.v[2] = s * a.v[2];
return out;
}
float Length(const Vector3& a)
{
return sqrt(a.v[0]*a.v[0] + a.v[1]*a.v[1] + a.v[2]*a.v[2]);
}
Matrix4x4 Projection(float fov, float aspectRatio, float zNear, float zFar) // Left-handed projection
{
Matrix4x4 out;
float yScale = 1.0f / tan(fov / 2.0f);
float xScale = yScale / aspectRatio;
out.m[0][0] = xScale;
out.m[0][1] = out.m[0][2] = out.m[0][3] = 0;
out.m[1][1] = yScale;
out.m[1][0] = out.m[1][2] = out.m[1][3] = 0;
out.m[2][0] = out.m[2][1] = 0;
out.m[2][2] = zFar / (zFar - zNear);
out.m[2][3] = 1;
out.m[3][0] = out.m[3][1] = out.m[3][3] = 0;
out.m[3][2] = - zNear * zFar / (zFar - zNear);
return out;
}
Matrix4x4 Translation(const Vector3& t)
{
Matrix4x4 out(Matrix4x4::IDENTITY);
out.m[3][0] = t.v[0];
out.m[3][1] = t.v[1];
out.m[3][2] = t.v[2];
return out;
}
Matrix4x4 Scale(float s)
{
Matrix4x4 out(Matrix4x4::IDENTITY);
out.m[0][0] = out.m[1][1] = out.m[2][2] = s;
return out;
}
Matrix4x4 operator*(const Matrix4x4& a, const Matrix4x4& b)
{
Matrix4x4 out(Matrix4x4::IDENTITY);
int i, j;
for (i = 0; i < 4; i++)
for (j = 0; j < 4; j++)
out.m[i][j] = a.m[i][0]*b.m[0][j] + a.m[i][1]*b.m[1][j] + a.m[i][2]*b.m[2][j] + a.m[i][3]*b.m[3][j];
return out;
}
Vector3 operator*(const Vector3& p, const Matrix4x4& a)
{
Vector3 out;
float rw = 1.f / (p.v[0]*a.m[0][3] + p.v[1]*a.m[1][3] + p.v[2]*a.m[2][3] + a.m[3][3]);
out.v[0] = rw * (p.v[0]*a.m[0][0] + p.v[1]*a.m[1][0] + p.v[2]*a.m[2][0] + a.m[3][0]);
out.v[1] = rw * (p.v[0]*a.m[0][1] + p.v[1]*a.m[1][1] + p.v[2]*a.m[2][1] + a.m[3][1]);
out.v[2] = rw * (p.v[0]*a.m[0][2] + p.v[1]*a.m[1][2] + p.v[2]*a.m[2][2] + a.m[3][2]);
return out;
}
Quaternion RotationFromAxisAngle(const Vector3& axis, float angle)
{
Quaternion out;
float norm = Length(axis);
float sina2 = sin(0.5f * angle);
out.q[0] = sina2 * axis.v[0] / norm;
out.q[1] = sina2 * axis.v[1] / norm;
out.q[2] = sina2 * axis.v[2] / norm;
out.q[3] = cos(0.5f * angle);
return out;
}
void AxisAngleFromRotation(Vector3& outAxis, float& outAngle, const Quaternion& quat)
{
float sina2 = sqrt(quat.q[0]*quat.q[0] + quat.q[1]*quat.q[1] + quat.q[2]*quat.q[2]);
outAngle = 2.0f * atan2(sina2, quat.q[3]);
float r = (sina2 > 0) ? (1.0f / sina2) : 0;
outAxis.v[0] = r * quat.q[0];
outAxis.v[1] = r * quat.q[1];
outAxis.v[2] = r * quat.q[2];
}
Matrix4x4 QuaternionToMatrix(const Quaternion& quat)
{
Matrix4x4 out;
float yy2 = 2.0f * quat.q[1] * quat.q[1];
float xy2 = 2.0f * quat.q[0] * quat.q[1];
float xz2 = 2.0f * quat.q[0] * quat.q[2];
float yz2 = 2.0f * quat.q[1] * quat.q[2];
float zz2 = 2.0f * quat.q[2] * quat.q[2];
float wz2 = 2.0f * quat.q[3] * quat.q[2];
float wy2 = 2.0f * quat.q[3] * quat.q[1];
float wx2 = 2.0f * quat.q[3] * quat.q[0];
float xx2 = 2.0f * quat.q[0] * quat.q[0];
out.m[0][0] = - yy2 - zz2 + 1.0f;
out.m[0][1] = xy2 + wz2;
out.m[0][2] = xz2 - wy2;
out.m[0][3] = 0;
out.m[1][0] = xy2 - wz2;
out.m[1][1] = - xx2 - zz2 + 1.0f;
out.m[1][2] = yz2 + wx2;
out.m[1][3] = 0;
out.m[2][0] = xz2 + wy2;
out.m[2][1] = yz2 - wx2;
out.m[2][2] = - xx2 - yy2 + 1.0f;
out.m[2][3] = 0;
out.m[3][0] = out.m[3][1] = out.m[3][2] = 0;
out.m[3][3] = 1;
return out;
}
// Forward declarations
HRESULT InitDevice(HWND wnd);
HRESULT InitScene();
void Cleanup();
LRESULT CALLBACK MessageProc(HWND, UINT, WPARAM, LPARAM);
void Anim();
void Render();
HRESULT BuildSponge(int levelMax, bool aoEnabled);
// Callback function called by AntTweakBar to set the sponge recursion level
void TW_CALL SetSpongeLevelCB(const void *value, void * /*clientData*/)
{
g_SpongeLevel = *static_cast<const int *>(value);
BuildSponge(g_SpongeLevel, g_SpongeAO);
}
// Callback function called by AntTweakBar to get the sponge recursion level
void TW_CALL GetSpongeLevelCB(void *value, void * /*clientData*/)
{
*static_cast<int *>(value) = g_SpongeLevel;
}
// Callback function called by AntTweakBar to enable/disable ambient occlusion
void TW_CALL SetSpongeAOCB(const void *value, void * /*clientData*/)
{
g_SpongeAO = *static_cast<const bool *>(value);
BuildSponge(g_SpongeLevel, g_SpongeAO);
}
// Callback function called by AntTweakBar to get ambient occlusion state
void TW_CALL GetSpongeAOCB(void *value, void * /*clientData*/)
{
*static_cast<bool *>(value) = g_SpongeAO;
}
// Main
int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int cmdShow)
{
// Register our window class
WNDCLASSEX wcex = { sizeof(WNDCLASSEX), CS_HREDRAW|CS_VREDRAW, MessageProc,
0L, 0L, instance, NULL, NULL, NULL, NULL, L"TwDX11", NULL };
RegisterClassEx(&wcex);
// Create a window
RECT rc = { 0, 0, 640, 480 };
AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, FALSE);
HWND wnd = CreateWindow(L"TwDX11", L"AntTweakBar simple example using DirectX11",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
rc.right-rc.left, rc.bottom-rc.top, NULL, NULL, instance, NULL);
if (!wnd)
{
MessageBox(NULL, L"Cannot create window", L"Error", MB_OK|MB_ICONERROR);
return 0;
}
ShowWindow(wnd, cmdShow);
UpdateWindow(wnd);
// Initialize D3D11
if (FAILED(InitDevice(wnd)))
{
MessageBox(wnd, L"Cannot create D3D11 device", L"Error", MB_OK|MB_ICONERROR);
Cleanup();
return 0;
}
// Initialize the 3D scene
if (FAILED(InitScene()))
{
MessageBox(wnd, L"Scene initialization failed.", L"Error", MB_OK|MB_ICONERROR);
Cleanup();
return 0;
}
// Initialize AntTweakBar
if (!TwInit(TW_DIRECT3D11, g_D3DDev))
{
MessageBoxA(wnd, TwGetLastError(), "AntTweakBar initialization failed", MB_OK|MB_ICONERROR);
Cleanup();
return 0;
}
// Create a tweak bar
TwBar *bar = TwNewBar("TweakBar");
TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar into a DirectX11 application.' "); // Message added to the help bar.
int barSize[2] = {224, 320};
TwSetParam(bar, NULL, "size", TW_PARAM_INT32, 2, barSize);
// Add variables to the tweak bar
TwAddVarCB(bar, "Level", TW_TYPE_INT32, SetSpongeLevelCB, GetSpongeLevelCB, NULL, "min=0 max=3 group=Sponge keyincr=l keydecr=L");
TwAddVarCB(bar, "Ambient Occlusion", TW_TYPE_BOOLCPP, SetSpongeAOCB, GetSpongeAOCB, NULL, "group=Sponge key=o");
TwAddVarRW(bar, "Rotation", TW_TYPE_QUAT4F, &g_SpongeRotation, "opened=true axisz=-z group=Sponge");
TwAddVarRW(bar, "Animation", TW_TYPE_BOOLCPP, &g_Animate, "group=Sponge key=a");
TwAddVarRW(bar, "Animation speed", TW_TYPE_FLOAT, &g_AnimationSpeed, "min=-10 max=10 step=0.1 group=Sponge keyincr=+ keydecr=-");
TwAddVarRW(bar, "Light direction", TW_TYPE_DIR3F, &g_LightDir, "opened=true axisz=-z showval=false");
TwAddVarRW(bar, "Camera distance", TW_TYPE_FLOAT, &g_CamDistance, "min=0 max=4 step=0.01 keyincr=PGUP keydecr=PGDOWN");
TwAddVarRW(bar, "Background", TW_TYPE_COLOR4F, &g_BackgroundColor, "colormode=hls");
// Main message loop
MSG msg = {0};
while (WM_QUIT != msg.message)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
Anim();
Render();
}
}
TwTerminate();
Cleanup();
return (int)msg.wParam;
}
// Create Direct3D device and swap chain
HRESULT InitDevice(HWND wnd)
{
HRESULT hr = S_OK;
// Get window size
RECT rc;
GetClientRect(wnd, &rc);
UINT width = rc.right - rc.left;
UINT height = rc.bottom - rc.top;
// Create D3D11 device and swap chain
UINT createDeviceFlags = 0;
#ifdef _DEBUG
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
ZeroMemory(&g_SwapChainDesc, sizeof(g_SwapChainDesc));
g_SwapChainDesc.BufferCount = 1;
g_SwapChainDesc.BufferDesc.Width = width;
g_SwapChainDesc.BufferDesc.Height = height;
g_SwapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
g_SwapChainDesc.BufferDesc.RefreshRate.Numerator = 0;
g_SwapChainDesc.BufferDesc.RefreshRate.Denominator = 0;
g_SwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
g_SwapChainDesc.OutputWindow = wnd;
g_SwapChainDesc.SampleDesc.Count = 4;
g_SwapChainDesc.SampleDesc.Quality = 0;
g_SwapChainDesc.Windowed = TRUE;
g_SwapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
// Try to create a hardware accelerated device with multisample antialiasing first
hr = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, createDeviceFlags,
NULL, 0, D3D11_SDK_VERSION, &g_SwapChainDesc, &g_SwapChain,
&g_D3DDev, NULL, &g_D3DDevCtx);
if (FAILED(hr))
{
// If failed, try without antialiasing
g_SwapChainDesc.SampleDesc.Count = 1;
hr = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, createDeviceFlags,
NULL, 0, D3D11_SDK_VERSION, &g_SwapChainDesc, &g_SwapChain,
&g_D3DDev, NULL, &g_D3DDevCtx);
if (FAILED(hr))
{
// If failed, try to create a reference device
hr = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_REFERENCE, NULL, createDeviceFlags,
NULL, 0, D3D11_SDK_VERSION, &g_SwapChainDesc, &g_SwapChain,
&g_D3DDev, NULL, &g_D3DDevCtx);
if (SUCCEEDED(hr))
MessageBox(wnd, L"No DX11 hardware acceleration found.\nSwitching to REFERENCE driver (very slow).",
L"Warning", MB_OK|MB_ICONWARNING);
else
return hr;
}
}
// Create a render target and depth-stencil view
ID3D11Texture2D *backBuffer = NULL, *dsBuffer = NULL;
hr = g_SwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBuffer);
if (FAILED(hr))
return hr;
hr = g_D3DDev->CreateRenderTargetView(backBuffer, NULL, &g_RenderTargetView);
backBuffer->Release();
if (FAILED(hr))
return hr;
g_DepthStencilDesc.Width = width;
g_DepthStencilDesc.Height = height;
g_DepthStencilDesc.MipLevels = 1;
g_DepthStencilDesc.ArraySize = 1;
g_DepthStencilDesc.Format = DXGI_FORMAT_D16_UNORM;
g_DepthStencilDesc.SampleDesc = g_SwapChainDesc.SampleDesc;
g_DepthStencilDesc.Usage = D3D11_USAGE_DEFAULT;
g_DepthStencilDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
g_DepthStencilDesc.CPUAccessFlags = 0;
g_DepthStencilDesc.MiscFlags = 0;
hr = g_D3DDev->CreateTexture2D(&g_DepthStencilDesc, NULL, &dsBuffer);
if (FAILED(hr))
return hr;
hr = g_D3DDev->CreateDepthStencilView(dsBuffer, NULL, &g_DepthStencilView);
dsBuffer->Release();
if (FAILED(hr))
return hr;
g_D3DDevCtx->OMSetRenderTargets(1, &g_RenderTargetView, g_DepthStencilView);
// Setup the viewport
D3D11_VIEWPORT vp;
vp.Width = (float)width;
vp.Height = (float)height;
vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f;
vp.TopLeftX = 0;
vp.TopLeftY = 0;
g_D3DDevCtx->RSSetViewports(1, &vp);
return S_OK;
}
// Initialize the 3D objects & shaders
HRESULT InitScene()
{
HRESULT hr;
// Define the input layout
D3D11_INPUT_ELEMENT_DESC layout[] =
{
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, offsetof(Vertex, Position), D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, offsetof(Vertex, Normal), D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, offsetof(Vertex, AmbientColor), D3D11_INPUT_PER_VERTEX_DATA, 0 }
};
hr = g_D3DDev->CreateInputLayout(layout, sizeof(layout)/sizeof(layout[0]), g_MainVS, sizeof(g_MainVS), &g_InputLayout);
if (FAILED(hr))
return hr;
// Set the input layout
g_D3DDevCtx->IASetInputLayout(g_InputLayout);
// Create shaders
hr = g_D3DDev->CreateVertexShader(g_MainVS, sizeof(g_MainVS), NULL, &g_VertexShader);
if (FAILED(hr))
return hr;
hr = g_D3DDev->CreatePixelShader(g_MainPS, sizeof(g_MainPS), NULL, &g_PixelShader);
if (FAILED(hr))
return hr;
// Set shaders
g_D3DDevCtx->VSSetShader(g_VertexShader, NULL, 0);
g_D3DDevCtx->PSSetShader(g_PixelShader, NULL, 0);
// Create vertex and index buffers
hr = BuildSponge(g_SpongeLevel, g_SpongeAO);
if (FAILED(hr))
return hr;
// Create constant buffer
D3D11_BUFFER_DESC bd;
bd.Usage = D3D11_USAGE_DYNAMIC;
bd.ByteWidth = sizeof(ShaderConstants);
bd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
bd.MiscFlags = 0;
bd.StructureByteStride = 0;
hr = g_D3DDev->CreateBuffer(&bd, NULL, &g_ConstantBuffer);
if (FAILED(hr))
return hr;
// Blend state
D3D11_BLEND_DESC bsd;
bsd.AlphaToCoverageEnable = FALSE;
bsd.IndependentBlendEnable = FALSE;
for (int i = 0; i < 8; i++)
{
bsd.RenderTarget[i].BlendEnable = TRUE;
bsd.RenderTarget[i].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
bsd.RenderTarget[i].SrcBlend = D3D11_BLEND_SRC_ALPHA;
bsd.RenderTarget[i].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
bsd.RenderTarget[i].BlendOp = D3D11_BLEND_OP_ADD;
bsd.RenderTarget[i].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA;
bsd.RenderTarget[i].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
bsd.RenderTarget[i].BlendOpAlpha = D3D11_BLEND_OP_ADD;
}
g_D3DDev->CreateBlendState(&bsd, &g_BlendState);
float blendFactors[4] = { 1, 1, 1, 1 };
g_D3DDevCtx->OMSetBlendState(g_BlendState, blendFactors, 0xffffffff);
// Depth-stencil state
D3D11_DEPTH_STENCILOP_DESC od;
od.StencilFunc = D3D11_COMPARISON_ALWAYS;
od.StencilFailOp = D3D11_STENCIL_OP_KEEP;
od.StencilPassOp = D3D11_STENCIL_OP_KEEP;
od.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
D3D11_DEPTH_STENCIL_DESC dsd;
dsd.DepthEnable = TRUE;
dsd.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
dsd.DepthFunc = D3D11_COMPARISON_LESS_EQUAL;
dsd.StencilEnable = FALSE;
dsd.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
dsd.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
dsd.FrontFace = od;
dsd.BackFace = od;
g_D3DDev->CreateDepthStencilState(&dsd, &g_DepthStencilState);
g_D3DDevCtx->OMSetDepthStencilState(g_DepthStencilState, 0);
// Rasterizer state
D3D11_RASTERIZER_DESC rs;
ZeroMemory(&rs, sizeof(rs));
rs.FillMode = D3D11_FILL_SOLID;
rs.CullMode = D3D11_CULL_NONE;
rs.MultisampleEnable = (g_SwapChainDesc.SampleDesc.Count > 0);
g_D3DDev->CreateRasterizerState(&rs, &g_RasterState);
g_D3DDevCtx->RSSetState(g_RasterState);
// Init model rotation
Vector3 axis = {-1, 1, 0};
g_SpongeRotation = RotationFromAxisAngle(axis, FLOAT_PI/4);
return S_OK;
}
// Clean up D3D objects
void Cleanup()
{
#define RELEASE_CHECK(p) if (p) { ULONG rc = (p)->Release(); assert(rc == 0); (void)rc; (p) = NULL; }
if (g_D3DDevCtx)
g_D3DDevCtx->ClearState();
RELEASE_CHECK(g_BlendState);
RELEASE_CHECK(g_DepthStencilState);
RELEASE_CHECK(g_RasterState);
RELEASE_CHECK(g_VertexBuffer);
RELEASE_CHECK(g_IndexBuffer);
RELEASE_CHECK(g_ConstantBuffer);
RELEASE_CHECK(g_InputLayout);
RELEASE_CHECK(g_VertexShader);
RELEASE_CHECK(g_PixelShader);
RELEASE_CHECK(g_RenderTargetView);
RELEASE_CHECK(g_DepthStencilView);
if (g_SwapChainDesc.Windowed)
RELEASE_CHECK(g_SwapChain);
RELEASE_CHECK(g_D3DDevCtx);
RELEASE_CHECK(g_D3DDev);
}
// Called every time the application receives a message
LRESULT CALLBACK MessageProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lParam)
{
// Send event message to AntTweakBar
if (TwEventWin(wnd, message, wParam, lParam))
return 0; // Event has been handled by AntTweakBar
switch (message)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
BeginPaint(wnd, &ps);
EndPaint(wnd, &ps);
return 0;
}
case WM_SIZE: // Window size has been changed
if (g_D3DDev) // Resize D3D render target
{
// Release render target and depth-stencil view
ID3D11RenderTargetView *nullRTV = NULL;
g_D3DDevCtx->OMSetRenderTargets(1, &nullRTV, NULL);
if (g_RenderTargetView)
{
g_RenderTargetView->Release();
g_RenderTargetView = NULL;
}
if (g_DepthStencilView)
{
g_DepthStencilView->Release();
g_DepthStencilView = NULL;
}
if (g_SwapChain)
{
// Resize swap chain
g_SwapChainDesc.BufferDesc.Width = LOWORD(lParam);
g_SwapChainDesc.BufferDesc.Height = HIWORD(lParam);
g_SwapChain->ResizeBuffers(g_SwapChainDesc.BufferCount, g_SwapChainDesc.BufferDesc.Width,
g_SwapChainDesc.BufferDesc.Height, g_SwapChainDesc.BufferDesc.Format,
g_SwapChainDesc.Flags);
// Re-create a render target and depth-stencil view
ID3D11Texture2D *backBuffer = NULL, *dsBuffer = NULL;
g_SwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBuffer);
g_D3DDev->CreateRenderTargetView(backBuffer, NULL, &g_RenderTargetView);
backBuffer->Release();
g_DepthStencilDesc.Width = g_SwapChainDesc.BufferDesc.Width;
g_DepthStencilDesc.Height = g_SwapChainDesc.BufferDesc.Height;
g_D3DDev->CreateTexture2D(&g_DepthStencilDesc, NULL, &dsBuffer);
g_D3DDev->CreateDepthStencilView(dsBuffer, NULL, &g_DepthStencilView);
dsBuffer->Release();
g_D3DDevCtx->OMSetRenderTargets(1, &g_RenderTargetView, g_DepthStencilView);
// Setup the viewport
D3D11_VIEWPORT vp;
vp.Width = (float)g_SwapChainDesc.BufferDesc.Width;
vp.Height = (float)g_SwapChainDesc.BufferDesc.Height;
vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f;
vp.TopLeftX = 0;
vp.TopLeftY = 0;
g_D3DDevCtx->RSSetViewports(1, &vp);
}
// TwWindowSize has been called by TwEventWin, so it is not necessary to call it again here.
}
return 0;
case WM_CHAR:
if (wParam == VK_ESCAPE)
PostQuitMessage(0);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(wnd, message, wParam, lParam);
}
}
// Append vertices and indices of a cube to the index and vertex buffers.
// The cube has gradient ambient-occlusion defined per edge.
void AppendCubeToBuffers(std::vector<Vertex>& vertices, std::vector<unsigned int>& indices,
const Matrix4x4& xform, float aoRatio, const bool aoEdges[12],
const unsigned int faceColors[6])
{
unsigned int indicesOffset = (unsigned int)vertices.size();
// Fill vertex buffer
// Cube faces and edges numbering:
// __________ _____6____
// / /| /| /|
// / 4 / |<2 10 5 9 |
// /_________/ | /__|__2___/ 7
// | | 1| | |___4__|__|
// 3>| 0 | / 3 / 1 /
// | | / | 11 | 8
// |_________|/ |/____0___|/
// 5^
// Each face is split in a 3x3 grid, which gives 16 vertices per face and 3x3x2(=18) triangles per face.
// Ambient occlusion color is set for each of these vertices wrt aoEdges flags.
const float R = 0.5f; // unit cube radius
// the 4 corner coordinates for each of the 6 faces
const Vector3 A[6] = { {-R, -R, -R}, {+R, -R, -R}, {+R, -R, +R}, {-R, -R, +R}, {-R, +R, -R}, {-R, -R, -R} };
const Vector3 B[6] = { {+R, -R, -R}, {+R, -R, +R}, {-R, -R, +R}, {-R, -R, -R}, {+R, +R, -R}, {+R, -R, -R} };
const Vector3 C[6] = { {-R, +R, -R}, {+R, +R, -R}, {+R, +R, +R}, {-R, +R, +R}, {-R, +R, +R}, {-R, -R, +R} };
const Vector3 D[6] = { {+R, +R, -R}, {+R, +R, +R}, {-R, +R, +R}, {-R, +R, -R}, {+R, +R, +R}, {+R, -R, +R} };
// the 6 face normals
const Vector3 N[6] = { { 0, 0, -1}, {+1, 0, 0}, { 0, 0, +1}, {-1, 0, 0}, { 0, +1, 0}, { 0, -1, 0} };
// association between edge indices and the 6 faces
const int E[6][4] = { {0, 1, 2, 3}, {8, 7, 9, 1}, {4, 5, 6, 7}, {11, 3, 10, 5}, {2, 9, 6, 10}, {0, 8, 4, 11} };
int face, i, j;
float u, v;
bool ao;
Vertex vertex;
for (face = 0; face < 6; face++)
for (j = 0; j < 4; j++)
{
v = (j == 1) ? aoRatio : ((j == 2) ? 1.0f - aoRatio : j/3);
for (i = 0; i < 4; i++)
{
u = (i == 1) ? aoRatio : ((i == 2) ? 1.0f - aoRatio : i/3);
vertex.Position = (1.0f - v) * ((1.0f - u) * A[face] + u * B[face])
+ v * ((1.0f - u) * C[face] + u * D[face]);
vertex.Position = vertex.Position * xform;
vertex.Normal = N[face];
ao = (j == 0) && aoEdges[E[face][0]];
ao |= (i == 3) && aoEdges[E[face][1]];
ao |= (j == 3) && aoEdges[E[face][2]];
ao |= (i == 0) && aoEdges[E[face][3]];
#define DARKEN(r, s) ( (unsigned int)(float(r)*(s)) > 255 ? 255 : (unsigned int)(float(r)*(s)) )
#define DARKEN_COLOR(c, s) ( 0xff000000 | (DARKEN(((c)>>16)&0xff, s)<<16) | (DARKEN(((c)>>8)&0xff, s)<<8) | DARKEN((c)&0xff, s) )
vertex.AmbientColor = ao ? DARKEN_COLOR(faceColors[face], 0.75f) : faceColors[face];
vertices.push_back(vertex);
}
}
// Fill index buffer
// 3 indices per triangle, 2*3*3 triangles per faces, 6 faces.
// Vertex index numbering of each face:
// 12__13__14___15
// |'. | .'| .'|
// 8__'9'_10'__11
// | .'| .'| .'|
// 4'__5'__6'__7
// | .'| .'|'. |
// 0'__1'__2__'3
const unsigned short I[CUBE_FACE_TRIANGLE_COUNT][3] =
{
{0, 5, 4}, {0, 1, 5}, {1, 6, 5}, {1, 2, 6}, {3, 6, 2}, {3, 7, 6},
{4, 9, 8}, {4, 5, 9}, {5, 10, 9}, {5, 6, 10}, {6, 11, 10}, {6, 7, 11},
{8, 9, 12}, {9, 13, 12}, {9, 14, 13}, {9, 10, 14}, {10, 15, 14}, {10, 11, 15}
};
int tri;
for (face = 0; face < 6; face++)
for (tri = 0; tri < CUBE_FACE_TRIANGLE_COUNT; tri++)
for (i = 0; i < 3; i++)
indices.push_back(indicesOffset + I[tri][i] + 16*face); // 16 vertices per face
}
// Recursive function called to fill the vertex and index buffers with the cubes forming the Menger sponge.
void FillSpongeBuffers(int level, int levelMax, std::vector<Vertex>& vertices, std::vector<unsigned int>& indices,
const Vector3& center, bool aoEnabled, const bool aoEdges[12], const unsigned int faceColors[6])
{
float scale = pow(1.0f/3.0f, level);
if (level == levelMax)
{
float aoRatio = pow(3.0f, level) * 0.02f;
if (aoRatio > 0.4999f)
aoRatio = 0.4999f;
Matrix4x4 xform = Scale(scale) * Translation(center);
AppendCubeToBuffers(vertices, indices, xform, aoRatio, aoEdges, faceColors);
}
else
{
// Local function which applies AO in one direction
struct Local
{
static void ApplyAO(int i, int j, bool& e0, bool& e1, bool& e2, bool& e3)
{
if (i == -1 && j == 0) e0 = e1 = true;
if (i == +1 && j <= 0) e1 = false;
if (i == +1 && j >= 0) e0 = false;
if (i == +1 && j == 0) e2 = e3 = true;
if (i == -1 && j <= 0) e2 = false;
if (i == -1 && j >= 0) e3 = false;
if (j == -1 && i == 0) e1 = e2 = true;
if (j == +1 && i <= 0) e1 = false;
if (j == +1 && i >= 0) e2 = false;
if (j == +1 && i == 0) e0 = e3 = true;
if (j == -1 && i <= 0) e0 = false;
if (j == -1 && i >= 0) e3 = false;
}
};
bool aoEdgesCopy[12];
unsigned int faceColorsCopy[6];
int i, j, k, l;
for (i = -1; i <= 1; i++)
for (j = -1; j <= 1; j++)
for (k = -1; k <= 1; k++)
if ( !( (i == 0 && j == 0) || (i == 0 && k == 0) || (j == 0 && k == 0) ) )
{
float s = 1.0f/3.0f * scale;
Vector3 t = { center.v[0] + s * i, center.v[1] + s * j, center.v[2] + s * k };
for (l = 0; l < 12; l++)
aoEdgesCopy[l] = aoEdges[l];
if (aoEnabled)
{
Local::ApplyAO( i, j, aoEdgesCopy[8], aoEdgesCopy[9], aoEdgesCopy[10], aoEdgesCopy[11]); // z direction
Local::ApplyAO( i, k, aoEdgesCopy[1], aoEdgesCopy[7], aoEdgesCopy[5], aoEdgesCopy[3] ); // y direction
Local::ApplyAO(-k, j, aoEdgesCopy[0], aoEdgesCopy[2], aoEdgesCopy[6], aoEdgesCopy[4] ); // x direction
}
for (l = 0; l < 6; l++)
faceColorsCopy[l] = faceColors[l];
if (k == +1) faceColorsCopy[0] = COLORS[level+1];
if (i == -1) faceColorsCopy[1] = COLORS[level+1];
if (k == -1) faceColorsCopy[2] = COLORS[level+1];
if (i == +1) faceColorsCopy[3] = COLORS[level+1];
if (j == -1) faceColorsCopy[4] = COLORS[level+1];
if (j == +1) faceColorsCopy[5] = COLORS[level+1];
FillSpongeBuffers(level + 1, levelMax, vertices, indices, t, aoEnabled, aoEdgesCopy, faceColorsCopy);
}
}
}
// Build sponge vertex and index buffers
HRESULT BuildSponge(int levelMax, bool aoEnabled)
{
if (g_VertexBuffer)
g_VertexBuffer->Release();
if (g_IndexBuffer)
g_IndexBuffer->Release();
g_SpongeIndicesCount = 0;
// Fill vertex and index memory buffers
static std::vector<Vertex> vertices;
static std::vector<unsigned int> indices;
vertices.clear();
indices.clear();
bool aoEdges[12] = { false, false, false, false, false, false, false, false, false, false, false, false };
unsigned int faceColors[6] = { COLORS[0], COLORS[0], COLORS[0], COLORS[0], COLORS[0], COLORS[0] };
FillSpongeBuffers(0, levelMax, vertices, indices, Vector3::ZERO, aoEnabled, aoEdges, faceColors);
// Create vertex buffer
D3D11_BUFFER_DESC bd;
bd.Usage = D3D11_USAGE_IMMUTABLE;
bd.ByteWidth = (UINT)vertices.size() * sizeof(Vertex);
bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
bd.CPUAccessFlags = 0;
bd.MiscFlags = 0;
bd.StructureByteStride = 0;
D3D11_SUBRESOURCE_DATA initData;
initData.pSysMem = &vertices[0];
initData.SysMemPitch = 0;
initData.SysMemSlicePitch = 0;
HRESULT hr = g_D3DDev->CreateBuffer(&bd, &initData, &g_VertexBuffer);
if (FAILED(hr))
return hr;
// Create index buffer
bd.ByteWidth = (UINT)indices.size() * sizeof(unsigned int);
bd.BindFlags = D3D11_BIND_INDEX_BUFFER;
initData.pSysMem = &indices[0];
hr = g_D3DDev->CreateBuffer(&bd, &initData, &g_IndexBuffer);
if (FAILED(hr))
{
g_VertexBuffer->Release();
return hr;
}
g_SpongeIndicesCount = (unsigned int)indices.size();
return S_OK;
}
// Render the sponge
void DrawSponge()
{
if (g_SpongeIndicesCount == 0)
return;
// Set vertex buffer
UINT stride = sizeof(Vertex);
UINT offset = 0;
g_D3DDevCtx->IASetVertexBuffers(0, 1, &g_VertexBuffer, &stride, &offset);
// Set index buffer
g_D3DDevCtx->IASetIndexBuffer(g_IndexBuffer, DXGI_FORMAT_R32_UINT, 0);
// Set primitive topology
g_D3DDevCtx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
// Set shaders
g_D3DDevCtx->VSSetShader(g_VertexShader, NULL, 0);
g_D3DDevCtx->PSSetShader(g_PixelShader, NULL, 0);
// Render the primitives
g_D3DDevCtx->DrawIndexed(g_SpongeIndicesCount, 0, 0);
}
// Copy world/view/proj matrices and light parameters to shader constants
void SetShaderConstants(const Matrix4x4& world, const Matrix4x4& view, const Matrix4x4& proj)
{
D3D11_MAPPED_SUBRESOURCE mappedResource;
HRESULT hr = g_D3DDevCtx->Map(g_ConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (SUCCEEDED(hr))
{
ShaderConstants *cst = (ShaderConstants *)mappedResource.pData;
cst->WorldViewProj = world * view * proj;
cst->WorldNorm = world;
cst->LightDir = (1.0f / Length(g_LightDir)) * g_LightDir;
cst->LightCoeff = 0.85f;
g_D3DDevCtx->Unmap(g_ConstantBuffer, 0);
}
g_D3DDevCtx->VSSetConstantBuffers(0, 1, &g_ConstantBuffer);
}
// Render a frame
void Render()
{
// Clear the back buffer
g_D3DDevCtx->ClearRenderTargetView(g_RenderTargetView, g_BackgroundColor);
g_D3DDevCtx->ClearDepthStencilView(g_DepthStencilView, D3D11_CLEAR_DEPTH, 1, 0);
// Set world/view/proj matrices and global shader constants
float aspectRatio = (float)g_DepthStencilDesc.Width / g_DepthStencilDesc.Height;
Matrix4x4 proj = Projection(FLOAT_PI/4, aspectRatio, 0.1f, 100.0f);
float dist = g_CamDistance + 0.4f;
Vector3 camPosInv = { dist * 0.3f, dist * 0.0f, dist * 2.0f };
Matrix4x4 view = Translation(camPosInv);
Matrix4x4 world = QuaternionToMatrix(g_SpongeRotation);
SetShaderConstants(world, view, proj);
// Draw the sponge
DrawSponge();
// Draw tweak bars
TwDraw();
// Present the information rendered in the back buffer to the front buffer (the screen)
g_SwapChain->Present(0, 0);
}
// Rotating sponge
void Anim()
{
static DWORD s_PrevTick = GetTickCount();
DWORD tick = GetTickCount(); // msec
float dt = float(tick - s_PrevTick) / 1000.0f; // sec
if (g_Animate && dt > 0 && dt < 0.2f)
{
Vector3 axis = Vector3::ZERO;
float angle = 0;
AxisAngleFromRotation(axis, angle, g_SpongeRotation);
if (Length(axis) < 1.0e-6f)
axis.v[1] = 1;
angle += g_AnimationSpeed * dt;
if (angle >= 2.0f*FLOAT_PI)
angle -= 2.0f*FLOAT_PI;
else if (angle <= 0)
angle += 2.0f*FLOAT_PI;
g_SpongeRotation = RotationFromAxisAngle(axis, angle);
}
s_PrevTick = tick;
}

View File

@@ -0,0 +1,35 @@
// ---------------------------------------------------------------------------
//
// @file TwSimpleDX11.hlsl
// @brief Shaders used by the TwSimpleDX11 example
//
// ---------------------------------------------------------------------------
cbuffer Constants : register(b0)
{
row_major float4x4 g_WorldViewProj;
row_major float4x4 g_WorldNorm;
float3 g_LightDir;
float g_LightCoeff;
};
struct PSInput
{
float4 Pos : SV_POSITION;
float4 Color : COLOR0;
};
PSInput MainVS(float4 pos : POSITION, float3 norm : NORMAL, float4 color : COLOR)
{
PSInput ps;
ps.Pos = mul(pos, g_WorldViewProj);
float3 n = normalize(mul(float4(norm, 0), g_WorldNorm).xyz);
ps.Color.rgb = color.rgb * ((1 - g_LightCoeff) + g_LightCoeff * dot(n, -g_LightDir));
ps.Color.a = color.a;
return ps;
}
float4 MainPS(PSInput input) : SV_TARGET
{
return input.Color;
}

View File

@@ -0,0 +1,422 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="TwSimpleDX11"
ProjectGUID="{6D417E54-50AC-40D3-913A-35CD73F93D51}"
RootNamespace="TwSimpleDX11"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="debug32"
IntermediateDirectory="tmp\debug32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="1"
EnableManagedIncrementalBuild="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="fxc /Od /Zi /T vs_4_0_level_9_1 /E MainVS /Fh $(IntDir)\TwSimpleDX11_VS.h TwSimpleDX11.hlsl&#x0D;&#x0A;fxc /Od /Zi /T ps_4_0_level_9_1 /E MainPS /Fh $(IntDir)\TwSimpleDX11_PS.h TwSimpleDX11.hlsl&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include;$(IntDir)"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_HAS_ITERATOR_DEBUGGING=0;_SECURE_SCL=0"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d11.lib dxgi.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories="../lib/debug,../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="debug64"
IntermediateDirectory="tmp\debug64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="fxc /Od /Zi /T vs_4_0_level_9_1 /E MainVS /Fh $(IntDir)\TwSimpleDX11_VS.h TwSimpleDX11.hlsl&#x0D;&#x0A;fxc /Od /Zi /T ps_4_0_level_9_1 /E MainPS /Fh $(IntDir)\TwSimpleDX11_PS.h TwSimpleDX11.hlsl&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include;$(IntDir)"
PreprocessorDefinitions="WIN64;_DEBUG;_WINDOWS;_HAS_ITERATOR_DEBUGGING=0;_SECURE_SCL=0"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d11.lib dxgi.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories="../lib/debug,../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="bin32"
IntermediateDirectory="tmp\bin32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="fxc /T vs_4_0_level_9_1 /E MainVS /Fh $(IntDir)\TwSimpleDX11_VS.h TwSimpleDX11.hlsl&#x0D;&#x0A;fxc /T ps_4_0_level_9_1 /E MainPS /Fh $(IntDir)\TwSimpleDX11_PS.h TwSimpleDX11.hlsl&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include;$(IntDir)"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_HAS_ITERATOR_DEBUGGING=0;_SECURE_SCL=0"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d11.lib dxgi.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="bin64"
IntermediateDirectory="tmp\bin64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="fxc /T vs_4_0_level_9_1 /E MainVS /Fh $(IntDir)\TwSimpleDX11_VS.h TwSimpleDX11.hlsl&#x0D;&#x0A;fxc /T ps_4_0_level_9_1 /E MainPS /Fh $(IntDir)\TwSimpleDX11_PS.h TwSimpleDX11.hlsl&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include;$(IntDir)"
PreprocessorDefinitions="WIN64;NDEBUG;_WINDOWS;_HAS_ITERATOR_DEBUGGING=0;_SECURE_SCL=0"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d11.lib dxgi.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="TwSimpleDX11.cpp"
>
</File>
<File
RelativePath=".\TwSimpleDX11.hlsl"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,254 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{6D417E54-50AC-40D3-913A-35CD73F93D51}</ProjectGuid>
<RootNamespace>TwSimpleDX11</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>debug32\</OutDir>
<IntDir>tmp\debug32\$(ProjectName)\</IntDir>
<EnableManagedIncrementalBuild>true</EnableManagedIncrementalBuild>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>debug64\</OutDir>
<IntDir>tmp\debug64\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin32\</OutDir>
<IntDir>tmp\bin32\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>bin64\</OutDir>
<IntDir>tmp\bin64\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command>fxc /Od /Zi /T vs_4_0_level_9_1 /E MainVS /Fh $(IntDir)TwSimpleDX11_VS.h TwSimpleDX11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E MainPS /Fh $(IntDir)TwSimpleDX11_PS.h TwSimpleDX11.hlsl
</Command>
</PreBuildEvent>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_HAS_ITERATOR_DEBUGGING=0;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d11.lib;dxgi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PreBuildEvent>
<Command>fxc /Od /Zi /T vs_4_0_level_9_1 /E MainVS /Fh $(IntDir)TwSimpleDX11_VS.h TwSimpleDX11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E MainPS /Fh $(IntDir)TwSimpleDX11_PS.h TwSimpleDX11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_HAS_ITERATOR_DEBUGGING=0;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d11.lib;dxgi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Command>fxc /T vs_4_0_level_9_1 /E MainVS /Fh $(IntDir)TwSimpleDX11_VS.h TwSimpleDX11.hlsl
fxc /T ps_4_0_level_9_1 /E MainPS /Fh $(IntDir)TwSimpleDX11_PS.h TwSimpleDX11.hlsl
</Command>
</PreBuildEvent>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_HAS_ITERATOR_DEBUGGING=0;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat />
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>d3d11.lib;dxgi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PreBuildEvent>
<Command>fxc /T vs_4_0_level_9_1 /E MainVS /Fh $(IntDir)TwSimpleDX11_VS.h TwSimpleDX11.hlsl
fxc /T ps_4_0_level_9_1 /E MainPS /Fh $(IntDir)TwSimpleDX11_PS.h TwSimpleDX11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_HAS_ITERATOR_DEBUGGING=0;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat />
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>d3d11.lib;dxgi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="TwSimpleDX11.cpp" />
</ItemGroup>
<ItemGroup>
<FxCompile Include="TwSimpleDX11.hlsl">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</FxCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,261 @@
// ---------------------------------------------------------------------------
//
// @file TwSimpleDX9.cpp
// @brief A simple example that uses AntTweakBar with DirectX9
//
// AntTweakBar: http://anttweakbar.sourceforge.net/doc
// DirectX: http://msdn.microsoft.com/directx
//
// @author Philippe Decaudin
// @date 2006/05/20
//
// ---------------------------------------------------------------------------
#include <AntTweakBar.h>
#include <d3d9.h>
//#include <dxerr9.h>
#include <math.h>
// Direct3D structures
IDirect3D9 * g_D3D = NULL;
IDirect3DDevice9 * g_D3DDev = NULL;
D3DPRESENT_PARAMETERS g_D3Dpp;
// D3D states initialization function
void InitD3D()
{
// Set viewport
D3DVIEWPORT9 vp = {0,0, g_D3Dpp.BackBufferWidth,g_D3Dpp.BackBufferHeight, 0,1};
g_D3DDev->SetViewport(&vp);
// Set D3D matrices
D3DMATRIX matId = { 1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 };
g_D3DDev->SetTransform(D3DTS_WORLD, &matId);
g_D3DDev->SetTransform(D3DTS_VIEW, &matId);
D3DMATRIX matProj = { (float)g_D3Dpp.BackBufferHeight/g_D3Dpp.BackBufferWidth,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 };
g_D3DDev->SetTransform(D3DTS_PROJECTION, &matProj);
// Disable lighting and culling
g_D3DDev->SetRenderState( D3DRS_LIGHTING, FALSE );
g_D3DDev->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
g_D3DDev->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
}
// Win32 MessageProc callback
LRESULT CALLBACK MessageProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
// Send event message to AntTweakBar
if( TwEventWin(wnd, msg, wParam, lParam) )
return 0; // Event has been handled by AntTweakBar
switch( msg )
{
case WM_CHAR:
if( wParam==VK_ESCAPE )
PostQuitMessage(0);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
case WM_SIZE: // Window size has been changed
// Reset D3D device
if( g_D3DDev )
{
g_D3Dpp.BackBufferWidth = LOWORD(lParam);
g_D3Dpp.BackBufferHeight = HIWORD(lParam);
if( g_D3Dpp.BackBufferWidth>0 && g_D3Dpp.BackBufferHeight>0 )
{
g_D3DDev->Reset(&g_D3Dpp);
InitD3D(); // re-initialize D3D states
}
// TwWindowSize has been called by TwEventWin32,
// so it is not necessary to call it again here.
}
return 0;
default:
return DefWindowProc(wnd, msg, wParam, lParam);
}
}
// Main
int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int cmdShow)
{
// Register our window class
WNDCLASSEX wcex = { sizeof(WNDCLASSEX), CS_CLASSDC|CS_DBLCLKS, MessageProc, 0L, 0L,
instance, NULL, NULL, NULL, NULL, "TwDX9", NULL };
RegisterClassEx(&wcex);
// Create a window
const int W = 640;
const int H = 480;
BOOL fullscreen = FALSE; // Set to TRUE to run in fullscreen
RECT rect = { 0, 0, W, H };
DWORD style = fullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW;
AdjustWindowRect(&rect, style, FALSE);
HWND wnd = CreateWindow("TwDX9", "AntTweakBar simple example using DirectX9",
style, CW_USEDEFAULT, CW_USEDEFAULT,
rect.right-rect.left, rect.bottom-rect.top, NULL, NULL, instance, NULL);
if( !wnd )
{
MessageBox(NULL, "Cannot create window", "Error", MB_OK|MB_ICONERROR);
return FALSE;
}
ShowWindow(wnd, cmdShow);
UpdateWindow(wnd);
// Initialize Direct3D
g_D3D = Direct3DCreate9(D3D_SDK_VERSION);
if( !g_D3D )
{
MessageBox(wnd, "Cannot initialize DirectX", "Error", MB_OK|MB_ICONERROR);
return FALSE;
}
// Create a Direct3D device
ZeroMemory( &g_D3Dpp, sizeof(D3DPRESENT_PARAMETERS) );
g_D3Dpp.Windowed = !fullscreen;
if( fullscreen )
{
g_D3Dpp.BackBufferWidth = W;
g_D3Dpp.BackBufferHeight = H;
}
g_D3Dpp.BackBufferCount = 1;
g_D3Dpp.SwapEffect = D3DSWAPEFFECT_FLIP;
if( fullscreen )
g_D3Dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
else
g_D3Dpp.BackBufferFormat = D3DFMT_UNKNOWN;
g_D3Dpp.hDeviceWindow = wnd;
g_D3Dpp.EnableAutoDepthStencil = TRUE;
g_D3Dpp.AutoDepthStencilFormat = D3DFMT_D16;
g_D3Dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
HRESULT hr = g_D3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &g_D3Dpp, &g_D3DDev);
if( FAILED(hr) )
{
//DXTRACE_ERR_MSGBOX("Cannot create DirectX device", hr);
MessageBox(wnd, "Cannot create DirectX device", "Error", MB_OK|MB_ICONERROR);
g_D3D->Release();
g_D3D = NULL;
return FALSE;
}
// This example draws a moving strip;
// create a buffer of vertices for the strip
struct Vertex
{
float x, y, z;
DWORD color;
};
Vertex vertices[2002];
int numSec = 100; // number of strip sections
float color[] = { 1, 0, 0 }; // strip color
unsigned int bgColor = D3DCOLOR_ARGB(255, 128, 196, 196); // background color
// Init some D3D states
InitD3D();
// Initialize AntTweakBar
// (note that the Direct3D device pointer must be passed to TwInit)
if( !TwInit(TW_DIRECT3D9, g_D3DDev) )
{
MessageBox(wnd, TwGetLastError(), "Cannot initialize AntTweakBar", MB_OK|MB_ICONERROR);
g_D3DDev->Release();
g_D3DDev = NULL;
g_D3D->Release();
g_D3D = NULL;
return FALSE;
}
// Create a tweak bar
TwBar *bar = TwNewBar("TweakBar");
TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar in a DirectX9 application.' "); // Message added to the help bar.
TwDefine(" TweakBar color='128 224 160' text=dark "); // Change TweakBar color and use dark text
// Add 'numSec' to 'bar': it is a modifiable (RW) variable of type TW_TYPE_INT32. Its shortcuts are [s] and [S].
TwAddVarRW(bar, "NumSec", TW_TYPE_INT32, &numSec,
" label='Strip length' min=1 max=1000 keyIncr=s keyDecr=S help='Number of segments of the strip.' ");
// Add 'color' to 'bar': it is a modifiable variable of type TW_TYPE_COLOR3F (3 floats color)
TwAddVarRW(bar, "Color", TW_TYPE_COLOR3F, &color, " label='Strip color' ");
// Add 'bgColor' to 'bar': it is a modifiable variable of type TW_TYPE_COLOR32 (32 bits color)
TwAddVarRW(bar, "BgColor", TW_TYPE_COLOR32, &bgColor, " label='Background color' ");
// Add 'width' and 'height' to 'bar': they are read-only (RO) variables of type TW_TYPE_INT32.
TwAddVarRO(bar, "Width", TW_TYPE_INT32, &g_D3Dpp.BackBufferWidth,
" label='wnd width' help='Current graphics window width.' ");
TwAddVarRO(bar, "Height", TW_TYPE_INT32, &g_D3Dpp.BackBufferHeight,
" label='wnd height' help='Current graphics window height.' ");
// Main loop
bool quit = false;
DWORD t0 = GetTickCount();
while( !quit )
{
// Clear screen and begin draw
g_D3DDev->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, bgColor, 1.0f, 0);
g_D3DDev->BeginScene();
// Draw scene
float s, t = (float)(GetTickCount() - t0)/1000.0f;
for( int i=0; i<=numSec; ++i ) // update vertices
{
s = (float)i/100;
vertices[2*i+0].x = 0.05f+0.7f*cosf(2.0f*s+5.0f*t);
vertices[2*i+1].x = vertices[2*i+0].x + (0.25f+0.1f*cosf(s+t));
vertices[2*i+0].y = vertices[2*i+1].y = 0.7f*(0.7f+0.3f*sinf(s+t))*sinf(1.5f*s+3.0f*t);
vertices[2*i+0].z = vertices[2*i+1].z = 0;
s = (float)i/numSec;
vertices[2*i+0].color = vertices[2*i+1].color =
D3DCOLOR_XRGB((int)(255*color[0]*s), (int)(255*color[1]*s), (int)(255*color[2]*s));
}
g_D3DDev->SetFVF(D3DFVF_XYZ|D3DFVF_DIFFUSE);
g_D3DDev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2*numSec, vertices, sizeof(Vertex)); // draw strip
// Draw tweak bars
TwDraw();
// End draw
g_D3DDev->EndScene();
// Present frame buffer
g_D3DDev->Present(NULL, NULL, NULL, NULL);
// Process windows messages
MSG msg;
while( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) )
{
if( msg.message==WM_QUIT )
quit = true;
else if( !TranslateAccelerator(msg.hwnd, NULL, &msg) )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
} // End of main loop
// Terminate AntTweakBar
TwTerminate();
// Release Direct3D
g_D3DDev->Release();
g_D3DDev = NULL;
g_D3D->Release();
g_D3D = NULL;
return 0;
}

View File

@@ -0,0 +1,380 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="TwSimpleDX9"
ProjectGUID="{6B414E54-701C-4ED3-9034-F5CD7BFC3451}"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="debug32"
IntermediateDirectory="tmp\debug32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="../lib/debug,../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="debug64"
IntermediateDirectory="tmp\debug64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="../lib/debug,../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="bin32"
IntermediateDirectory="tmp\bin32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="bin64"
IntermediateDirectory="tmp\bin64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;NDEBUG;_WINDOWS"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3d9.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="TwSimpleDX9.cpp"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,224 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{6B414E54-701C-4ED3-9034-F5CD7BFC3451}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>debug32\</OutDir>
<IntDir>tmp\debug32\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>debug64\</OutDir>
<IntDir>tmp\debug64\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin32\</OutDir>
<IntDir>tmp\bin32\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>bin64\</OutDir>
<IntDir>tmp\bin64\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat />
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat />
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="TwSimpleDX9.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,202 @@
// ---------------------------------------------------------------------------
//
// @file TwSimpleGLFW.c
// @brief A simple example that uses AntTweakBar with
// OpenGL and the GLFW windowing system.
//
// AntTweakBar: http://anttweakbar.sourceforge.net/doc
// OpenGL: http://www.opengl.org
// GLFW: http://www.glfw.org
//
// @author Philippe Decaudin
// @date 2006/05/20
//
// ---------------------------------------------------------------------------
#include <AntTweakBar.h>
#define GLFW_DLL
#include "glfw.h"
#include <stdio.h>
// Callback function called by GLFW when window size changes
void GLFWCALL WindowSizeCB(int width, int height)
{
// Set OpenGL viewport and camera
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(40, (double)width/height, 1, 10);
gluLookAt(-1,0,3, 0,0,0, 0,1,0);
// Send the new window size to AntTweakBar
TwWindowSize(width, height);
}
// This example program draws a possibly transparent cube
void DrawModel(int wireframe)
{
int pass, numPass;
// Enable OpenGL transparency and light (could have been done once at init)
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHT0); // use default light diffuse and position
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 1);
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
glEnable(GL_LINE_SMOOTH);
glLineWidth(3.0);
if( wireframe )
{
glDisable(GL_CULL_FACE);
glDisable(GL_LIGHTING);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
numPass = 1;
}
else
{
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
numPass = 2;
}
for( pass=0; pass<numPass; ++pass )
{
// Since the material could be transparent, we draw the convex model in 2 passes:
// first its back faces, and second its front faces.
glCullFace( (pass==0) ? GL_FRONT : GL_BACK );
// Draw the model (a cube)
glBegin(GL_QUADS);
glNormal3f(0,0,-1); glVertex3f(0,0,0); glVertex3f(0,1,0); glVertex3f(1,1,0); glVertex3f(1,0,0); // front face
glNormal3f(0,0,+1); glVertex3f(0,0,1); glVertex3f(1,0,1); glVertex3f(1,1,1); glVertex3f(0,1,1); // back face
glNormal3f(-1,0,0); glVertex3f(0,0,0); glVertex3f(0,0,1); glVertex3f(0,1,1); glVertex3f(0,1,0); // left face
glNormal3f(+1,0,0); glVertex3f(1,0,0); glVertex3f(1,1,0); glVertex3f(1,1,1); glVertex3f(1,0,1); // right face
glNormal3f(0,-1,0); glVertex3f(0,0,0); glVertex3f(1,0,0); glVertex3f(1,0,1); glVertex3f(0,0,1); // bottom face
glNormal3f(0,+1,0); glVertex3f(0,1,0); glVertex3f(0,1,1); glVertex3f(1,1,1); glVertex3f(1,1,0); // top face
glEnd();
}
}
// Main
int main()
{
GLFWvidmode mode; // GLFW video mode
TwBar *bar; // Pointer to a tweak bar
double time = 0, dt;// Current time and enlapsed time
double turn = 0; // Model turn counter
double speed = 0.3; // Model rotation speed
int wire = 0; // Draw model in wireframe?
float bgColor[] = { 0.1f, 0.2f, 0.4f }; // Background color
unsigned char cubeColor[] = { 255, 0, 0, 128 }; // Model color (32bits RGBA)
// Intialize GLFW
if( !glfwInit() )
{
// An error occured
fprintf(stderr, "GLFW initialization failed\n");
return 1;
}
// Create a window
glfwGetDesktopMode(&mode);
if( !glfwOpenWindow(640, 480, mode.RedBits, mode.GreenBits, mode.BlueBits,
0, 16, 0, GLFW_WINDOW /* or GLFW_FULLSCREEN */) )
{
// A fatal error occured
fprintf(stderr, "Cannot open GLFW window\n");
glfwTerminate();
return 1;
}
glfwEnable(GLFW_MOUSE_CURSOR);
glfwEnable(GLFW_KEY_REPEAT);
glfwSetWindowTitle("AntTweakBar simple example using GLFW");
// Initialize AntTweakBar
TwInit(TW_OPENGL, NULL);
// Create a tweak bar
bar = TwNewBar("TweakBar");
TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar with GLFW and OpenGL.' "); // Message added to the help bar.
// Add 'speed' to 'bar': it is a modifable (RW) variable of type TW_TYPE_DOUBLE. Its key shortcuts are [s] and [S].
TwAddVarRW(bar, "speed", TW_TYPE_DOUBLE, &speed,
" label='Rot speed' min=0 max=2 step=0.01 keyIncr=s keyDecr=S help='Rotation speed (turns/second)' ");
// Add 'wire' to 'bar': it is a modifable variable of type TW_TYPE_BOOL32 (32 bits boolean). Its key shortcut is [w].
TwAddVarRW(bar, "wire", TW_TYPE_BOOL32, &wire,
" label='Wireframe mode' key=w help='Toggle wireframe display mode.' ");
// Add 'time' to 'bar': it is a read-only (RO) variable of type TW_TYPE_DOUBLE, with 1 precision digit
TwAddVarRO(bar, "time", TW_TYPE_DOUBLE, &time, " label='Time' precision=1 help='Time (in seconds).' ");
// Add 'bgColor' to 'bar': it is a modifable variable of type TW_TYPE_COLOR3F (3 floats color)
TwAddVarRW(bar, "bgColor", TW_TYPE_COLOR3F, &bgColor, " label='Background color' ");
// Add 'cubeColor' to 'bar': it is a modifable variable of type TW_TYPE_COLOR32 (32 bits color) with alpha
TwAddVarRW(bar, "cubeColor", TW_TYPE_COLOR32, &cubeColor,
" label='Cube color' alpha help='Color and transparency of the cube.' ");
// Set GLFW event callbacks
// - Redirect window size changes to the callback function WindowSizeCB
glfwSetWindowSizeCallback(WindowSizeCB);
// - Directly redirect GLFW mouse button events to AntTweakBar
glfwSetMouseButtonCallback((GLFWmousebuttonfun)TwEventMouseButtonGLFW);
// - Directly redirect GLFW mouse position events to AntTweakBar
glfwSetMousePosCallback((GLFWmouseposfun)TwEventMousePosGLFW);
// - Directly redirect GLFW mouse wheel events to AntTweakBar
glfwSetMouseWheelCallback((GLFWmousewheelfun)TwEventMouseWheelGLFW);
// - Directly redirect GLFW key events to AntTweakBar
glfwSetKeyCallback((GLFWkeyfun)TwEventKeyGLFW);
// - Directly redirect GLFW char events to AntTweakBar
glfwSetCharCallback((GLFWcharfun)TwEventCharGLFW);
// Initialize time
time = glfwGetTime();
// Main loop (repeated while window is not closed and [ESC] is not pressed)
while( glfwGetWindowParam(GLFW_OPENED) && !glfwGetKey(GLFW_KEY_ESC) )
{
// Clear frame buffer using bgColor
glClearColor(bgColor[0], bgColor[1], bgColor[2], 1);
glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
// Rotate model
dt = glfwGetTime() - time;
if( dt < 0 ) dt = 0;
time += dt;
turn += speed*dt;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotated(360.0*turn, 0.4, 1, 0.2);
glTranslated(-0.5, -0.5, -0.5);
// Set color and draw model
glColor4ubv(cubeColor);
DrawModel(wire);
// Draw tweak bars
TwDraw();
// Present frame buffer
glfwSwapBuffers();
}
// Terminate AntTweakBar and GLFW
TwTerminate();
glfwTerminate();
return 0;
}

View File

@@ -0,0 +1,378 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="TwSimpleGLFW"
ProjectGUID="{29C096AF-172E-4A36-A1FE-E15B259D6834}"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="debug32"
IntermediateDirectory="tmp\debug32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glfwdll.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="../lib/debug,../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glfw\lib\win32\glfw.dll xcopy /y /f c:\sdk\glfw\lib\win32\glfw.dll debug32\.&#x0D;&#x0A;if exist bin32\glfw.dll xcopy /y /f bin32\glfw.dll debug32\.&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="debug64"
IntermediateDirectory="tmp\debug64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glfwdll64.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="../lib/debug,../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glfw\lib\win64\glfw.dll xcopy /y /f c:\sdk\glfw\lib\win64\glfw.dll debug64\.&#x0D;&#x0A;if exist bin64\glfw.dll xcopy /y /f bin64\glfw.dll debug64\.&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="bin32"
IntermediateDirectory="tmp\bin32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glfwdll.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glfw\lib\win32\glfw.dll xcopy /y /f c:\sdk\glfw\lib\win32\glfw.dll bin32\."
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="bin64"
IntermediateDirectory="tmp\bin64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;NDEBUG;_CONSOLE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glfwdll64.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glfw\lib\win64\glfw.dll xcopy /y /f c:\sdk\glfw\lib\win64\glfw.dll bin64\."
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=".\TwSimpleGLFW.c"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,234 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{29C096AF-172E-4A36-A1FE-E15B259D6834}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>debug32\</OutDir>
<IntDir>tmp\debug32\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>debug64\</OutDir>
<IntDir>tmp\debug64\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin32\</OutDir>
<IntDir>tmp\bin32\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>bin64\</OutDir>
<IntDir>tmp\bin64\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glfwdll.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glfw\lib\win32\glfw.dll xcopy /y /f c:\sdk\glfw\lib\win32\glfw.dll debug32\.
if exist bin32\glfw.dll xcopy /y /f bin32\glfw.dll debug32\.
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glfwdll64.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glfw\lib\win64\glfw.dll xcopy /y /f c:\sdk\glfw\lib\win64\glfw.dll debug64\.
if exist bin64\glfw.dll xcopy /y /f bin64\glfw.dll debug64\.
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat />
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glfwdll.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glfw\lib\win32\glfw.dll xcopy /y /f c:\sdk\glfw\lib\win32\glfw.dll bin32\.</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat />
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glfwdll64.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glfw\lib\win64\glfw.dll xcopy /y /f c:\sdk\glfw\lib\win64\glfw.dll bin64\.</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="TwSimpleGLFW.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,344 @@
// ---------------------------------------------------------------------------
//
// @file TwSimpleGLUT.c
// @brief A simple example that uses AntTweakBar with OpenGL and GLUT.
//
// AntTweakBar: http://anttweakbar.sourceforge.net/doc
// OpenGL: http://www.opengl.org
// GLUT: http://opengl.org/resources/libraries/glut
//
// @author Philippe Decaudin
// @date 2006/05/20
//
// ---------------------------------------------------------------------------
#include <AntTweakBar.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#if defined(_WIN32) || defined(_WIN64)
// MiniGLUT.h is provided to avoid the need of having GLUT installed to
// recompile this example. Do not use it in your own programs, better
// install and use the actual GLUT library SDK.
# define USE_MINI_GLUT
#endif
#if defined(USE_MINI_GLUT)
# include "../src/MiniGLUT.h"
#elif defined(_MACOSX)
# include <GLUT/glut.h>
#else
# include <GL/glut.h>
#endif
// This example displays one of the following shapes
typedef enum { SHAPE_TEAPOT=1, SHAPE_TORUS, SHAPE_CONE } Shape;
#define NUM_SHAPES 3
Shape g_CurrentShape = SHAPE_TORUS;
// Shapes scale
float g_Zoom = 1.0f;
// Shape orientation (stored as a quaternion)
float g_Rotation[] = { 0.0f, 0.0f, 0.0f, 1.0f };
// Auto rotate
int g_AutoRotate = 0;
int g_RotateTime = 0;
float g_RotateStart[] = { 0.0f, 0.0f, 0.0f, 1.0f };
// Shapes material
float g_MatAmbient[] = { 0.5f, 0.0f, 0.0f, 1.0f };
float g_MatDiffuse[] = { 1.0f, 1.0f, 0.0f, 1.0f };
// Light parameter
float g_LightMultiplier = 1.0f;
float g_LightDirection[] = { -0.57735f, -0.57735f, -0.57735f };
// Routine to set a quaternion from a rotation axis and angle
// ( input axis = float[3] angle = float output: quat = float[4] )
void SetQuaternionFromAxisAngle(const float *axis, float angle, float *quat)
{
float sina2, norm;
sina2 = (float)sin(0.5f * angle);
norm = (float)sqrt(axis[0]*axis[0] + axis[1]*axis[1] + axis[2]*axis[2]);
quat[0] = sina2 * axis[0] / norm;
quat[1] = sina2 * axis[1] / norm;
quat[2] = sina2 * axis[2] / norm;
quat[3] = (float)cos(0.5f * angle);
}
// Routine to convert a quaternion to a 4x4 matrix
// ( input: quat = float[4] output: mat = float[4*4] )
void ConvertQuaternionToMatrix(const float *quat, float *mat)
{
float yy2 = 2.0f * quat[1] * quat[1];
float xy2 = 2.0f * quat[0] * quat[1];
float xz2 = 2.0f * quat[0] * quat[2];
float yz2 = 2.0f * quat[1] * quat[2];
float zz2 = 2.0f * quat[2] * quat[2];
float wz2 = 2.0f * quat[3] * quat[2];
float wy2 = 2.0f * quat[3] * quat[1];
float wx2 = 2.0f * quat[3] * quat[0];
float xx2 = 2.0f * quat[0] * quat[0];
mat[0*4+0] = - yy2 - zz2 + 1.0f;
mat[0*4+1] = xy2 + wz2;
mat[0*4+2] = xz2 - wy2;
mat[0*4+3] = 0;
mat[1*4+0] = xy2 - wz2;
mat[1*4+1] = - xx2 - zz2 + 1.0f;
mat[1*4+2] = yz2 + wx2;
mat[1*4+3] = 0;
mat[2*4+0] = xz2 + wy2;
mat[2*4+1] = yz2 - wx2;
mat[2*4+2] = - xx2 - yy2 + 1.0f;
mat[2*4+3] = 0;
mat[3*4+0] = mat[3*4+1] = mat[3*4+2] = 0;
mat[3*4+3] = 1;
}
// Routine to multiply 2 quaternions (ie, compose rotations)
// ( input q1 = float[4] q2 = float[4] output: qout = float[4] )
void MultiplyQuaternions(const float *q1, const float *q2, float *qout)
{
float qr[4];
qr[0] = q1[3]*q2[0] + q1[0]*q2[3] + q1[1]*q2[2] - q1[2]*q2[1];
qr[1] = q1[3]*q2[1] + q1[1]*q2[3] + q1[2]*q2[0] - q1[0]*q2[2];
qr[2] = q1[3]*q2[2] + q1[2]*q2[3] + q1[0]*q2[1] - q1[1]*q2[0];
qr[3] = q1[3]*q2[3] - (q1[0]*q2[0] + q1[1]*q2[1] + q1[2]*q2[2]);
qout[0] = qr[0]; qout[1] = qr[1]; qout[2] = qr[2]; qout[3] = qr[3];
}
// Return elapsed time in milliseconds
int GetTimeMs()
{
#if !defined(_WIN32)
return glutGet(GLUT_ELAPSED_TIME);
#else
// glutGet(GLUT_ELAPSED_TIME) seems buggy on Windows
return (int)GetTickCount();
#endif
}
// Callback function called by GLUT to render screen
void Display(void)
{
float v[4]; // will be used to set light parameters
float mat[4*4]; // rotation matrix
// Clear frame buffer
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glEnable(GL_NORMALIZE);
// Set light
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
v[0] = v[1] = v[2] = g_LightMultiplier*0.4f; v[3] = 1.0f;
glLightfv(GL_LIGHT0, GL_AMBIENT, v);
v[0] = v[1] = v[2] = g_LightMultiplier*0.8f; v[3] = 1.0f;
glLightfv(GL_LIGHT0, GL_DIFFUSE, v);
v[0] = -g_LightDirection[0]; v[1] = -g_LightDirection[1]; v[2] = -g_LightDirection[2]; v[3] = 0.0f;
glLightfv(GL_LIGHT0, GL_POSITION, v);
// Set material
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, g_MatAmbient);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, g_MatDiffuse);
// Rotate and draw shape
glPushMatrix();
glTranslatef(0.5f, -0.3f, 0.0f);
if( g_AutoRotate )
{
float axis[3] = { 0, 1, 0 };
float angle = (float)(GetTimeMs()-g_RotateTime)/1000.0f;
float quat[4];
SetQuaternionFromAxisAngle(axis, angle, quat);
MultiplyQuaternions(g_RotateStart, quat, g_Rotation);
}
ConvertQuaternionToMatrix(g_Rotation, mat);
glMultMatrixf(mat);
glScalef(g_Zoom, g_Zoom, g_Zoom);
glCallList(g_CurrentShape);
glPopMatrix();
// Draw tweak bars
TwDraw();
// Present frame buffer
glutSwapBuffers();
// Recall Display at next frame
glutPostRedisplay();
}
// Callback function called by GLUT when window size changes
void Reshape(int width, int height)
{
// Set OpenGL viewport and camera
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(40, (double)width/height, 1, 10);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,5, 0,0,0, 0,1,0);
glTranslatef(0, 0.6f, -1);
// Send the new window size to AntTweakBar
TwWindowSize(width, height);
}
// Function called at exit
void Terminate(void)
{
glDeleteLists(SHAPE_TEAPOT, NUM_SHAPES);
TwTerminate();
}
// Callback function called when the 'AutoRotate' variable value of the tweak bar has changed
void TW_CALL SetAutoRotateCB(const void *value, void *clientData)
{
(void)clientData; // unused
g_AutoRotate = *(const int *)value; // copy value to g_AutoRotate
if( g_AutoRotate!=0 )
{
// init rotation
g_RotateTime = GetTimeMs();
g_RotateStart[0] = g_Rotation[0];
g_RotateStart[1] = g_Rotation[1];
g_RotateStart[2] = g_Rotation[2];
g_RotateStart[3] = g_Rotation[3];
// make Rotation variable read-only
TwDefine(" TweakBar/ObjRotation readonly ");
}
else
// make Rotation variable read-write
TwDefine(" TweakBar/ObjRotation readwrite ");
}
// Callback function called by the tweak bar to get the 'AutoRotate' value
void TW_CALL GetAutoRotateCB(void *value, void *clientData)
{
(void)clientData; // unused
*(int *)value = g_AutoRotate; // copy g_AutoRotate to value
}
// Main
int main(int argc, char *argv[])
{
TwBar *bar; // Pointer to the tweak bar
float axis[] = { 0.7f, 0.7f, 0.0f }; // initial model rotation
float angle = 0.8f;
// Initialize GLUT
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(640, 480);
glutCreateWindow("AntTweakBar simple example using GLUT");
glutCreateMenu(NULL);
// Set GLUT callbacks
glutDisplayFunc(Display);
glutReshapeFunc(Reshape);
atexit(Terminate); // Called after glutMainLoop ends
// Initialize AntTweakBar
TwInit(TW_OPENGL, NULL);
// Set GLUT event callbacks
// - Directly redirect GLUT mouse button events to AntTweakBar
glutMouseFunc((GLUTmousebuttonfun)TwEventMouseButtonGLUT);
// - Directly redirect GLUT mouse motion events to AntTweakBar
glutMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
// - Directly redirect GLUT mouse "passive" motion events to AntTweakBar (same as MouseMotion)
glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
// - Directly redirect GLUT key events to AntTweakBar
glutKeyboardFunc((GLUTkeyboardfun)TwEventKeyboardGLUT);
// - Directly redirect GLUT special key events to AntTweakBar
glutSpecialFunc((GLUTspecialfun)TwEventSpecialGLUT);
// - Send 'glutGetModifers' function pointer to AntTweakBar;
// required because the GLUT key event functions do not report key modifiers states.
TwGLUTModifiersFunc(glutGetModifiers);
// Create some 3D objects (stored in display lists)
glNewList(SHAPE_TEAPOT, GL_COMPILE);
glutSolidTeapot(1.0);
glEndList();
glNewList(SHAPE_TORUS, GL_COMPILE);
glutSolidTorus(0.3, 1.0, 16, 32);
glEndList();
glNewList(SHAPE_CONE, GL_COMPILE);
glutSolidCone(1.0, 1.5, 64, 4);
glEndList();
// Create a tweak bar
bar = TwNewBar("TweakBar");
TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar with GLUT and OpenGL.' "); // Message added to the help bar.
TwDefine(" TweakBar size='200 400' color='96 216 224' "); // change default tweak bar size and color
// Add 'g_Zoom' to 'bar': this is a modifable (RW) variable of type TW_TYPE_FLOAT. Its key shortcuts are [z] and [Z].
TwAddVarRW(bar, "Zoom", TW_TYPE_FLOAT, &g_Zoom,
" min=0.01 max=2.5 step=0.01 keyIncr=z keyDecr=Z help='Scale the object (1=original size).' ");
// Add 'g_Rotation' to 'bar': this is a variable of type TW_TYPE_QUAT4F which defines the object's orientation
TwAddVarRW(bar, "ObjRotation", TW_TYPE_QUAT4F, &g_Rotation,
" label='Object rotation' opened=true help='Change the object orientation.' ");
// Add callback to toggle auto-rotate mode (callback functions are defined above).
TwAddVarCB(bar, "AutoRotate", TW_TYPE_BOOL32, SetAutoRotateCB, GetAutoRotateCB, NULL,
" label='Auto-rotate' key=space help='Toggle auto-rotate mode.' ");
// Add 'g_LightMultiplier' to 'bar': this is a variable of type TW_TYPE_FLOAT. Its key shortcuts are [+] and [-].
TwAddVarRW(bar, "Multiplier", TW_TYPE_FLOAT, &g_LightMultiplier,
" label='Light booster' min=0.1 max=4 step=0.02 keyIncr='+' keyDecr='-' help='Increase/decrease the light power.' ");
// Add 'g_LightDirection' to 'bar': this is a variable of type TW_TYPE_DIR3F which defines the light direction
TwAddVarRW(bar, "LightDir", TW_TYPE_DIR3F, &g_LightDirection,
" label='Light direction' opened=true help='Change the light direction.' ");
// Add 'g_MatAmbient' to 'bar': this is a variable of type TW_TYPE_COLOR3F (3 floats color, alpha is ignored)
// and is inserted into a group named 'Material'.
TwAddVarRW(bar, "Ambient", TW_TYPE_COLOR3F, &g_MatAmbient, " group='Material' ");
// Add 'g_MatDiffuse' to 'bar': this is a variable of type TW_TYPE_COLOR3F (3 floats color, alpha is ignored)
// and is inserted into group 'Material'.
TwAddVarRW(bar, "Diffuse", TW_TYPE_COLOR3F, &g_MatDiffuse, " group='Material' ");
// Add the enum variable 'g_CurrentShape' to 'bar'
// (before adding an enum variable, its enum type must be declared to AntTweakBar as follow)
{
// ShapeEV associates Shape enum values with labels that will be displayed instead of enum values
TwEnumVal shapeEV[NUM_SHAPES] = { {SHAPE_TEAPOT, "Teapot"}, {SHAPE_TORUS, "Torus"}, {SHAPE_CONE, "Cone"} };
// Create a type for the enum shapeEV
TwType shapeType = TwDefineEnum("ShapeType", shapeEV, NUM_SHAPES);
// add 'g_CurrentShape' to 'bar': this is a variable of type ShapeType. Its key shortcuts are [<] and [>].
TwAddVarRW(bar, "Shape", shapeType, &g_CurrentShape, " keyIncr='<' keyDecr='>' help='Change object shape.' ");
}
// Store time
g_RotateTime = GetTimeMs();
// Init rotation
SetQuaternionFromAxisAngle(axis, angle, g_Rotation);
SetQuaternionFromAxisAngle(axis, angle, g_RotateStart);
// Call the GLUT main loop
glutMainLoop();
return 0;
}

View File

@@ -0,0 +1,390 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="TwSimpleGLUT"
ProjectGUID="{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="debug32"
IntermediateDirectory="tmp\debug32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glut32.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib/debug;../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(InputName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glut\lib\glut32.dll xcopy /y /f c:\sdk\glut\lib\glut32.dll debug32\.&#x0D;&#x0A;if exist bin32\glut32.dll xcopy /y /f bin32\glut32.dll debug32\.&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="debug64"
IntermediateDirectory="tmp\debug64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glut64.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib/debug;../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(InputName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glut\lib\glut64.dll xcopy /y /f c:\sdk\glut\lib\glut64.dll debug64\.&#x0D;&#x0A;if exist bin64\glut64.dll xcopy /y /f bin64\glut64.dll debug64\.&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="bin32"
IntermediateDirectory="tmp\bin32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="true"
ExceptionHandling="0"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
DisableLanguageExtensions="false"
UsePrecompiledHeader="0"
AssemblerListingLocation="$(IntDir)/"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glut32.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glut\lib\glut32.dll xcopy /y /f c:\sdk\glut\lib\glut32.dll bin32\."
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="bin64"
IntermediateDirectory="tmp\bin64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;NDEBUG;_CONSOLE"
StringPooling="true"
ExceptionHandling="0"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
DisableLanguageExtensions="false"
UsePrecompiledHeader="0"
AssemblerListingLocation="$(IntDir)/"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glut64.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glut\lib\glut64.dll xcopy /y /f c:\sdk\glut\lib\glut64.dll bin64\."
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="TwSimpleGLUT.c"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,246 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{CC6C3AFD-5DD9-498F-9184-C53E663C2ABF}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>debug32\</OutDir>
<IntDir>tmp\debug32\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>debug64\</OutDir>
<IntDir>tmp\debug64\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin32\</OutDir>
<IntDir>tmp\bin32\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>bin64\</OutDir>
<IntDir>tmp\bin64\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glut32.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glut\lib\glut32.dll xcopy /y /f c:\sdk\glut\lib\glut32.dll debug32\.
if exist bin32\glut32.dll xcopy /y /f bin32\glut32.dll debug32\.
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glut64.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glut\lib\glut64.dll xcopy /y /f c:\sdk\glut\lib\glut64.dll debug64\.
if exist bin64\glut64.dll xcopy /y /f bin64\glut64.dll debug64\.
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling />
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<PrecompiledHeader />
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat />
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glut32.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glut\lib\glut32.dll xcopy /y /f c:\sdk\glut\lib\glut32.dll bin32\.</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling />
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<PrecompiledHeader />
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat />
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glut64.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glut\lib\glut64.dll xcopy /y /f c:\sdk\glut\lib\glut64.dll bin64\.</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="TwSimpleGLUT.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,260 @@
// ---------------------------------------------------------------------------
//
// @file TwSimpleSDL.c
// @brief A simple example that uses AntTweakBar with OpenGL and SDL 1.2
//
// AntTweakBar: http://anttweakbar.sourceforge.net/doc
// OpenGL: http://www.opengl.org
// SDL: http://www.libsdl.org
//
// @author Philippe Decaudin
//
// ---------------------------------------------------------------------------
#include <AntTweakBar.h>
#if defined(_WIN32) || defined(_WIN64)
// MiniSDL12.h is provided to avoid the need of having SDL installed to
// recompile this example. Do not use it in your own programs, better
// install and use the actual SDL library SDK.
# define USE_MINI_SDL
#endif
#ifdef USE_MINI_SDL
# include "../src/MiniSDL12.h"
#else
# include <SDL/SDL.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#if defined(_WIN32) || defined(_WIN64)
# include <windows.h> // required by gl.h
#endif
#include <GL/gl.h>
#include <GL/glu.h>
// SDL redefines main
#ifdef main
# undef main
#endif
int main()
{
const SDL_VideoInfo* video = NULL;
int width = 640, height = 480;
int bpp, flags;
int quit = 0;
TwBar *bar;
int n, numCubes = 30;
float color0[] = { 1.0f, 0.5f, 0.0f };
float color1[] = { 0.5f, 1.0f, 0.0f };
double ka = 5.3, kb = 1.7, kc = 4.1;
// Initialize SDL, then get the current video mode and use it to create a SDL window.
if( SDL_Init(SDL_INIT_VIDEO)<0 )
{
fprintf(stderr, "Video initialization failed: %s\n", SDL_GetError());
SDL_Quit();
exit(1);
}
video = SDL_GetVideoInfo();
if( !video )
{
fprintf(stderr, "Video query failed: %s\n", SDL_GetError());
SDL_Quit();
exit(1);
}
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
//SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
bpp = video->vfmt->BitsPerPixel;
flags = SDL_OPENGL | SDL_HWSURFACE | SDL_RESIZABLE;
//flags |= SDL_FULLSCREEN;
if( !SDL_SetVideoMode(width, height, bpp, flags) )
{
fprintf(stderr, "Video mode set failed: %s\n", SDL_GetError());
SDL_Quit();
exit(1);
}
SDL_WM_SetCaption("AntTweakBar simple example using SDL", "AntTweakBar+SDL");
// Enable SDL unicode and key-repeat
SDL_EnableUNICODE(1);
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
// Set OpenGL viewport and states
glViewport(0, 0, width, height);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0); // use default light diffuse and position
glEnable(GL_NORMALIZE);
glEnable(GL_COLOR_MATERIAL);
glDisable(GL_CULL_FACE);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
// Initialize AntTweakBar
TwInit(TW_OPENGL, NULL);
// Tell the window size to AntTweakBar
TwWindowSize(width, height);
// Create a tweak bar
bar = TwNewBar("TweakBar");
TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar with SDL and OpenGL.\nPress [Space] to toggle fullscreen.' "); // Message added to the help bar.
// Add 'width' and 'height' to 'bar': they are read-only (RO) variables of type TW_TYPE_INT32.
TwAddVarRO(bar, "Width", TW_TYPE_INT32, &width,
" label='Wnd width' help='Width of the graphics window (in pixels)' ");
TwAddVarRO(bar, "Height", TW_TYPE_INT32, &height,
" label='Wnd height' help='Height of the graphics window (in pixels)' ");
// Add 'numCurves' to 'bar': this is a modifiable variable of type TW_TYPE_INT32. Its shortcuts are [c] and [C].
TwAddVarRW(bar, "NumCubes", TW_TYPE_INT32, &numCubes,
" label='Number of cubes' min=1 max=100 keyIncr=c keyDecr=C help='Defines the number of cubes in the scene.' ");
// Add 'ka', 'kb and 'kc' to 'bar': they are modifiable variables of type TW_TYPE_DOUBLE
TwAddVarRW(bar, "ka", TW_TYPE_DOUBLE, &ka,
" label='X path coeff' keyIncr=1 keyDecr=CTRL+1 min=-10 max=10 step=0.01 ");
TwAddVarRW(bar, "kb", TW_TYPE_DOUBLE, &kb,
" label='Y path coeff' keyIncr=2 keyDecr=CTRL+2 min=-10 max=10 step=0.01 ");
TwAddVarRW(bar, "kc", TW_TYPE_DOUBLE, &kc,
" label='Z path coeff' keyIncr=3 keyDecr=CTRL+3 min=-10 max=10 step=0.01 ");
// Add 'color0' and 'color1' to 'bar': they are modifable variables of type TW_TYPE_COLOR3F (3 floats color)
TwAddVarRW(bar, "color0", TW_TYPE_COLOR3F, &color0,
" label='Start color' help='Color of the first cube.' ");
TwAddVarRW(bar, "color1", TW_TYPE_COLOR3F, &color1,
" label='End color' help='Color of the last cube. Cube colors are interpolated between the Start and End colors.' ");
// Add 'quit' to 'bar': this is a modifiable (RW) variable of type TW_TYPE_BOOL32
// (a boolean stored in a 32 bits integer). Its shortcut is [ESC].
TwAddVarRW(bar, "Quit", TW_TYPE_BOOL32, &quit,
" label='Quit?' true='+' false='-' key='ESC' help='Quit program.' ");
// Main loop:
// - Draw some cubes
// - Process events
while( !quit )
{
SDL_Event event;
int handled;
// Clear screen
glClearColor(0.5f, 0.75f, 0.8f, 1);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
// Set OpenGL camera
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(40, (double)width/height, 1, 10);
gluLookAt(0,0,3, 0,0,0, 0,1,0);
// Draw cubes
for( n=0; n<numCubes; ++n )
{
double t = 0.05*n - (double)SDL_GetTicks()/2000.0;
double r = 5.0*n + (double)SDL_GetTicks()/10.0;
float c = (float)n/numCubes;
// Set cube position
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslated(0.6*cos(ka*t), 0.6*cos(kb*t), 0.6*sin(kc*t));
glRotated(r, 0.2, 0.7, 0.2);
glScaled(0.1, 0.1, 0.1);
glTranslated(-0.5, -0.5, -0.5);
// Set cube color
glColor3f((1.0f-c)*color0[0]+c*color1[0], (1.0f-c)*color0[1]+c*color1[1], (1.0f-c)*color0[2]+c*color1[2]);
// Draw cube
glBegin(GL_QUADS);
glNormal3f(0,0,-1); glVertex3f(0,0,0); glVertex3f(0,1,0); glVertex3f(1,1,0); glVertex3f(1,0,0); // front face
glNormal3f(0,0,+1); glVertex3f(0,0,1); glVertex3f(1,0,1); glVertex3f(1,1,1); glVertex3f(0,1,1); // back face
glNormal3f(-1,0,0); glVertex3f(0,0,0); glVertex3f(0,0,1); glVertex3f(0,1,1); glVertex3f(0,1,0); // left face
glNormal3f(+1,0,0); glVertex3f(1,0,0); glVertex3f(1,1,0); glVertex3f(1,1,1); glVertex3f(1,0,1); // right face
glNormal3f(0,-1,0); glVertex3f(0,0,0); glVertex3f(1,0,0); glVertex3f(1,0,1); glVertex3f(0,0,1); // bottom face
glNormal3f(0,+1,0); glVertex3f(0,1,0); glVertex3f(0,1,1); glVertex3f(1,1,1); glVertex3f(1,1,0); // top face
glEnd();
}
// Draw tweak bars
TwDraw();
// Present frame buffer
SDL_GL_SwapBuffers();
// Process incoming events
while( SDL_PollEvent(&event) )
{
// Send event to AntTweakBar
handled = TwEventSDL(&event, SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
// If event has not been handled by AntTweakBar, process it
if( !handled )
{
switch( event.type )
{
case SDL_QUIT: // Window is closed
quit = 1;
break;
case SDL_VIDEORESIZE: // Window size has changed
// Resize SDL video mode
width = event.resize.w;
height = event.resize.h;
if( !SDL_SetVideoMode(width, height, bpp, flags) )
fprintf(stderr, "WARNING: Video mode set failed: %s\n", SDL_GetError());
// Resize OpenGL viewport
glViewport(0, 0, width, height);
// Restore OpenGL states (SDL seems to lost them)
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_NORMALIZE);
glEnable(GL_COLOR_MATERIAL);
glDisable(GL_CULL_FACE);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
// TwWindowSize has been called by TwEventSDL,
// so it is not necessary to call it again here.
break;
case SDL_KEYDOWN:
if( event.key.keysym.sym==' ' ) // toggle fullscreen if Space key is pressed
{
flags ^= SDL_FULLSCREEN;
SDL_SetVideoMode(800, 600, bpp, flags);
// Push a resize event because SDL does not do it for us
event.type = SDL_VIDEORESIZE;
event.resize.w = 800;
event.resize.h = 600;
SDL_PushEvent(&event);
}
break;
}
}
}
} // End of main loop
// Terminate AntTweakBar
TwTerminate();
// Terminate SDL
SDL_Quit();
return 0;
}

View File

@@ -0,0 +1,467 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="TwSimpleSDL"
ProjectGUID="{3B516919-D0DA-43CE-820E-8306368F605B}"
RootNamespace="TwSimpleSDL"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="bin32"
IntermediateDirectory="tmp\bin32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName="$(OutDir)/TwTestSDL.tlb"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
WarningLevel="4"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="false"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="false"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="SDL.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
ProgramDatabaseFile=""
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\sdl\lib\sdl.dll xcopy /y /f c:\sdk\sdl\lib\sdl.dll bin32\."
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="bin64"
IntermediateDirectory="tmp\bin64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
TypeLibraryName="$(OutDir)/TwTestSDL.tlb"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;NDEBUG;_CONSOLE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
WarningLevel="4"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="false"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="false"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="SDL64.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
ProgramDatabaseFile=""
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\sdl\lib\sdl64.dll xcopy /y /f c:\sdk\sdl\lib\sdl64.dll bin64\."
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory="debug32"
IntermediateDirectory="tmp\debug32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName="$(OutDir)/TwTestSDL.tlb"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
WarningLevel="4"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="SDL.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib/debug;../lib"
GenerateManifest="false"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\sdl\lib\sdl.dll xcopy /y /f c:\sdk\sdl\lib\sdl.dll debug32\.&#x0D;&#x0A;if exist bin32\sdl.dll xcopy /y /f bin32\sdl.dll debug32\.&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="debug64"
IntermediateDirectory="tmp\debug64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
TypeLibraryName="$(OutDir)/TwTestSDL.tlb"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64,_DEBUG,_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
WarningLevel="4"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="SDL64.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib/debug;../lib"
GenerateManifest="false"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\sdl\lib\sdl64.dll xcopy /y /f c:\sdk\sdl\lib\sdl64.dll debug64\.&#x0D;&#x0A;if exist bin64\sdl64.dll xcopy /y /f bin64\sdl.dll debug64\.&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="TwSimpleSDL.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/"
/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,300 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{3B516919-D0DA-43CE-820E-8306368F605B}</ProjectGuid>
<RootNamespace>TwSimpleSDL</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin32\</OutDir>
<IntDir>tmp\bin32\$(ProjectName)\</IntDir>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>bin64\</OutDir>
<IntDir>tmp\bin64\$(ProjectName)\</IntDir>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>debug32\</OutDir>
<IntDir>tmp\debug32\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>debug64\</OutDir>
<IntDir>tmp\debug64\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Midl>
<TypeLibraryName>$(OutDir)TwTestSDL.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<PrecompiledHeaderOutputFile />
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)vc70.pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>SDL.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<ProgramDatabaseFile />
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\sdl\lib\sdl.dll xcopy /y /f c:\sdk\sdl\lib\sdl.dll bin32\.</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
<TypeLibraryName>$(OutDir)TwTestSDL.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<PrecompiledHeaderOutputFile />
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)vc70.pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>SDL64.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<ProgramDatabaseFile />
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\sdl\lib\sdl64.dll xcopy /y /f c:\sdk\sdl\lib\sdl64.dll bin64\.</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Midl>
<TypeLibraryName>$(OutDir)TwTestSDL.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<PrecompiledHeaderOutputFile />
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)vc70.pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>SDL.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\sdl\lib\sdl.dll xcopy /y /f c:\sdk\sdl\lib\sdl.dll debug32\.
if exist bin32\sdl.dll xcopy /y /f bin32\sdl.dll debug32\.
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
<TypeLibraryName>$(OutDir)TwTestSDL.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<PrecompiledHeaderOutputFile />
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)vc70.pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>SDL64.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\sdl\lib\sdl64.dll xcopy /y /f c:\sdk\sdl\lib\sdl64.dll debug64\.
if exist bin64\sdl64.dll xcopy /y /f bin64\sdl.dll debug64\.
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="TwSimpleSDL.c">
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)</ObjectFileName>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,249 @@
// ---------------------------------------------------------------------------
//
// @file TwSimpleSFML.cpp
// @brief A simple example that uses AntTweakBar with OpenGL and SFML.
// This example draws moving cubic particles with some
// interactive control on particles generation.
//
// AntTweakBar: http://anttweakbar.sourceforge.net/doc
// OpenGL: http://www.opengl.org
// SFML: http://www.sfml-dev.org
//
// @author Philippe Decaudin
//
// ---------------------------------------------------------------------------
#include <AntTweakBar.h>
#if defined(_WIN32)
// MiniSFML16.h is provided to avoid the need of having SFML installed to
// recompile this example. Do not use it in your own programs, better
// install and use the actual SFML library SDK.
# define USE_MINI_SFML
#endif
#ifdef USE_MINI_SFML
# include "../src/MiniSFML16.h"
#else
# include <SFML/Graphics.hpp>
#endif
#if defined(_WIN32)
# include <windows.h> // required by gl.h
#endif
#include <GL/gl.h>
#include <GL/glu.h>
#include <list>
#include <cstdlib>
#include <cmath>
// Pseudo-random value between -1 and 1
float Random()
{
return 2.0f * ((float)rand() / RAND_MAX) - 1.0f;
}
// Particle randomly initialized
struct Particle
{
float Size;
float Position[3]; // [px, py, pz]
float Speed[3]; // [vx, vy, vz]
float RotationAxis[3]; // [rx, ry, rz]
float RotationAngle; // in degree
float RotationSpeed;
float Color[3]; // [r, g, b]
float Age;
Particle(float size, float speedDir[3], float speedNorm, float color[3]) // Constructor
{
Size = size * (1.0f + 0.2f * Random());
Position[0] = Position[1] = Position[2] = 0;
Speed[0] = speedNorm * (speedDir[0] + 0.1f * Random());
Speed[1] = speedNorm * (speedDir[1] + 0.1f * Random());
Speed[2] = speedNorm * (speedDir[2] + 0.1f * Random());
RotationAxis[0] = Random();
RotationAxis[1] = Random();
RotationAxis[2] = Random();
RotationAngle = 360.0f * Random();
RotationSpeed = 360.0f * Random();
Color[0] = color[0] + 0.2f * Random();
Color[1] = color[1] + 0.2f * Random();
Color[2] = color[2] + 0.2f * Random();
Age = 0;
}
void Update(float dt) // Apply one animation step
{
Position[0] += dt * Speed[0];
Position[1] += dt * Speed[1];
Position[2] += dt * Speed[2];
Speed[1] -= dt * 9.81f; // gravity
RotationAngle += dt * RotationSpeed;
Age += dt;
}
};
// Main
int main()
{
// Create main window
sf::RenderWindow app(sf::VideoMode(800, 600), "AntTweakBar simple example using SFML");
app.PreserveOpenGLStates(true);
// Particules
std::list<Particle> particles;
std::list<Particle>::iterator p;
float birthCount = 0;
float birthRate = 20; // number of particles generated per second
float maxAge = 3.0f; // particles life time
float speedDir[3] = {0, 1, 0}; // initial particles speed direction
float speedNorm = 7.0f; // initial particles speed amplitude
float size = 0.1f; // particles size
float color[3] = {0.8f, 0.6f, 0}; // particles color
float bgColor[3] = {0, 0.6f, 0.6f}; // background color
// Initialize AntTweakBar
TwInit(TW_OPENGL, NULL);
// Tell the window size to AntTweakBar
TwWindowSize(app.GetWidth(), app.GetHeight());
// Create a tweak bar
TwBar *bar = TwNewBar("Particles");
TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar with SFML and OpenGL.' "); // Message added to the help bar.
// Change bar position
int barPos[2] = {16, 240};
TwSetParam(bar, NULL, "position", TW_PARAM_INT32, 2, &barPos);
// Add 'birthRate' to 'bar': this is a modifiable variable of type TW_TYPE_FLOAT in range [0.1, 100]. Its shortcuts are [+] and [-].
TwAddVarRW(bar, "Birth rate", TW_TYPE_FLOAT, &birthRate, " min=0.1 max=100 step=0.1 keyIncr='+' keyDecr='-' ");
// Add 'speedNorm' to 'bar': this is a modifiable variable of type TW_TYPE_FLOAT in range [0.1, 10]. Its shortcuts are [s] and [S].
TwAddVarRW(bar, "Speed", TW_TYPE_FLOAT, &speedNorm, " min=0.1 max=10 step=0.1 keyIncr='s' keyDecr='S' ");
// Add 'speedDir' to 'bar': this is a modifiable variable of type TW_TYPE_DIR3F. Just displaying the arrow widget
TwAddVarRW(bar, "Direction", TW_TYPE_DIR3F, &speedDir, " opened=true showval=false ");
// Add 'color' to 'bar': this is a modifiable variable of type TW_TYPE_COLOR3F. Switched to HLS
TwAddVarRW(bar, "Color", TW_TYPE_COLOR3F, &color, " colorMode=hls opened=true ");
// Add 'bgColor' to 'bar': this is a modifiable variable of type TW_TYPE_COLOR3F. Switched to HLS
TwAddVarRW(bar, "Background color", TW_TYPE_COLOR3F, &bgColor, " colorMode=hls opened=true ");
// Initialize OpenGL states
glEnable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.f, (float)app.GetWidth()/app.GetHeight(), 0.1f, 100.f);
glMatrixMode(GL_MODELVIEW);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_NORMALIZE);
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
// Init time
sf::Clock clock;
float time = clock.GetElapsedTime();
// Main loop
while (app.IsOpened())
{
// Process events
sf::Event event;
while (app.GetEvent(event))
{
// Send event to AntTweakBar
int handled = TwEventSFML(&event, 1, 6); // Assume SFML version 1.6 here
// If event has not been handled by AntTweakBar, process it
if( !handled )
{
// Close or Escape
if (event.Type == sf::Event::Closed
|| (event.Type == sf::Event::KeyPressed && event.Key.Code == sf::Key::Escape))
app.Close();
// Resize
if (event.Type == sf::Event::Resized)
{
glViewport(0, 0, event.Size.Width, event.Size.Height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.f, (float)event.Size.Width/event.Size.Height, 1.f, 500.f);
glMatrixMode(GL_MODELVIEW);
// TwWindowSize has been called by TwEventSFML,
// so it is not necessary to call it again here.
}
}
}
if (!app.IsOpened())
continue;
// Update time
float dt = clock.GetElapsedTime() - time;
if (dt < 0) dt = 0;
time += dt;
// Update particles
p = particles.begin();
while (p != particles.end())
{
p->Update(dt);
if (p->Age >= maxAge)
p = particles.erase(p); // Die!
else
++p;
}
// Generate new particles
birthCount += dt * birthRate;
while (birthCount >= 1.0f)
{
particles.push_back(Particle(size, speedDir, speedNorm, color));
birthCount--;
}
// Clear depth buffer
glClearColor(bgColor[0], bgColor[1], bgColor[2], 1);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
// Draw particles
for (p = particles.begin(); p != particles.end(); ++p)
{
glColor4fv(p->Color);
glLoadIdentity();
glTranslatef(0.0f, -1.0f, -3.0f); // Camera position
glTranslatef(p->Position[0], p->Position[1], p->Position[2]);
glScalef(p->Size, p->Size, p->Size);
glRotatef(p->RotationAngle, p->RotationAxis[0], p->RotationAxis[1], p->RotationAxis[2]);
// Draw a cube
glBegin(GL_QUADS);
glNormal3f(0,0,-1); glVertex3f(0,0,0); glVertex3f(0,1,0); glVertex3f(1,1,0); glVertex3f(1,0,0); // front face
glNormal3f(0,0,+1); glVertex3f(0,0,1); glVertex3f(1,0,1); glVertex3f(1,1,1); glVertex3f(0,1,1); // back face
glNormal3f(-1,0,0); glVertex3f(0,0,0); glVertex3f(0,0,1); glVertex3f(0,1,1); glVertex3f(0,1,0); // left face
glNormal3f(+1,0,0); glVertex3f(1,0,0); glVertex3f(1,1,0); glVertex3f(1,1,1); glVertex3f(1,0,1); // right face
glNormal3f(0,-1,0); glVertex3f(0,0,0); glVertex3f(1,0,0); glVertex3f(1,0,1); glVertex3f(0,0,1); // bottom face
glNormal3f(0,+1,0); glVertex3f(0,1,0); glVertex3f(0,1,1); glVertex3f(1,1,1); glVertex3f(1,1,0); // top face
glEnd();
}
TwDraw();
// Finally, display the rendered frame on screen
app.Display();
}
// Un-initialize AntTweakBar
TwTerminate();
return EXIT_SUCCESS;
}

View File

@@ -0,0 +1,421 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="TwSimpleSFML"
ProjectGUID="{AA613E00-5339-4B87-9285-A53EFF3C9AB9}"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="debug32"
IntermediateDirectory="tmp\debug32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
MinimalRebuild="true"
ExceptionHandling="1"
BasicRuntimeChecks="3"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="sfml-system-s.lib sfml-window-s.lib sfml-graphics-s.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib/debug;../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(InputName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="debug64"
IntermediateDirectory="tmp\debug64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;_DEBUG;_CONSOLE"
MinimalRebuild="true"
ExceptionHandling="1"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SFML64.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib/debug;../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(InputName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="bin32"
IntermediateDirectory="tmp\bin32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
DisableLanguageExtensions="false"
UsePrecompiledHeader="0"
AssemblerListingLocation="$(IntDir)/"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="sfml-system-s.lib sfml-window-s.lib sfml-graphics-s.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="bin64"
IntermediateDirectory="tmp\bin64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;NDEBUG;_CONSOLE"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
DisableLanguageExtensions="false"
UsePrecompiledHeader="0"
AssemblerListingLocation="$(IntDir)/"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SFML64.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=".\TwSimpleSFML.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="2"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="2"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="2"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="2"
/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,410 @@
// ---------------------------------------------------------------------------
//
// @file TwString.cpp
// @brief This example illustrates the use of the different types of
// AntTweakBar string variables.
// The graphic window is created by GLUT.
//
// AntTweakBar: http://anttweakbar.sourceforge.net/doc
// OpenGL: http://www.opengl.org
// GLUT: http://opengl.org/resources/libraries/glut
//
// @author Philippe Decaudin
//
// ---------------------------------------------------------------------------
#include <AntTweakBar.h>
#if defined(_WIN32) || defined(_WIN64)
// MiniGLUT.h is provided to avoid the need of having GLUT installed to
// recompile this example. Do not use it in your own programs, better
// install and use the actual GLUT library SDK.
# define USE_MINI_GLUT
#endif
#if defined(USE_MINI_GLUT)
# include "../src/MiniGLUT.h"
#elif defined(_MACOSX)
# include <GLUT/glut.h>
#else
# include <GL/glut.h>
#endif
#include <sstream>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#if !defined _MSC_VER
# define _snprintf snprintf
#endif
// ---------------------------------------------------------------------------
// 1) Callback functions for std::string variables
// ---------------------------------------------------------------------------
// Function called to copy the content of a std::string (souceString) handled
// by the AntTweakBar library to destinationClientString handled by our application
void TW_CALL CopyStdStringToClient(std::string& destinationClientString, const std::string& sourceLibraryString)
{
destinationClientString = sourceLibraryString;
}
std::vector<std::string> g_BarTitles;
// Callback function called by AntTweakBar to set the "EditTitle" std::string variable
void TW_CALL SetBarTitleCB(const void *value, void *clientData)
{
const std::string *newTitle = (const std::string *)(value);
int barIndex = *(int *)(&clientData); // clientData stores the bar index
// Stores the new bar title
g_BarTitles[barIndex] = *newTitle;
// Create the def command to change the bar label (ie., its title)
std::stringstream def;
def << "bar_" << barIndex << " label=`" << g_BarTitles[barIndex] << "`";
// Execute the command
TwDefine(def.str().c_str());
}
// Callback function called by AntTweakBar to get the "EditTitle" std::string variable
void TW_CALL GetBarTitleCB(void *value, void *clientData)
{
std::string *destStringPtr = (std::string *)(value);
int barIndex = *(int *)(&clientData); // clientData stores the bar index
std::string title = g_BarTitles[barIndex];
// Do not assign destStringPtr directly (see TwCopyStdStringToLibrary doc for explanation):
// Use TwCopyStdStringToLibrary to copy the bar title string to AntTweakBar
TwCopyStdStringToLibrary(*destStringPtr, title);
}
// Callback function to create a bar with a given title
void TW_CALL CreateBarCB(void *clientData)
{
const std::string *title = (const std::string *)(clientData);
// Create a unique bar name
int barIndex = (int)g_BarTitles.size();
std::stringstream name;
name << "bar_" << barIndex;
g_BarTitles.push_back(*title);
// Create bar
TwBar *bar = TwNewBar(name.str().c_str());
TwAddButton(bar, "Info", NULL, NULL, " label='std::string variable:' ");
// Set bar label (ie. the title)
std::stringstream def;
def << name.str() << " label=`" << *title << "` ";
TwDefine(def.str().c_str());
// Cast barNum as void* to use it as clientData
// (doing so it could be directly sent through the get/set callbacks)
void *barIndexAsVoidPtr = *(void **)&barIndex;
// Add a std::string variable to the bar to edit its title,
// The variable will be accessed through callbacks
TwAddVarCB(bar, "EditTitle", TW_TYPE_STDSTRING, SetBarTitleCB, GetBarTitleCB, barIndexAsVoidPtr,
" label='Edit bar title' help='Edit this string to change the tweak bar title.' ");
}
// ---------------------------------------------------------------------------
// 2) Callback functions for C-Dynamic string variables
// ---------------------------------------------------------------------------
// Function called to copy the content of a C-Dynamic String (src) handled by
// the AntTweakBar library to a C-Dynamic string (*destPtr) handled by our application
void TW_CALL CopyCDStringToClient(char **destPtr, const char *src)
{
size_t srcLen = (src!=NULL) ? strlen(src) : 0;
size_t destLen = (*destPtr!=NULL) ? strlen(*destPtr) : 0;
// Alloc or realloc dest memory block if needed
if( *destPtr==NULL )
*destPtr = (char *)malloc(srcLen+1);
else if( srcLen>destLen )
*destPtr = (char *)realloc(*destPtr, srcLen+1);
// Copy src
if( srcLen>0 )
strncpy(*destPtr, src, srcLen);
(*destPtr)[srcLen] = '\0'; // null-terminated string
}
// Callback function called by AntTweakBar to set the "TextLine" CDString variable
void TW_CALL SetTextLineCB(const void *value, void *clientData)
{
const char *src = *(const char **)value;
char **destPtr = (char **)clientData;
// Copies src to *destPtr (destPtr might be reallocated)
CopyCDStringToClient(destPtr, src);
// Change the label of the "Echo" inactive button
size_t srcLen = strlen(src);
if( srcLen>0 )
{
char *def = (char *)malloc(128+srcLen);
_snprintf(def, 128+srcLen, " Main/Echo label=`%s` ", src);
TwDefine(def);
free(def);
}
else
TwDefine(" Main/Echo label=` ` ");
}
// Callback function called by AntTweakBar to get the "TextLine" CDString variable
void TW_CALL GetTextLineCB(void *value, void *clientData)
{
char **destPtr = (char **)value;
char *src = *(char **)clientData;
// Do not assign destPtr directly:
// Use TwCopyCDStringToLibrary to copy TextLine to AntTweakBar
TwCopyCDStringToLibrary(destPtr, src);
}
// ---------------------------------------------------------------------------
// 3) Callback functions for C-Static sized string variables
// ---------------------------------------------------------------------------
// A static sized string
char g_CapStr[17] = "16 chars max"; // 17 = 16 + the null termination char
// A utility function: Convert a C string to lower or upper case
void CaseCopy(char *dest, const char *src, size_t maxLength, int capCase)
{
size_t i;
if( capCase==0 ) // lower case
for( i=0; i<maxLength-1 && src[i]!='\0'; ++i )
dest[i] = (char)tolower(src[i]);
else // upper case
for( i=0; i<maxLength-1 && src[i]!='\0'; ++i )
dest[i] = (char)toupper(src[i]);
dest[i] = '\0'; // ensure that dest is null-terminated
}
// Callback function called by AntTweakBar to set the "CapStr" CSString variable
void TW_CALL SetCapStrCB(const void *value, void *clientData)
{
const char *src = (const char *)value;
int capCase = *(int *)clientData;
CaseCopy(g_CapStr, src, sizeof(g_CapStr), capCase);
}
// Callback function called by AntTweakBar to get the "CapStr" CSString variable
void TW_CALL GetCapStrCB(void *value, void *clientData)
{
char *dest = (char *)value;
int capCase = *(int *)clientData;
CaseCopy(dest, g_CapStr, sizeof(g_CapStr), capCase);
}
// ---------------------------------------------------------------------------
// GLUT callbacks
// ---------------------------------------------------------------------------
// Callback function called by GLUT to render screen
void OnDisplay(void)
{
// Clear frame buffer
glClearColor(0.5f, 0.5f, 0.6f, 1);
glClear(GL_COLOR_BUFFER_BIT);
// App drawing here
// ...
// Draw tweak bars
TwDraw();
// Present frame buffer
glutSwapBuffers();
}
// Callback function called by GLUT when window size changes
void OnReshape(int width, int height)
{
// Set OpenGL viewport
glViewport(0, 0, width, height);
// Send the new window size to AntTweakBar
TwWindowSize(width, height);
}
// Function called at exit
void OnTerminate(void)
{
// terminate AntTweakBar
TwTerminate();
}
// Event callbacks
void OnMouseButton(int glutButton, int glutState, int mouseX, int mouseY)
{
// send event to AntTweakBar
if (TwEventMouseButtonGLUT(glutButton, glutState, mouseX, mouseY))
glutPostRedisplay(); // request redraw if event has been handled
}
void OnMouseMotion(int mouseX, int mouseY)
{
// send event to AntTweakBar
if (TwEventMouseMotionGLUT(mouseX, mouseY))
glutPostRedisplay(); // request redraw if event has been handled
}
void OnKeyboard(unsigned char glutKey, int mouseX, int mouseY)
{
// send event to AntTweakBar
if (TwEventKeyboardGLUT(glutKey, mouseX, mouseY))
glutPostRedisplay(); // request redraw if event has been handled
}
void OnSpecial(int glutKey, int mouseX, int mouseY)
{
// send event to AntTweakBar
if (TwEventSpecialGLUT(glutKey, mouseX, mouseY))
glutPostRedisplay(); // request redraw if event has been handled
}
// ---------------------------------------------------------------------------
// Main function (application based on GLUT)
// ---------------------------------------------------------------------------
int main(int argc, char *argv[])
{
// Initialize GLUT
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(640, 480);
glutCreateWindow("AntTweakBar string example");
glutCreateMenu(NULL);
// Set GLUT callbacks
glutDisplayFunc(OnDisplay);
glutReshapeFunc(OnReshape);
atexit(OnTerminate); // Called after glutMainLoop ends
// Initialize AntTweakBar
TwInit(TW_OPENGL, NULL);
// Set GLUT event callbacks
// - Directly redirect GLUT mouse button events to AntTweakBar
glutMouseFunc(OnMouseButton);
// - Directly redirect GLUT mouse motion events to AntTweakBar
glutMotionFunc(OnMouseMotion);
// - Directly redirect GLUT mouse "passive" motion events to AntTweakBar (same as MouseMotion)
glutPassiveMotionFunc(OnMouseMotion);
// - Directly redirect GLUT key events to AntTweakBar
glutKeyboardFunc(OnKeyboard);
// - Directly redirect GLUT special key events to AntTweakBar
glutSpecialFunc(OnSpecial);
// - Send 'glutGetModifers' function pointer to AntTweakBar;
// required because the GLUT key event functions do not report key modifiers states.
TwGLUTModifiersFunc(glutGetModifiers);
// Create a tweak bar
TwBar *bar = TwNewBar("Main");
TwDefine(" Main label='~ String variable examples ~' fontSize=3 position='180 16' size='270 440' valuesWidth=100 ");
//
// 1) C++ std::string variable example
//
TwAddButton(bar, "Info1.1", NULL, NULL, " label='1) This example uses' ");
TwAddButton(bar, "Info1.2", NULL, NULL, " label='std::string variables' ");
// Define the required callback function to copy a std::string (see TwCopyStdStringToClientFunc documentation)
TwCopyStdStringToClientFunc(CopyStdStringToClient);
// Adding a std::string variable
std::string newBarTitle = "a title";
TwAddVarRW(bar, "NewBarTitle", TW_TYPE_STDSTRING, &newBarTitle,
" label='Bar title' group=StdString help='Define a title for the new tweak bar.' ");
// Add a button to create a new bar using the title
TwAddButton(bar, "NewBarCreate", CreateBarCB, &newBarTitle,
" label='--> Create' group=StdString key=c help='Create a new tweak bar.' ");
// Set the group label & separator
TwDefine(" Main/StdString label='Create a new tweak bar' help='This example demonstates different use of std::string variables.' ");
TwAddSeparator(bar, "Sep1", "");
TwAddButton(bar, "Blank1", NULL, NULL, " label=' ' ");
//
// 2) C-Dynamic string variable example
//
TwAddButton(bar, "Info2.1", NULL, NULL, "label='2) This example uses' ");
TwAddButton(bar, "Info2.2", NULL, NULL, "label='C-Dynamic string variables' ");
// Define the required callback function to copy a CDString (see TwCopyCDStringToClientFunc documentation)
TwCopyCDStringToClientFunc(CopyCDStringToClient);
// Add a CDString variable
char *someText = NULL;
TwAddVarRW(bar, "Input", TW_TYPE_CDSTRING, &someText,
" label='Text input' group=CDString help=`The text to be copied to 'Text output'.` ");
TwAddVarRO(bar, "Output", TW_TYPE_CDSTRING, &someText,
" label='Text output' group=CDString help=`Carbon copy of the text entered in 'Text input'.` ");
// Add a line of text (we will use the label of a inactive button)
#define TEXTLINE "a line of text"
TwAddButton(bar, "Echo", NULL, NULL,
" label=`" TEXTLINE "` group=CDString help='Echo of the text entered in the next field' ");
// Add a CDString variable accessed through callbacks
char *textLine = (char *)malloc(sizeof(TEXTLINE)+1);
strncpy(textLine, TEXTLINE, sizeof(TEXTLINE));
TwAddVarCB(bar, "TextLine", TW_TYPE_CDSTRING, SetTextLineCB, GetTextLineCB, &textLine,
" label='Change text above' group=CDString help='The text to be echoed.' ");
// Set the group label & separator
TwDefine(" Main/CDString label='Echo some text' help='This example demonstates different use of C-Dynamic string variables.' ");
TwAddSeparator(bar, "Sep2", "");
TwAddButton(bar, "Blank2", NULL, NULL, " label=' ' ");
//
// 3) C-Static string variable example
//
TwAddButton(bar, "Info3.1", NULL, NULL, "label='3) This example uses' ");
TwAddButton(bar, "Info3.2", NULL, NULL, "label='C strings of fixed size' ");
// Add a CSString
char tenStr[] = "0123456789"; // 10 characters + null_termination_char -> size = 11
TwAddVarRW(bar, "Ten", TW_TYPE_CSSTRING(sizeof(tenStr)), tenStr,
" label='10 chars max' group=CSString help='A string with a length of 10 characters max.' ");
// Add a CSString accessed through callbacks. The callbacks will convert the string characters to upper or lower case
int capCase = 1; // O: lower-case, 1: upper-case
TwAddVarCB(bar, "Capitalize", TW_TYPE_CSSTRING(sizeof(g_CapStr)), SetCapStrCB, GetCapStrCB, &capCase,
" group=CSString help='A string of fixed size to be converted to upper or lower case.' ");
// Add a bool variable
TwAddVarRW(bar, "Case", TW_TYPE_BOOL32, &capCase,
" false=lower true=UPPER group=CSString key=Space help=`Changes the characters case of the 'Capitalize' string.` ");
// Set the group label & separator
TwDefine(" Main/CSString label='Character capitalization' help='This example demonstates different use of C-Static sized variables.' ");
TwAddSeparator(bar, "Sep3", "");
// Call the GLUT main loop
glutMainLoop();
return 0;
}

View File

@@ -0,0 +1,378 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="TwString"
ProjectGUID="{29C097AF-176E-4C36-A12E-E15B250D6835}"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="debug32"
IntermediateDirectory="tmp\debug32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glut32.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="../lib/debug,../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glut\lib\glut32.dll xcopy /y /f c:\sdk\glut\lib\glut32.dll debug32\.&#x0D;&#x0A;if exist bin32\glut32.dll xcopy /y /f bin32\glut32.dll debug32\."
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="debug64"
IntermediateDirectory="tmp\debug64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glut64.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="../lib/debug,../lib"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glut\lib\glut64.dll xcopy /y /f c:\sdk\glut\lib\glut64.dll debug64\.&#x0D;&#x0A;if exist bin64\glut64.dll xcopy /y /f bin64\glut64.dll debug64\.&#x0D;&#x0A;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="bin32"
IntermediateDirectory="tmp\bin32\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glut32.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glut\lib\glut32.dll xcopy /y /f c:\sdk\glut\lib\glut32.dll bin32\."
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="bin64"
IntermediateDirectory="tmp\bin64\$(ProjectName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN64;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glut64.lib opengl32.lib glu32.lib"
OutputFile="$(OutDir)/$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories="../lib"
GenerateManifest="false"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
SetChecksum="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist c:\sdk\glut\lib\glut64.dll xcopy /y /f c:\sdk\glut\lib\glut64.dll bin64\."
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="TwString.cpp"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,234 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{29C097AF-176E-4C36-A12E-E15B250D6835}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>debug32\</OutDir>
<IntDir>tmp\debug32\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>debug64\</OutDir>
<IntDir>tmp\debug64\$(ProjectName)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin32\</OutDir>
<IntDir>tmp\bin32\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>bin64\</OutDir>
<IntDir>tmp\bin64\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glut32.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glut\lib\glut32.dll xcopy /y /f c:\sdk\glut\lib\glut32.dll debug32\.
if exist bin32\glut32.dll xcopy /y /f bin32\glut32.dll debug32\.</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glut64.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib/debug;../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glut\lib\glut64.dll xcopy /y /f c:\sdk\glut\lib\glut64.dll debug64\.
if exist bin64\glut64.dll xcopy /y /f bin64\glut64.dll debug64\.
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat />
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glut32.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glut\lib\glut32.dll xcopy /y /f c:\sdk\glut\lib\glut32.dll bin32\.</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat />
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>glut64.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist c:\sdk\glut\lib\glut64.dll xcopy /y /f c:\sdk\glut\lib\glut64.dll bin64\.</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="TwString.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

Binary file not shown.

View File

@@ -0,0 +1,57 @@
This directory contains binaries of integration examples of the AntTweakBar
library with some common windowing toolkits, so that you can directly try
the library. GNU/Linux and OSX examples require recompilation depending on your
configuration.
Files with .exe extension are Windows versions.
Files without extension are GNU/Linux versions (they run the .out files)
---
License & copyright notices
- AntTweakBar
AntTweakBar.dll and Tw* files are part of the AntTweakBar library.
hhttp://anttweakbar.sourceforge.net/doc
AntTweakBar is a free software released under the zlib license.
For conditions of distribution and use, see ../../License.txt
- glfw.dll
GLFW is licensed under the zlib/libpng license:
http://www.glfw.org/license.html
- SDL.dll / SDL-1.3.dll
SDL (http://www.libsdl.org):
This library is distributed under the terms of the GNU LGPL license:
http://www.gnu.org/copyleft/lesser.html
- glut32.dll / glut64.dll
GLUT (http://opengl.org/resources/libraries/glut):
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. 64-bits support by Alexander Reshetov.
- SFML
This library is distributed under the terms of the zlib/libpng license:
http://www.sfml-dev.org/license.php

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,57 @@
This directory contains binaries of integration examples of the AntTweakBar
library with some common windowing toolkits, so that you can directly try
the library. GNU/Linux and OSX examples require recompilation depending on your
configuration.
Files with .exe extension are Windows versions.
Files without extension are GNU/Linux versions (they run the .out files)
---
License & copyright notices
- AntTweakBar
AntTweakBar.dll and Tw* files are part of the AntTweakBar library.
http://anttweakbar.sourceforge.net/doc
AntTweakBar is a free software released under the zlib license.
For conditions of distribution and use, see ../../License.txt
- glfw.dll
GLFW is licensed under the zlib/libpng license:
http://www.glfw.org/license.html
- SDL.dll / SDL-1.3.dll
SDL (http://www.libsdl.org):
This library is distributed under the terms of the GNU LGPL license:
http://www.gnu.org/copyleft/lesser.html
- glut32.dll / glut64.dll
GLUT (http://opengl.org/resources/libraries/glut):
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. 64-bits support by Alexander Reshetov.
- SFML
This library is distributed under the terms of the zlib/libpng license:
http://www.sfml-dev.org/license.php

Binary file not shown.

View File

@@ -0,0 +1,46 @@
// Workaround to include D3D10.h with VS2003
#ifndef __out
#define __out
#endif
#ifndef __in
#define __in
#endif
#ifndef __inout
#define __inout
#endif
#ifndef __in_opt
#define __in_opt
#endif
#ifndef __out_opt
#define __out_opt
#endif
#ifndef __inout_opt
#define __inout_opt
#endif
#ifndef __in_ecount
#define __in_ecount(x)
#endif
#ifndef __in_ecount_opt
#define __in_ecount_opt(x)
#endif
#ifndef __out_ecount
#define __out_ecount(x)
#endif
#ifndef __out_ecount_opt
#define __out_ecount_opt(x)
#endif
#ifndef __inout_ecount
#define __inout_ecount(x)
#endif
#ifndef __inout_ecount_opt
#define __inout_ecount_opt(x)
#endif
#ifndef __in_bcount_opt
#define __in_bcount_opt(x)
#endif
#ifndef __out_bcount_opt
#define __out_bcount_opt(x)
#endif
#ifndef __inout_bcount_opt
#define __inout_bcount_opt(x)
#endif

482
AntTweakBar/examples/glfw.h Normal file
View File

@@ -0,0 +1,482 @@
//========================================================================
// GLFW - An OpenGL framework
// File: glfw.h
// API version: 2.5
// Author: Marcus Geelnard (marcus.geelnard at home.se)
// WWW: http://glfw.sourceforge.net
//------------------------------------------------------------------------
// Copyright (c) 2002-2005 Marcus Geelnard
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
// Marcus Geelnard
// marcus.geelnard at home.se
//------------------------------------------------------------------------
// $Id: glfw.h,v 1.16 2005/03/14 20:52:51 marcus256 Exp $
//========================================================================
#ifndef __glfw_h_
#define __glfw_h_
#ifdef __cplusplus
extern "C" {
#endif
//========================================================================
// Global definitions
//========================================================================
// We need a NULL pointer from time to time
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif // NULL
// ------------------- BEGIN SYSTEM/COMPILER SPECIFIC --------------------
// Please report any probles that you find with your compiler, which may
// be solved in this section! There are several compilers that I have not
// been able to test this file with yet.
// First: If we are we on Windows, we want a single define for it (_WIN32)
// (Note: For Cygwin the compiler flag -mwin32 should be used, but to
// make sure that things run smoothly for Cygwin users, we add __CYGWIN__
// to the list of "valid Win32 identifiers", which removes the need for
// -mwin32)
#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__))
#define _WIN32
#endif // _WIN32
// In order for extension support to be portable, we need to define an
// OpenGL function call method. We use the keyword APIENTRY, which is
// defined for Win32. (Note: Windows also needs this for <GL/gl.h>)
#ifndef APIENTRY
#ifdef _WIN32
#define APIENTRY __stdcall
#else
#define APIENTRY
#endif
#define GL_APIENTRY_DEFINED
#endif // APIENTRY
// The following three defines are here solely to make some Windows-based
// <GL/gl.h> files happy. Theoretically we could include <windows.h>, but
// it has the major drawback of severely polluting our namespace.
// Under Windows, we need WINGDIAPI defined
#if !defined(WINGDIAPI) && defined(_WIN32)
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__)
// Microsoft Visual C++, Borland C++ Builder and Pelles C
#define WINGDIAPI __declspec(dllimport)
#elif defined(__LCC__)
// LCC-Win32
#define WINGDIAPI __stdcall
#else
// Others (e.g. MinGW, Cygwin)
#define WINGDIAPI extern
#endif
#define GL_WINGDIAPI_DEFINED
#endif // WINGDIAPI
// Some <GL/glu.h> files also need CALLBACK defined
#if !defined(CALLBACK) && defined(_WIN32)
#if defined(_MSC_VER)
// Microsoft Visual C++
#if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
#define CALLBACK __stdcall
#else
#define CALLBACK
#endif
#else
// Other Windows compilers
#define CALLBACK __stdcall
#endif
#define GLU_CALLBACK_DEFINED
#endif // CALLBACK
// Microsoft Visual C++, Borland C++ and Pelles C <GL/glu.h> needs wchar_t
#if defined(_WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__)) && !defined(_WCHAR_T_DEFINED)
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif // _WCHAR_T_DEFINED
// ---------------- GLFW related system specific defines -----------------
#if defined(_WIN32) && defined(GLFW_BUILD_DLL)
// We are building a Win32 DLL
#define GLFWAPI __declspec(dllexport)
#define GLFWAPIENTRY __stdcall
#define GLFWCALL __stdcall
#elif defined(_WIN32) && defined(GLFW_DLL)
// We are calling a Win32 DLL
#if defined(__LCC__)
#define GLFWAPI extern
#else
#define GLFWAPI __declspec(dllimport)
#endif
#define GLFWAPIENTRY __stdcall
#define GLFWCALL __stdcall
#else
// We are either building/calling a static lib or we are non-win32
#define GLFWAPIENTRY
#define GLFWAPI
#define GLFWCALL
#endif
// -------------------- END SYSTEM/COMPILER SPECIFIC ---------------------
// Include standard OpenGL headers: GLFW uses GL_FALSE/GL_TRUE, and it is
// convenient for the user to only have to include <GL/glfw.h>. This also
// solves the problem with Windows <GL/gl.h> and <GL/glu.h> needing some
// special defines which normally requires the user to include <windows.h>
// (which is not a nice solution for portable programs).
#if defined(__APPLE_CC__)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif
//========================================================================
// GLFW version
//========================================================================
#define GLFW_VERSION_MAJOR 2
#define GLFW_VERSION_MINOR 5
#define GLFW_VERSION_REVISION 0
//========================================================================
// Input handling definitions
//========================================================================
// Key and button state/action definitions
#define GLFW_RELEASE 0
#define GLFW_PRESS 1
// Keyboard key definitions: 8-bit ISO-8859-1 (Latin 1) encoding is used
// for printable keys (such as A-Z, 0-9 etc), and values above 256
// represent special (non-printable) keys (e.g. F1, Page Up etc).
#define GLFW_KEY_UNKNOWN -1
#define GLFW_KEY_SPACE 32
#define GLFW_KEY_SPECIAL 256
#define GLFW_KEY_ESC (GLFW_KEY_SPECIAL+1)
#define GLFW_KEY_F1 (GLFW_KEY_SPECIAL+2)
#define GLFW_KEY_F2 (GLFW_KEY_SPECIAL+3)
#define GLFW_KEY_F3 (GLFW_KEY_SPECIAL+4)
#define GLFW_KEY_F4 (GLFW_KEY_SPECIAL+5)
#define GLFW_KEY_F5 (GLFW_KEY_SPECIAL+6)
#define GLFW_KEY_F6 (GLFW_KEY_SPECIAL+7)
#define GLFW_KEY_F7 (GLFW_KEY_SPECIAL+8)
#define GLFW_KEY_F8 (GLFW_KEY_SPECIAL+9)
#define GLFW_KEY_F9 (GLFW_KEY_SPECIAL+10)
#define GLFW_KEY_F10 (GLFW_KEY_SPECIAL+11)
#define GLFW_KEY_F11 (GLFW_KEY_SPECIAL+12)
#define GLFW_KEY_F12 (GLFW_KEY_SPECIAL+13)
#define GLFW_KEY_F13 (GLFW_KEY_SPECIAL+14)
#define GLFW_KEY_F14 (GLFW_KEY_SPECIAL+15)
#define GLFW_KEY_F15 (GLFW_KEY_SPECIAL+16)
#define GLFW_KEY_F16 (GLFW_KEY_SPECIAL+17)
#define GLFW_KEY_F17 (GLFW_KEY_SPECIAL+18)
#define GLFW_KEY_F18 (GLFW_KEY_SPECIAL+19)
#define GLFW_KEY_F19 (GLFW_KEY_SPECIAL+20)
#define GLFW_KEY_F20 (GLFW_KEY_SPECIAL+21)
#define GLFW_KEY_F21 (GLFW_KEY_SPECIAL+22)
#define GLFW_KEY_F22 (GLFW_KEY_SPECIAL+23)
#define GLFW_KEY_F23 (GLFW_KEY_SPECIAL+24)
#define GLFW_KEY_F24 (GLFW_KEY_SPECIAL+25)
#define GLFW_KEY_F25 (GLFW_KEY_SPECIAL+26)
#define GLFW_KEY_UP (GLFW_KEY_SPECIAL+27)
#define GLFW_KEY_DOWN (GLFW_KEY_SPECIAL+28)
#define GLFW_KEY_LEFT (GLFW_KEY_SPECIAL+29)
#define GLFW_KEY_RIGHT (GLFW_KEY_SPECIAL+30)
#define GLFW_KEY_LSHIFT (GLFW_KEY_SPECIAL+31)
#define GLFW_KEY_RSHIFT (GLFW_KEY_SPECIAL+32)
#define GLFW_KEY_LCTRL (GLFW_KEY_SPECIAL+33)
#define GLFW_KEY_RCTRL (GLFW_KEY_SPECIAL+34)
#define GLFW_KEY_LALT (GLFW_KEY_SPECIAL+35)
#define GLFW_KEY_RALT (GLFW_KEY_SPECIAL+36)
#define GLFW_KEY_TAB (GLFW_KEY_SPECIAL+37)
#define GLFW_KEY_ENTER (GLFW_KEY_SPECIAL+38)
#define GLFW_KEY_BACKSPACE (GLFW_KEY_SPECIAL+39)
#define GLFW_KEY_INSERT (GLFW_KEY_SPECIAL+40)
#define GLFW_KEY_DEL (GLFW_KEY_SPECIAL+41)
#define GLFW_KEY_PAGEUP (GLFW_KEY_SPECIAL+42)
#define GLFW_KEY_PAGEDOWN (GLFW_KEY_SPECIAL+43)
#define GLFW_KEY_HOME (GLFW_KEY_SPECIAL+44)
#define GLFW_KEY_END (GLFW_KEY_SPECIAL+45)
#define GLFW_KEY_KP_0 (GLFW_KEY_SPECIAL+46)
#define GLFW_KEY_KP_1 (GLFW_KEY_SPECIAL+47)
#define GLFW_KEY_KP_2 (GLFW_KEY_SPECIAL+48)
#define GLFW_KEY_KP_3 (GLFW_KEY_SPECIAL+49)
#define GLFW_KEY_KP_4 (GLFW_KEY_SPECIAL+50)
#define GLFW_KEY_KP_5 (GLFW_KEY_SPECIAL+51)
#define GLFW_KEY_KP_6 (GLFW_KEY_SPECIAL+52)
#define GLFW_KEY_KP_7 (GLFW_KEY_SPECIAL+53)
#define GLFW_KEY_KP_8 (GLFW_KEY_SPECIAL+54)
#define GLFW_KEY_KP_9 (GLFW_KEY_SPECIAL+55)
#define GLFW_KEY_KP_DIVIDE (GLFW_KEY_SPECIAL+56)
#define GLFW_KEY_KP_MULTIPLY (GLFW_KEY_SPECIAL+57)
#define GLFW_KEY_KP_SUBTRACT (GLFW_KEY_SPECIAL+58)
#define GLFW_KEY_KP_ADD (GLFW_KEY_SPECIAL+59)
#define GLFW_KEY_KP_DECIMAL (GLFW_KEY_SPECIAL+60)
#define GLFW_KEY_KP_EQUAL (GLFW_KEY_SPECIAL+61)
#define GLFW_KEY_KP_ENTER (GLFW_KEY_SPECIAL+62)
#define GLFW_KEY_LAST GLFW_KEY_KP_ENTER
// Mouse button definitions
#define GLFW_MOUSE_BUTTON_1 0
#define GLFW_MOUSE_BUTTON_2 1
#define GLFW_MOUSE_BUTTON_3 2
#define GLFW_MOUSE_BUTTON_4 3
#define GLFW_MOUSE_BUTTON_5 4
#define GLFW_MOUSE_BUTTON_6 5
#define GLFW_MOUSE_BUTTON_7 6
#define GLFW_MOUSE_BUTTON_8 7
#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
// Mouse button aliases
#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
// Joystick identifiers
#define GLFW_JOYSTICK_1 0
#define GLFW_JOYSTICK_2 1
#define GLFW_JOYSTICK_3 2
#define GLFW_JOYSTICK_4 3
#define GLFW_JOYSTICK_5 4
#define GLFW_JOYSTICK_6 5
#define GLFW_JOYSTICK_7 6
#define GLFW_JOYSTICK_8 7
#define GLFW_JOYSTICK_9 8
#define GLFW_JOYSTICK_10 9
#define GLFW_JOYSTICK_11 10
#define GLFW_JOYSTICK_12 11
#define GLFW_JOYSTICK_13 12
#define GLFW_JOYSTICK_14 13
#define GLFW_JOYSTICK_15 14
#define GLFW_JOYSTICK_16 15
#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
//========================================================================
// Other definitions
//========================================================================
// glfwOpenWindow modes
#define GLFW_WINDOW 0x00010001
#define GLFW_FULLSCREEN 0x00010002
// glfwGetWindowParam tokens
#define GLFW_OPENED 0x00020001
#define GLFW_ACTIVE 0x00020002
#define GLFW_ICONIFIED 0x00020003
#define GLFW_ACCELERATED 0x00020004
#define GLFW_RED_BITS 0x00020005
#define GLFW_GREEN_BITS 0x00020006
#define GLFW_BLUE_BITS 0x00020007
#define GLFW_ALPHA_BITS 0x00020008
#define GLFW_DEPTH_BITS 0x00020009
#define GLFW_STENCIL_BITS 0x0002000A
// The following constants are used for both glfwGetWindowParam
// and glfwOpenWindowHint
#define GLFW_REFRESH_RATE 0x0002000B
#define GLFW_ACCUM_RED_BITS 0x0002000C
#define GLFW_ACCUM_GREEN_BITS 0x0002000D
#define GLFW_ACCUM_BLUE_BITS 0x0002000E
#define GLFW_ACCUM_ALPHA_BITS 0x0002000F
#define GLFW_AUX_BUFFERS 0x00020010
#define GLFW_STEREO 0x00020011
// glfwEnable/glfwDisable tokens
#define GLFW_MOUSE_CURSOR 0x00030001
#define GLFW_STICKY_KEYS 0x00030002
#define GLFW_STICKY_MOUSE_BUTTONS 0x00030003
#define GLFW_SYSTEM_KEYS 0x00030004
#define GLFW_KEY_REPEAT 0x00030005
#define GLFW_AUTO_POLL_EVENTS 0x00030006
// glfwWaitThread wait modes
#define GLFW_WAIT 0x00040001
#define GLFW_NOWAIT 0x00040002
// glfwGetJoystickParam tokens
#define GLFW_PRESENT 0x00050001
#define GLFW_AXES 0x00050002
#define GLFW_BUTTONS 0x00050003
// glfwReadImage/glfwLoadTexture2D flags
#define GLFW_NO_RESCALE_BIT 0x00000001 // Only for glfwReadImage
#define GLFW_ORIGIN_UL_BIT 0x00000002
#define GLFW_BUILD_MIPMAPS_BIT 0x00000004 // Only for glfwLoadTexture2D
#define GLFW_ALPHA_MAP_BIT 0x00000008
// Time spans longer than this (seconds) are considered to be infinity
#define GLFW_INFINITY 100000.0
//========================================================================
// Typedefs
//========================================================================
// The video mode structure used by glfwGetVideoModes()
typedef struct {
int Width, Height;
int RedBits, BlueBits, GreenBits;
} GLFWvidmode;
// Image/texture information
typedef struct {
int Width, Height;
int Format;
int BytesPerPixel;
unsigned char *Data;
} GLFWimage;
// Thread ID
typedef int GLFWthread;
// Mutex object
typedef void * GLFWmutex;
// Condition variable object
typedef void * GLFWcond;
// Function pointer types
typedef void (GLFWCALL * GLFWwindowsizefun)(int,int);
typedef int (GLFWCALL * GLFWwindowclosefun)(void);
typedef void (GLFWCALL * GLFWwindowrefreshfun)(void);
typedef void (GLFWCALL * GLFWmousebuttonfun)(int,int);
typedef void (GLFWCALL * GLFWmouseposfun)(int,int);
typedef void (GLFWCALL * GLFWmousewheelfun)(int);
typedef void (GLFWCALL * GLFWkeyfun)(int,int);
typedef void (GLFWCALL * GLFWcharfun)(int,int);
typedef void (GLFWCALL * GLFWthreadfun)(void *);
//========================================================================
// Prototypes
//========================================================================
// GLFW initialization, termination and version querying
GLFWAPI int GLFWAPIENTRY glfwInit( void );
GLFWAPI void GLFWAPIENTRY glfwTerminate( void );
GLFWAPI void GLFWAPIENTRY glfwGetVersion( int *major, int *minor, int *rev );
// Window handling
GLFWAPI int GLFWAPIENTRY glfwOpenWindow( int width, int height, int redbits, int greenbits, int bluebits, int alphabits, int depthbits, int stencilbits, int mode );
GLFWAPI void GLFWAPIENTRY glfwOpenWindowHint( int target, int hint );
GLFWAPI void GLFWAPIENTRY glfwCloseWindow( void );
GLFWAPI void GLFWAPIENTRY glfwSetWindowTitle( const char *title );
GLFWAPI void GLFWAPIENTRY glfwGetWindowSize( int *width, int *height );
GLFWAPI void GLFWAPIENTRY glfwSetWindowSize( int width, int height );
GLFWAPI void GLFWAPIENTRY glfwSetWindowPos( int x, int y );
GLFWAPI void GLFWAPIENTRY glfwIconifyWindow( void );
GLFWAPI void GLFWAPIENTRY glfwRestoreWindow( void );
GLFWAPI void GLFWAPIENTRY glfwSwapBuffers( void );
GLFWAPI void GLFWAPIENTRY glfwSwapInterval( int interval );
GLFWAPI int GLFWAPIENTRY glfwGetWindowParam( int param );
GLFWAPI void GLFWAPIENTRY glfwSetWindowSizeCallback( GLFWwindowsizefun cbfun );
GLFWAPI void GLFWAPIENTRY glfwSetWindowCloseCallback( GLFWwindowclosefun cbfun );
GLFWAPI void GLFWAPIENTRY glfwSetWindowRefreshCallback( GLFWwindowrefreshfun cbfun );
// Video mode functions
GLFWAPI int GLFWAPIENTRY glfwGetVideoModes( GLFWvidmode *list, int maxcount );
GLFWAPI void GLFWAPIENTRY glfwGetDesktopMode( GLFWvidmode *mode );
// Input handling
GLFWAPI void GLFWAPIENTRY glfwPollEvents( void );
GLFWAPI void GLFWAPIENTRY glfwWaitEvents( void );
GLFWAPI int GLFWAPIENTRY glfwGetKey( int key );
GLFWAPI int GLFWAPIENTRY glfwGetMouseButton( int button );
GLFWAPI void GLFWAPIENTRY glfwGetMousePos( int *xpos, int *ypos );
GLFWAPI void GLFWAPIENTRY glfwSetMousePos( int xpos, int ypos );
GLFWAPI int GLFWAPIENTRY glfwGetMouseWheel( void );
GLFWAPI void GLFWAPIENTRY glfwSetMouseWheel( int pos );
GLFWAPI void GLFWAPIENTRY glfwSetKeyCallback( GLFWkeyfun cbfun );
GLFWAPI void GLFWAPIENTRY glfwSetCharCallback( GLFWcharfun cbfun );
GLFWAPI void GLFWAPIENTRY glfwSetMouseButtonCallback( GLFWmousebuttonfun cbfun );
GLFWAPI void GLFWAPIENTRY glfwSetMousePosCallback( GLFWmouseposfun cbfun );
GLFWAPI void GLFWAPIENTRY glfwSetMouseWheelCallback( GLFWmousewheelfun cbfun );
// Joystick input
GLFWAPI int GLFWAPIENTRY glfwGetJoystickParam( int joy, int param );
GLFWAPI int GLFWAPIENTRY glfwGetJoystickPos( int joy, float *pos, int numaxes );
GLFWAPI int GLFWAPIENTRY glfwGetJoystickButtons( int joy, unsigned char *buttons, int numbuttons );
// Time
GLFWAPI double GLFWAPIENTRY glfwGetTime( void );
GLFWAPI void GLFWAPIENTRY glfwSetTime( double time );
GLFWAPI void GLFWAPIENTRY glfwSleep( double time );
// Extension support
GLFWAPI int GLFWAPIENTRY glfwExtensionSupported( const char *extension );
GLFWAPI void* GLFWAPIENTRY glfwGetProcAddress( const char *procname );
GLFWAPI void GLFWAPIENTRY glfwGetGLVersion( int *major, int *minor, int *rev );
// Threading support
GLFWAPI GLFWthread GLFWAPIENTRY glfwCreateThread( GLFWthreadfun fun, void *arg );
GLFWAPI void GLFWAPIENTRY glfwDestroyThread( GLFWthread ID );
GLFWAPI int GLFWAPIENTRY glfwWaitThread( GLFWthread ID, int waitmode );
GLFWAPI GLFWthread GLFWAPIENTRY glfwGetThreadID( void );
GLFWAPI GLFWmutex GLFWAPIENTRY glfwCreateMutex( void );
GLFWAPI void GLFWAPIENTRY glfwDestroyMutex( GLFWmutex mutex );
GLFWAPI void GLFWAPIENTRY glfwLockMutex( GLFWmutex mutex );
GLFWAPI void GLFWAPIENTRY glfwUnlockMutex( GLFWmutex mutex );
GLFWAPI GLFWcond GLFWAPIENTRY glfwCreateCond( void );
GLFWAPI void GLFWAPIENTRY glfwDestroyCond( GLFWcond cond );
GLFWAPI void GLFWAPIENTRY glfwWaitCond( GLFWcond cond, GLFWmutex mutex, double timeout );
GLFWAPI void GLFWAPIENTRY glfwSignalCond( GLFWcond cond );
GLFWAPI void GLFWAPIENTRY glfwBroadcastCond( GLFWcond cond );
GLFWAPI int GLFWAPIENTRY glfwGetNumberOfProcessors( void );
// Enable/disable functions
GLFWAPI void GLFWAPIENTRY glfwEnable( int token );
GLFWAPI void GLFWAPIENTRY glfwDisable( int token );
// Image/texture I/O support
GLFWAPI int GLFWAPIENTRY glfwReadImage( const char *name, GLFWimage *img, int flags );
GLFWAPI void GLFWAPIENTRY glfwFreeImage( GLFWimage *img );
GLFWAPI int GLFWAPIENTRY glfwLoadTexture2D( const char *name, int flags );
#ifdef __cplusplus
}
#endif
#endif // __glfw_h_

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,378 @@
// ----------------------------------------------------------------------------
//
// @file AntTweakBar.h
//
// @brief AntTweakBar is a light and intuitive graphical user interface
// that can be readily integrated into OpenGL and DirectX
// applications in order to interactively tweak parameters.
//
// @author Philippe Decaudin
//
// @doc http://anttweakbar.sourceforge.net/doc
//
// @license This file is part of the AntTweakBar library.
// AntTweakBar is a free software released under the zlib license.
// For conditions of distribution and use, see License.txt
//
// ----------------------------------------------------------------------------
#if !defined TW_INCLUDED
#define TW_INCLUDED
#include <stddef.h>
#define TW_VERSION 116 // Version Mmm : M=Major mm=minor (e.g., 102 is version 1.02)
#ifdef __cplusplus
# if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable: 4995 4530)
# include <string>
# pragma warning(pop)
# else
# include <string>
# endif
extern "C" {
#endif // __cplusplus
// ----------------------------------------------------------------------------
// OS specific definitions
// ----------------------------------------------------------------------------
#if (defined(_WIN32) || defined(_WIN64)) && !defined(TW_STATIC)
# define TW_CALL __stdcall
# define TW_CDECL_CALL __cdecl
# define TW_EXPORT_API __declspec(dllexport)
# define TW_IMPORT_API __declspec(dllimport)
#else
# define TW_CALL
# define TW_CDECL_CALL
# define TW_EXPORT_API
# define TW_IMPORT_API
#endif
#if defined TW_EXPORTS
# define TW_API TW_EXPORT_API
#elif defined TW_STATIC
# define TW_API
# if defined(_MSC_VER) && !defined(TW_NO_LIB_PRAGMA)
# ifdef _WIN64
# pragma comment(lib, "AntTweakBarStatic64")
# else
# pragma comment(lib, "AntTweakBarStatic")
# endif
# endif
#else
# define TW_API TW_IMPORT_API
# if defined(_MSC_VER) && !defined(TW_NO_LIB_PRAGMA)
# ifdef _WIN64
# pragma comment(lib, "AntTweakBar64")
# else
# pragma comment(lib, "AntTweakBar")
# endif
# endif
#endif
// ----------------------------------------------------------------------------
// Bar functions and definitions
// ----------------------------------------------------------------------------
typedef struct CTwBar TwBar; // structure CTwBar is not exposed.
TW_API TwBar * TW_CALL TwNewBar(const char *barName);
TW_API int TW_CALL TwDeleteBar(TwBar *bar);
TW_API int TW_CALL TwDeleteAllBars();
TW_API int TW_CALL TwSetTopBar(const TwBar *bar);
TW_API TwBar * TW_CALL TwGetTopBar();
TW_API int TW_CALL TwSetBottomBar(const TwBar *bar);
TW_API TwBar * TW_CALL TwGetBottomBar();
TW_API const char * TW_CALL TwGetBarName(const TwBar *bar);
TW_API int TW_CALL TwGetBarCount();
TW_API TwBar * TW_CALL TwGetBarByIndex(int barIndex);
TW_API TwBar * TW_CALL TwGetBarByName(const char *barName);
TW_API int TW_CALL TwRefreshBar(TwBar *bar);
// ----------------------------------------------------------------------------
// Var functions and definitions
// ----------------------------------------------------------------------------
typedef enum ETwType
{
TW_TYPE_UNDEF = 0,
#ifdef __cplusplus
TW_TYPE_BOOLCPP = 1,
#endif // __cplusplus
TW_TYPE_BOOL8 = 2,
TW_TYPE_BOOL16,
TW_TYPE_BOOL32,
TW_TYPE_CHAR,
TW_TYPE_INT8,
TW_TYPE_UINT8,
TW_TYPE_INT16,
TW_TYPE_UINT16,
TW_TYPE_INT32,
TW_TYPE_UINT32,
TW_TYPE_FLOAT,
TW_TYPE_DOUBLE,
TW_TYPE_COLOR32, // 32 bits color. Order is RGBA if API is OpenGL or Direct3D10, and inversed if API is Direct3D9 (can be modified by defining 'colorOrder=...', see doc)
TW_TYPE_COLOR3F, // 3 floats color. Order is RGB.
TW_TYPE_COLOR4F, // 4 floats color. Order is RGBA.
TW_TYPE_CDSTRING, // Null-terminated C Dynamic String (pointer to an array of char dynamically allocated with malloc/realloc/strdup)
#ifdef __cplusplus
# if defined(_MSC_VER) && (_MSC_VER == 1600)
TW_TYPE_STDSTRING = (0x2ffe0000+sizeof(std::string)), // VS2010 C++ STL string (std::string)
# else
TW_TYPE_STDSTRING = (0x2fff0000+sizeof(std::string)), // C++ STL string (std::string)
# endif
#endif // __cplusplus
TW_TYPE_QUAT4F = TW_TYPE_CDSTRING+2, // 4 floats encoding a quaternion {qx,qy,qz,qs}
TW_TYPE_QUAT4D, // 4 doubles encoding a quaternion {qx,qy,qz,qs}
TW_TYPE_DIR3F, // direction vector represented by 3 floats
TW_TYPE_DIR3D // direction vector represented by 3 doubles
} TwType;
#define TW_TYPE_CSSTRING(n) ((TwType)(0x30000000+((n)&0xfffffff))) // Null-terminated C Static String of size n (defined as char[n], with n<2^28)
typedef void (TW_CALL * TwSetVarCallback)(const void *value, void *clientData);
typedef void (TW_CALL * TwGetVarCallback)(void *value, void *clientData);
typedef void (TW_CALL * TwButtonCallback)(void *clientData);
TW_API int TW_CALL TwAddVarRW(TwBar *bar, const char *name, TwType type, void *var, const char *def);
TW_API int TW_CALL TwAddVarRO(TwBar *bar, const char *name, TwType type, const void *var, const char *def);
TW_API int TW_CALL TwAddVarCB(TwBar *bar, const char *name, TwType type, TwSetVarCallback setCallback, TwGetVarCallback getCallback, void *clientData, const char *def);
TW_API int TW_CALL TwAddButton(TwBar *bar, const char *name, TwButtonCallback callback, void *clientData, const char *def);
TW_API int TW_CALL TwAddSeparator(TwBar *bar, const char *name, const char *def);
TW_API int TW_CALL TwRemoveVar(TwBar *bar, const char *name);
TW_API int TW_CALL TwRemoveAllVars(TwBar *bar);
typedef struct CTwEnumVal
{
int Value;
const char * Label;
} TwEnumVal;
typedef struct CTwStructMember
{
const char * Name;
TwType Type;
size_t Offset;
const char * DefString;
} TwStructMember;
typedef void (TW_CALL * TwSummaryCallback)(char *summaryString, size_t summaryMaxLength, const void *value, void *clientData);
TW_API int TW_CALL TwDefine(const char *def);
TW_API TwType TW_CALL TwDefineEnum(const char *name, const TwEnumVal *enumValues, unsigned int nbValues);
TW_API TwType TW_CALL TwDefineEnumFromString(const char *name, const char *enumString);
TW_API TwType TW_CALL TwDefineStruct(const char *name, const TwStructMember *structMembers, unsigned int nbMembers, size_t structSize, TwSummaryCallback summaryCallback, void *summaryClientData);
typedef void (TW_CALL * TwCopyCDStringToClient)(char **destinationClientStringPtr, const char *sourceString);
TW_API void TW_CALL TwCopyCDStringToClientFunc(TwCopyCDStringToClient copyCDStringFunc);
TW_API void TW_CALL TwCopyCDStringToLibrary(char **destinationLibraryStringPtr, const char *sourceClientString);
#ifdef __cplusplus
typedef void (TW_CALL * TwCopyStdStringToClient)(std::string& destinationClientString, const std::string& sourceString);
TW_API void TW_CALL TwCopyStdStringToClientFunc(TwCopyStdStringToClient copyStdStringToClientFunc);
TW_API void TW_CALL TwCopyStdStringToLibrary(std::string& destinationLibraryString, const std::string& sourceClientString);
#endif // __cplusplus
typedef enum ETwParamValueType
{
TW_PARAM_INT32,
TW_PARAM_FLOAT,
TW_PARAM_DOUBLE,
TW_PARAM_CSTRING // Null-terminated array of char (ie, c-string)
} TwParamValueType;
TW_API int TW_CALL TwGetParam(TwBar *bar, const char *varName, const char *paramName, TwParamValueType paramValueType, unsigned int outValueMaxCount, void *outValues);
TW_API int TW_CALL TwSetParam(TwBar *bar, const char *varName, const char *paramName, TwParamValueType paramValueType, unsigned int inValueCount, const void *inValues);
// ----------------------------------------------------------------------------
// Management functions and definitions
// ----------------------------------------------------------------------------
typedef enum ETwGraphAPI
{
TW_OPENGL = 1,
TW_DIRECT3D9 = 2,
TW_DIRECT3D10 = 3,
TW_DIRECT3D11 = 4,
TW_OPENGL_CORE = 5
} TwGraphAPI;
TW_API int TW_CALL TwInit(TwGraphAPI graphAPI, void *device);
TW_API int TW_CALL TwTerminate();
TW_API int TW_CALL TwDraw();
TW_API int TW_CALL TwWindowSize(int width, int height);
TW_API int TW_CALL TwSetCurrentWindow(int windowID); // multi-windows support
TW_API int TW_CALL TwGetCurrentWindow();
TW_API int TW_CALL TwWindowExists(int windowID);
typedef enum ETwKeyModifier
{
TW_KMOD_NONE = 0x0000, // same codes as SDL keysym.mod
TW_KMOD_SHIFT = 0x0003,
TW_KMOD_CTRL = 0x00c0,
TW_KMOD_ALT = 0x0100,
TW_KMOD_META = 0x0c00
} TwKeyModifier;
typedef enum EKeySpecial
{
TW_KEY_BACKSPACE = '\b',
TW_KEY_TAB = '\t',
TW_KEY_CLEAR = 0x0c,
TW_KEY_RETURN = '\r',
TW_KEY_PAUSE = 0x13,
TW_KEY_ESCAPE = 0x1b,
TW_KEY_SPACE = ' ',
TW_KEY_DELETE = 0x7f,
TW_KEY_UP = 273, // same codes and order as SDL 1.2 keysym.sym
TW_KEY_DOWN,
TW_KEY_RIGHT,
TW_KEY_LEFT,
TW_KEY_INSERT,
TW_KEY_HOME,
TW_KEY_END,
TW_KEY_PAGE_UP,
TW_KEY_PAGE_DOWN,
TW_KEY_F1,
TW_KEY_F2,
TW_KEY_F3,
TW_KEY_F4,
TW_KEY_F5,
TW_KEY_F6,
TW_KEY_F7,
TW_KEY_F8,
TW_KEY_F9,
TW_KEY_F10,
TW_KEY_F11,
TW_KEY_F12,
TW_KEY_F13,
TW_KEY_F14,
TW_KEY_F15,
TW_KEY_LAST
} TwKeySpecial;
TW_API int TW_CALL TwKeyPressed(int key, int modifiers);
TW_API int TW_CALL TwKeyTest(int key, int modifiers);
typedef enum ETwMouseAction
{
TW_MOUSE_RELEASED,
TW_MOUSE_PRESSED
} TwMouseAction;
typedef enum ETwMouseButtonID
{
TW_MOUSE_LEFT = 1, // same code as SDL_BUTTON_LEFT
TW_MOUSE_MIDDLE = 2, // same code as SDL_BUTTON_MIDDLE
TW_MOUSE_RIGHT = 3 // same code as SDL_BUTTON_RIGHT
} TwMouseButtonID;
TW_API int TW_CALL TwMouseButton(TwMouseAction action, TwMouseButtonID button);
TW_API int TW_CALL TwMouseMotion(int mouseX, int mouseY);
TW_API int TW_CALL TwMouseWheel(int pos);
TW_API const char * TW_CALL TwGetLastError();
typedef void (TW_CALL * TwErrorHandler)(const char *errorMessage);
TW_API void TW_CALL TwHandleErrors(TwErrorHandler errorHandler);
// ----------------------------------------------------------------------------
// Helper functions to translate events from some common window management
// frameworks to AntTweakBar.
// They call TwKeyPressed, TwMouse* and TwWindowSize for you (implemented in
// files TwEventWin.c TwEventSDL*.c TwEventGLFW.c TwEventGLUT.c)
// ----------------------------------------------------------------------------
// For Windows message proc
#ifndef _W64 // Microsoft specific (detection of 64 bits portability issues)
# define _W64
#endif // _W64
#ifdef _WIN64
TW_API int TW_CALL TwEventWin(void *wnd, unsigned int msg, unsigned __int64 _W64 wParam, __int64 _W64 lParam);
#else
TW_API int TW_CALL TwEventWin(void *wnd, unsigned int msg, unsigned int _W64 wParam, int _W64 lParam);
#endif
#define TwEventWin32 TwEventWin // For compatibility with AntTweakBar versions prior to 1.11
// For libSDL event loop
TW_API int TW_CALL TwEventSDL(const void *sdlEvent, unsigned char sdlMajorVersion, unsigned char sdlMinorVersion);
// For GLFW event callbacks
// You should define GLFW_CDECL before including AntTweakBar.h if your version of GLFW uses cdecl calling convensions
#ifdef GLFW_CDECL
TW_API int TW_CDECL_CALL TwEventMouseButtonGLFWcdecl(int glfwButton, int glfwAction);
TW_API int TW_CDECL_CALL TwEventKeyGLFWcdecl(int glfwKey, int glfwAction);
TW_API int TW_CDECL_CALL TwEventCharGLFWcdecl(int glfwChar, int glfwAction);
TW_API int TW_CDECL_CALL TwEventMousePosGLFWcdecl(int mouseX, int mouseY);
TW_API int TW_CDECL_CALL TwEventMouseWheelGLFWcdecl(int wheelPos);
# define TwEventMouseButtonGLFW TwEventMouseButtonGLFWcdecl
# define TwEventKeyGLFW TwEventKeyGLFWcdecl
# define TwEventCharGLFW TwEventCharGLFWcdecl
# define TwEventMousePosGLFW TwEventMousePosGLFWcdecl
# define TwEventMouseWheelGLFW TwEventMouseWheelGLFWcdecl
#else
TW_API int TW_CALL TwEventMouseButtonGLFW(int glfwButton, int glfwAction);
TW_API int TW_CALL TwEventKeyGLFW(int glfwKey, int glfwAction);
TW_API int TW_CALL TwEventCharGLFW(int glfwChar, int glfwAction);
# define TwEventMousePosGLFW TwMouseMotion
# define TwEventMouseWheelGLFW TwMouseWheel
#endif
// For GLUT event callbacks (Windows calling convention for GLUT callbacks is cdecl)
#if defined(_WIN32) || defined(_WIN64)
# define TW_GLUT_CALL TW_CDECL_CALL
#else
# define TW_GLUT_CALL
#endif
TW_API int TW_GLUT_CALL TwEventMouseButtonGLUT(int glutButton, int glutState, int mouseX, int mouseY);
TW_API int TW_GLUT_CALL TwEventMouseMotionGLUT(int mouseX, int mouseY);
TW_API int TW_GLUT_CALL TwEventKeyboardGLUT(unsigned char glutKey, int mouseX, int mouseY);
TW_API int TW_GLUT_CALL TwEventSpecialGLUT(int glutKey, int mouseX, int mouseY);
TW_API int TW_CALL TwGLUTModifiersFunc(int (TW_CALL *glutGetModifiersFunc)(void));
typedef void (TW_GLUT_CALL *GLUTmousebuttonfun)(int glutButton, int glutState, int mouseX, int mouseY);
typedef void (TW_GLUT_CALL *GLUTmousemotionfun)(int mouseX, int mouseY);
typedef void (TW_GLUT_CALL *GLUTkeyboardfun)(unsigned char glutKey, int mouseX, int mouseY);
typedef void (TW_GLUT_CALL *GLUTspecialfun)(int glutKey, int mouseX, int mouseY);
// For SFML event loop
TW_API int TW_CALL TwEventSFML(const void *sfmlEvent, unsigned char sfmlMajorVersion, unsigned char sfmlMinorVersion);
// For X11 event loop
#if defined(_UNIX)
TW_API int TW_CDECL_CALL TwEventX11(void *xevent);
#endif
// ----------------------------------------------------------------------------
// Make sure the types have the right sizes
// ----------------------------------------------------------------------------
#define TW_COMPILE_TIME_ASSERT(name, x) typedef int TW_DUMMY_ ## name[(x) * 2 - 1]
TW_COMPILE_TIME_ASSERT(TW_CHAR, sizeof(char) == 1);
TW_COMPILE_TIME_ASSERT(TW_SHORT, sizeof(short) == 2);
TW_COMPILE_TIME_ASSERT(TW_INT, sizeof(int) == 4);
TW_COMPILE_TIME_ASSERT(TW_FLOAT, sizeof(float) == 4);
TW_COMPILE_TIME_ASSERT(TW_DOUBLE, sizeof(double) == 8);
// Check pointer size on Windows
#if !defined(_WIN64) && defined(_WIN32)
// If the following assert failed, the platform is not 32-bit and _WIN64 is not defined.
// When targetting 64-bit Windows platform, _WIN64 must be defined.
TW_COMPILE_TIME_ASSERT(TW_PTR32, sizeof(void*) == 4);
#elif defined(_WIN64)
// If the following assert failed, _WIN64 is defined but the targeted platform is not 64-bit.
TW_COMPILE_TIME_ASSERT(TW_PTR64, sizeof(void*) == 8);
#endif
// ---------------------------------------------------------------------------
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // !defined TW_INCLUDED

View File

@@ -0,0 +1,2 @@
These files are part of the AntTweakBar library.
http://anttweakbar.sourceforge.net/doc

View File

@@ -0,0 +1,56 @@
// ---------------------------------------------------------------------------
//
// @file AntPerfTimer.h
// @brief A performance (precision) timer for benchs
// @author Philippe Decaudin
// @license This file is part of the AntTweakBar library.
// For conditions of distribution and use, see License.txt
//
// note: No cpp file is needed, everything is defined in this header
//
// ---------------------------------------------------------------------------
#if !defined ANT_PERF_TIMER_INCLUDED
#define ANT_PERF_TIMER_INCLUDED
#ifndef __cplusplus
# error This is a C++ header
#endif // __cplusplus
#if defined(WIN32) || defined(WIN64) || defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#include <tchar.h>
struct PerfTimer
{
inline PerfTimer() { if( !QueryPerformanceFrequency(&Freq) ) MessageBox(NULL, _T("Precision timer not supported"), _T("Problem"), MB_ICONEXCLAMATION); Reset(); }
inline void Reset() { QueryPerformanceCounter(&Start); }
inline double GetTime() { if( QueryPerformanceCounter(&End) ) return ((double)End.QuadPart - (double)Start.QuadPart)/((double)Freq.QuadPart); else return 0; }
protected:
LARGE_INTEGER Start, End, Freq;
};
#else // !_WIN (-> LINUX)
#include <sys/time.h>
#include <unistd.h>
struct PerfTimer
{
inline PerfTimer() { Reset(); }
inline void Reset() { gettimeofday(&Start, &TZ); }
inline double GetTime() { gettimeofday(&End,&TZ);
double t1 = (double)Start.tv_sec + (double)Start.tv_usec/(1000*1000);
double t2 = (double)End.tv_sec + (double)End.tv_usec/(1000*1000);
return t2-t1; }
protected:
struct timeval Start, End;
struct timezone TZ;
};
#endif // _WIN
#endif // ANT_PERF_TIMER_INCLUDED

View File

@@ -0,0 +1,83 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
//#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Fran<61>ais (France) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
//LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Cursor
//
IDC_CURSOR1 CURSOR "res\\cur00013.cur"
IDC_CURSOR2 CURSOR "res\\cur00000.cur"
IDC_CURSOR3 CURSOR "res\\cur00001.cur"
IDC_CURSOR4 CURSOR "res\\cur00002.cur"
IDC_CURSOR5 CURSOR "res\\cur00003.cur"
IDC_CURSOR6 CURSOR "res\\cur00004.cur"
IDC_CURSOR7 CURSOR "res\\cur00005.cur"
IDC_CURSOR8 CURSOR "res\\cur00006.cur"
IDC_CURSOR9 CURSOR "res\\cur00007.cur"
IDC_CURSOR10 CURSOR "res\\cur00008.cur"
IDC_CURSOR11 CURSOR "res\\cur00009.cur"
IDC_CURSOR12 CURSOR "res\\cur00010.cur"
IDC_CURSOR13 CURSOR "res\\cur00011.cur"
IDC_CURSOR14 CURSOR "res\\cur00012.cur"
#endif // Fran<61>ais (France) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,490 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}</ProjectGuid>
<RootNamespace>AntTweakBar</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>../lib\</OutDir>
<IntDir>release32\</IntDir>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>../lib\</OutDir>
<IntDir>release64\</IntDir>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<TargetName>$(ProjectName)64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>../lib/debug\</OutDir>
<IntDir>debug32\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>../lib/debug\</OutDir>
<IntDir>debug64\</IntDir>
<LinkIncremental>true</LinkIncremental>
<TargetName>$(ProjectName)64</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Command>fxc /T vs_4_0_level_9_1 /E LineRectVS /Fh $(IntDir)TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh $(IntDir)TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
fxc /T ps_4_0_level_9_1 /E LineRectPS /Fh $(IntDir)TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E TextVS /Fh $(IntDir)TwDirect3D11_TextVS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E TextCstColorVS /Fh $(IntDir)TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
fxc /T ps_4_0_level_9_1 /E TextPS /Fh $(IntDir)TwDirect3D11_TextPS.h TwDirect3D11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>Win32</TargetEnvironment>
<TypeLibraryName>$(OutDir)AntTweakBar.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;TW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling />
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>TwPrecomp.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)AntTweakBar.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<RegisterOutput>false</RegisterOutput>
<OutputFile>$(OutDir)AntTweakBar.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<MapExports>false</MapExports>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>xcopy /y /f ..\lib\AntTweakBar.dll ..\examples\bin32</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PreBuildEvent>
<Command>fxc /T vs_4_0_level_9_1 /E LineRectVS /Fh $(IntDir)TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
fxc/T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh $(IntDir)TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
fxc /T ps_4_0_level_9_1 /E LineRectPS /Fh $(IntDir)TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E TextVS /Fh $(IntDir)TwDirect3D11_TextVS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E TextCstColorVS /Fh $(IntDir)TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
fxc /T ps_4_0_level_9_1 /E TextPS /Fh $(IntDir)TwDirect3D11_TextPS.h TwDirect3D11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>X64</TargetEnvironment>
<TypeLibraryName>$(OutDir)AntTweakBar.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_WIN64;NDEBUG;_WINDOWS;_USRDLL;TW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling />
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>TwPrecomp.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)AntTweakBar.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<RegisterOutput>false</RegisterOutput>
<OutputFile>$(OutDir)AntTweakBar64.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<MapExports>false</MapExports>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>xcopy /y /f ..\lib\AntTweakBar64.dll ..\examples\bin64</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command>fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectVS /Fh $(IntDir)TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh $(IntDir)TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E LineRectPS /Fh $(IntDir)TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E TextVS /Fh $(IntDir)TwDirect3D11_TextVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E TextCstColorVS /Fh $(IntDir)TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E TextPS /Fh $(IntDir)TwDirect3D11_TextPS.h TwDirect3D11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>Win32</TargetEnvironment>
<TypeLibraryName>$(OutDir)AntTweakBar.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;TW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>TwPrecomp.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)AntTweakBar.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<OutputFile>$(OutDir)AntTweakBar.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<PostBuildEvent>
<Command>if exist ..\examples\debug32 xcopy /y /f ..\lib\debug\AntTweakBar.dll ..\examples\debug32\.</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PreBuildEvent>
<Command>fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectVS /Fh $(IntDir)TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh $(IntDir)TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E LineRectPS /Fh $(IntDir)TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E TextVS /Fh $(IntDir)TwDirect3D11_TextVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E TextCstColorVS /Fh $(IntDir)TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E TextPS /Fh $(IntDir)TwDirect3D11_TextPS.h TwDirect3D11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>X64</TargetEnvironment>
<TypeLibraryName>$(OutDir)AntTweakBar.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_WIN64;_DEBUG;_WINDOWS;_USRDLL;TW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>TwPrecomp.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)AntTweakBar.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<OutputFile>$(OutDir)AntTweakBar64.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if exist ..\examples\debug64 xcopy /y /f ..\lib\debug\AntTweakBar64.dll ..\examples\debug64\.</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="LoadOGL.cpp" />
<ClCompile Include="LoadOGLCore.cpp" />
<ClCompile Include="TwBar.cpp" />
<ClCompile Include="TwColors.cpp" />
<ClCompile Include="TwDirect3D10.cpp" />
<ClCompile Include="TwDirect3D11.cpp" />
<ClCompile Include="TwDirect3D9.cpp" />
<ClCompile Include="TwEventGLFW.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventGLUT.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventSDL.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Default</CompileAs>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventSDL12.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventSDL13.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventSFML.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventWin.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwFonts.cpp" />
<ClCompile Include="TwMgr.cpp" />
<ClCompile Include="TwOpenGL.cpp" />
<ClCompile Include="TwOpenGLCore.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwPrecomp.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="TwDirect3D11.hlsl">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\AntTweakBar.h" />
<ClInclude Include="AntPerfTimer.h" />
<ClInclude Include="LoadOGL.h" />
<ClInclude Include="LoadOGLCore.h" />
<ClInclude Include="MiniGLFW.h" />
<ClInclude Include="MiniGLUT.h" />
<ClInclude Include="MiniSDL12.h" />
<ClInclude Include="MiniSDL13.h" />
<ClInclude Include="MiniSFML16.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="TwBar.h" />
<ClInclude Include="TwColors.h" />
<ClInclude Include="TwDirect3D10.h" />
<ClInclude Include="TwDirect3D11.h" />
<ClInclude Include="TwDirect3D9.h" />
<ClInclude Include="TwFonts.h" />
<ClInclude Include="TwGraph.h" />
<ClInclude Include="TwMgr.h" />
<ClInclude Include="TwOpenGL.h" />
<ClInclude Include="TwOpenGLCore.h" />
<ClInclude Include="TwPrecomp.h" />
<ClInclude Include="res\TwXCursors.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="AntTweakBar.rc" />
</ItemGroup>
<ItemGroup>
<None Include="res\cur00000.cur" />
<None Include="res\cur00001.cur" />
<None Include="res\cur00002.cur" />
<None Include="res\cur00003.cur" />
<None Include="res\cur00004.cur" />
<None Include="res\cur00005.cur" />
<None Include="res\cur00006.cur" />
<None Include="res\cur00007.cur" />
<None Include="res\cur00008.cur" />
<None Include="res\cur00009.cur" />
<None Include="res\cur00010.cur" />
<None Include="res\cur00011.cur" />
<None Include="res\cur00012.cur" />
<None Include="res\cur00013.cur" />
<None Include="res\FontFixed1.pgm" />
<None Include="res\FontLargeAA.pgm" />
<None Include="res\FontNormal.pgm" />
<None Include="FontSmall.pgm" />
</ItemGroup>
<ItemGroup>
<Text Include="res\FontChars.txt" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,217 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{f83ca079-8ea0-4739-a811-1271c1da7b99}</UniqueIdentifier>
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
</Filter>
<Filter Include="Public Header Files">
<UniqueIdentifier>{9fa95835-d0ac-461f-9e15-970d83af4629}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl</Extensions>
</Filter>
<Filter Include="Private Header Files">
<UniqueIdentifier>{87a5b5f8-eb1d-4589-96fd-f8e516fc15e7}</UniqueIdentifier>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{d4d938bf-b5f6-43d3-896f-a3fff1885877}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="LoadOGL.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="LoadOGLCore.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwBar.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwColors.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwDirect3D10.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwDirect3D11.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwDirect3D9.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwEventGLFW.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwEventGLUT.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwEventSDL.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwEventSDL12.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwEventSDL13.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwEventSFML.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwEventWin.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwFonts.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwMgr.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwOpenGL.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwOpenGLCore.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwPrecomp.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\AntTweakBar.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="AntPerfTimer.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="LoadOGL.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="LoadOGLCore.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="MiniGLFW.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="MiniGLUT.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="MiniSDL12.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="MiniSDL13.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="MiniSFML16.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="TwBar.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="TwColors.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="TwDirect3D10.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="TwDirect3D11.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="TwDirect3D9.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="TwFonts.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="TwGraph.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="TwMgr.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="TwOpenGL.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="TwOpenGLCore.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="TwPrecomp.h">
<Filter>Private Header Files</Filter>
</ClInclude>
<ClInclude Include="res\TwXCursors.h">
<Filter>Private Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="AntTweakBar.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="res\cur00000.cur">
<Filter>Resource Files</Filter>
</None>
<None Include="res\cur00001.cur">
<Filter>Resource Files</Filter>
</None>
<None Include="res\cur00002.cur">
<Filter>Resource Files</Filter>
</None>
<None Include="res\cur00003.cur">
<Filter>Resource Files</Filter>
</None>
<None Include="res\cur00004.cur">
<Filter>Resource Files</Filter>
</None>
<None Include="res\cur00005.cur">
<Filter>Resource Files</Filter>
</None>
<None Include="res\cur00006.cur">
<Filter>Resource Files</Filter>
</None>
<None Include="res\cur00007.cur">
<Filter>Resource Files</Filter>
</None>
<None Include="res\cur00008.cur">
<Filter>Resource Files</Filter>
</None>
<None Include="res\cur00009.cur">
<Filter>Resource Files</Filter>
</None>
<None Include="res\cur00010.cur">
<Filter>Resource Files</Filter>
</None>
<None Include="res\cur00011.cur">
<Filter>Resource Files</Filter>
</None>
<None Include="res\cur00012.cur">
<Filter>Resource Files</Filter>
</None>
<None Include="res\cur00013.cur">
<Filter>Resource Files</Filter>
</None>
<None Include="res\FontFixed1.pgm">
<Filter>Resource Files</Filter>
</None>
<None Include="res\FontLargeAA.pgm">
<Filter>Resource Files</Filter>
</None>
<None Include="res\FontNormal.pgm">
<Filter>Resource Files</Filter>
</None>
<None Include="FontSmall.pgm">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Text Include="res\FontChars.txt">
<Filter>Resource Files</Filter>
</Text>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="TwDirect3D11.hlsl">
<Filter>Source Files</Filter>
</CustomBuild>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,495 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}</ProjectGuid>
<RootNamespace>AntTweakBar</RootNamespace>
<ProjectName>AntTweakBar</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>../lib\</OutDir>
<IntDir>release64\</IntDir>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<TargetName>$(ProjectName)64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<TargetName>$(ProjectName)</TargetName>
<OutDir>../lib\</OutDir>
<IntDir>release32\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>../lib/debug\</OutDir>
<IntDir>debug64\</IntDir>
<LinkIncremental>true</LinkIncremental>
<TargetName>$(ProjectName)64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<TargetName>$(ProjectName)</TargetName>
<OutDir>../lib/debug\</OutDir>
<IntDir>debug32\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PreBuildEvent>
<Command>fxc /T vs_4_0_level_9_1 /E LineRectVS /Fh $(IntDir)TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
fxc/T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh $(IntDir)TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
fxc /T ps_4_0_level_9_1 /E LineRectPS /Fh $(IntDir)TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E TextVS /Fh $(IntDir)TwDirect3D11_TextVS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E TextCstColorVS /Fh $(IntDir)TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
fxc /T ps_4_0_level_9_1 /E TextPS /Fh $(IntDir)TwDirect3D11_TextPS.h TwDirect3D11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>X64</TargetEnvironment>
<TypeLibraryName>$(OutDir)AntTweakBar.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_WIN64;NDEBUG;_WINDOWS;_USRDLL;TW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling />
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>TwPrecomp.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)AntTweakBar.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<RegisterOutput>false</RegisterOutput>
<OutputFile>$(OutDir)AntTweakBar64.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<MapExports>false</MapExports>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>mkdir "$(SolutionDir)$(Platform)/$(Configuration)"
xcopy /y /f "$(TargetPath)" "$(SolutionDir)$(Platform)/$(Configuration)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Command>fxc /T vs_4_0_level_9_1 /E LineRectVS /Fh $(IntDir)TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
fxc/T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh $(IntDir)TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
fxc /T ps_4_0_level_9_1 /E LineRectPS /Fh $(IntDir)TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E TextVS /Fh $(IntDir)TwDirect3D11_TextVS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E TextCstColorVS /Fh $(IntDir)TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
fxc /T ps_4_0_level_9_1 /E TextPS /Fh $(IntDir)TwDirect3D11_TextPS.h TwDirect3D11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TypeLibraryName>$(OutDir)AntTweakBar.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;TW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>TwPrecomp.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)AntTweakBar.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>
</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<RegisterOutput>false</RegisterOutput>
<OutputFile>$(OutDir)AntTweakBar.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<MapExports>false</MapExports>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>mkdir "$(SolutionDir)$(Platform)/$(Configuration)"
xcopy /y /f "$(TargetPath)" "$(SolutionDir)$(Platform)/$(Configuration)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PreBuildEvent>
<Command>fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectVS /Fh $(IntDir)TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh $(IntDir)TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E LineRectPS /Fh $(IntDir)TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E TextVS /Fh $(IntDir)TwDirect3D11_TextVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E TextCstColorVS /Fh $(IntDir)TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E TextPS /Fh $(IntDir)TwDirect3D11_TextPS.h TwDirect3D11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>X64</TargetEnvironment>
<TypeLibraryName>$(OutDir)AntTweakBar.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_WIN64;_DEBUG;_WINDOWS;_USRDLL;TW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>TwPrecomp.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)AntTweakBar.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<OutputFile>$(OutDir)AntTweakBar64.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>mkdir "$(SolutionDir)$(Platform)/$(Configuration)"
xcopy /y /f "$(TargetPath)" "$(SolutionDir)$(Platform)/$(Configuration)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command>fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectVS /Fh $(IntDir)TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh $(IntDir)TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E LineRectPS /Fh $(IntDir)TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E TextVS /Fh $(IntDir)TwDirect3D11_TextVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E TextCstColorVS /Fh $(IntDir)TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E TextPS /Fh $(IntDir)TwDirect3D11_TextPS.h TwDirect3D11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TypeLibraryName>$(OutDir)AntTweakBar.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;TW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>TwPrecomp.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)AntTweakBar.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<OutputFile>$(OutDir)AntTweakBar.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>mkdir "$(SolutionDir)$(Platform)/$(Configuration)"
xcopy /y /f "$(TargetPath)" "$(SolutionDir)$(Platform)/$(Configuration)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="LoadOGL.cpp" />
<ClCompile Include="LoadOGLCore.cpp" />
<ClCompile Include="TwBar.cpp" />
<ClCompile Include="TwColors.cpp" />
<ClCompile Include="TwDirect3D10.cpp" />
<ClCompile Include="TwDirect3D11.cpp" />
<ClCompile Include="TwDirect3D9.cpp" />
<ClCompile Include="TwEventGLFW.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventGLUT.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventSDL.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventSDL12.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventSDL13.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventSFML.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventWin.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwFonts.cpp" />
<ClCompile Include="TwMgr.cpp" />
<ClCompile Include="TwOpenGL.cpp" />
<ClCompile Include="TwOpenGLCore.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwPrecomp.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="TwDirect3D11.hlsl">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\AntTweakBar.h" />
<ClInclude Include="AntPerfTimer.h" />
<ClInclude Include="LoadOGL.h" />
<ClInclude Include="LoadOGLCore.h" />
<ClInclude Include="MiniGLFW.h" />
<ClInclude Include="MiniGLUT.h" />
<ClInclude Include="MiniSDL12.h" />
<ClInclude Include="MiniSDL13.h" />
<ClInclude Include="MiniSFML16.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="TwBar.h" />
<ClInclude Include="TwColors.h" />
<ClInclude Include="TwDirect3D10.h" />
<ClInclude Include="TwDirect3D11.h" />
<ClInclude Include="TwDirect3D9.h" />
<ClInclude Include="TwFonts.h" />
<ClInclude Include="TwGraph.h" />
<ClInclude Include="TwMgr.h" />
<ClInclude Include="TwOpenGL.h" />
<ClInclude Include="TwOpenGLCore.h" />
<ClInclude Include="TwPrecomp.h" />
<ClInclude Include="res\TwXCursors.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="AntTweakBar.rc" />
</ItemGroup>
<ItemGroup>
<None Include="res\cur00000.cur" />
<None Include="res\cur00001.cur" />
<None Include="res\cur00002.cur" />
<None Include="res\cur00003.cur" />
<None Include="res\cur00004.cur" />
<None Include="res\cur00005.cur" />
<None Include="res\cur00006.cur" />
<None Include="res\cur00007.cur" />
<None Include="res\cur00008.cur" />
<None Include="res\cur00009.cur" />
<None Include="res\cur00010.cur" />
<None Include="res\cur00011.cur" />
<None Include="res\cur00012.cur" />
<None Include="res\cur00013.cur" />
<None Include="res\FontFixed1.pgm" />
<None Include="res\FontLargeAA.pgm" />
<None Include="res\FontNormal.pgm" />
<None Include="FontSmall.pgm" />
</ItemGroup>
<ItemGroup>
<Text Include="res\FontChars.txt" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,495 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}</ProjectGuid>
<RootNamespace>AntTweakBar</RootNamespace>
<ProjectName>AntTweakBar</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>../lib\</OutDir>
<IntDir>release64\</IntDir>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<TargetName>$(ProjectName)64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<TargetName>$(ProjectName)</TargetName>
<OutDir>../lib\</OutDir>
<IntDir>release32\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>../lib/debug\</OutDir>
<IntDir>debug64\</IntDir>
<LinkIncremental>true</LinkIncremental>
<TargetName>$(ProjectName)64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<TargetName>$(ProjectName)</TargetName>
<OutDir>../lib/debug\</OutDir>
<IntDir>debug32\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PreBuildEvent>
<Command>fxc /T vs_4_0_level_9_1 /E LineRectVS /Fh $(IntDir)TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
fxc/T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh $(IntDir)TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
fxc /T ps_4_0_level_9_1 /E LineRectPS /Fh $(IntDir)TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E TextVS /Fh $(IntDir)TwDirect3D11_TextVS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E TextCstColorVS /Fh $(IntDir)TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
fxc /T ps_4_0_level_9_1 /E TextPS /Fh $(IntDir)TwDirect3D11_TextPS.h TwDirect3D11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>X64</TargetEnvironment>
<TypeLibraryName>$(OutDir)AntTweakBar.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_WIN64;NDEBUG;_WINDOWS;_USRDLL;TW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling />
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>TwPrecomp.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)AntTweakBar.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<RegisterOutput>false</RegisterOutput>
<OutputFile>$(OutDir)AntTweakBar64.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<MapExports>false</MapExports>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>mkdir "$(SolutionDir)$(Platform)/$(Configuration)"
xcopy /y /f "$(TargetPath)" "$(SolutionDir)$(Platform)/$(Configuration)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Command>fxc /T vs_4_0_level_9_1 /E LineRectVS /Fh $(IntDir)TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
fxc/T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh $(IntDir)TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
fxc /T ps_4_0_level_9_1 /E LineRectPS /Fh $(IntDir)TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E TextVS /Fh $(IntDir)TwDirect3D11_TextVS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E TextCstColorVS /Fh $(IntDir)TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
fxc /T ps_4_0_level_9_1 /E TextPS /Fh $(IntDir)TwDirect3D11_TextPS.h TwDirect3D11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TypeLibraryName>$(OutDir)AntTweakBar.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;TW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>TwPrecomp.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)AntTweakBar.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>
</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<RegisterOutput>false</RegisterOutput>
<OutputFile>$(OutDir)AntTweakBar.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<MapExports>false</MapExports>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>mkdir "$(SolutionDir)$(Platform)/$(Configuration)"
xcopy /y /f "$(TargetPath)" "$(SolutionDir)$(Platform)/$(Configuration)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PreBuildEvent>
<Command>fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectVS /Fh $(IntDir)TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh $(IntDir)TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E LineRectPS /Fh $(IntDir)TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E TextVS /Fh $(IntDir)TwDirect3D11_TextVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E TextCstColorVS /Fh $(IntDir)TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E TextPS /Fh $(IntDir)TwDirect3D11_TextPS.h TwDirect3D11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>X64</TargetEnvironment>
<TypeLibraryName>$(OutDir)AntTweakBar.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_WIN64;_DEBUG;_WINDOWS;_USRDLL;TW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>TwPrecomp.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)AntTweakBar.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<OutputFile>$(OutDir)AntTweakBar64.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>mkdir "$(SolutionDir)$(Platform)/$(Configuration)"
xcopy /y /f "$(TargetPath)" "$(SolutionDir)$(Platform)/$(Configuration)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command>fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectVS /Fh $(IntDir)TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh $(IntDir)TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E LineRectPS /Fh $(IntDir)TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E TextVS /Fh $(IntDir)TwDirect3D11_TextVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E TextCstColorVS /Fh $(IntDir)TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E TextPS /Fh $(IntDir)TwDirect3D11_TextPS.h TwDirect3D11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TypeLibraryName>$(OutDir)AntTweakBar.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;TW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>TwPrecomp.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)AntTweakBar.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<OutputFile>$(OutDir)AntTweakBar.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>mkdir "$(SolutionDir)$(Platform)/$(Configuration)"
xcopy /y /f "$(TargetPath)" "$(SolutionDir)$(Platform)/$(Configuration)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="LoadOGL.cpp" />
<ClCompile Include="LoadOGLCore.cpp" />
<ClCompile Include="TwBar.cpp" />
<ClCompile Include="TwColors.cpp" />
<ClCompile Include="TwDirect3D10.cpp" />
<ClCompile Include="TwDirect3D11.cpp" />
<ClCompile Include="TwDirect3D9.cpp" />
<ClCompile Include="TwEventGLFW.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventGLUT.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventSDL.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventSDL12.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventSDL13.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventSFML.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventWin.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwFonts.cpp" />
<ClCompile Include="TwMgr.cpp" />
<ClCompile Include="TwOpenGL.cpp" />
<ClCompile Include="TwOpenGLCore.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwPrecomp.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="TwDirect3D11.hlsl">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\AntTweakBar.h" />
<ClInclude Include="AntPerfTimer.h" />
<ClInclude Include="LoadOGL.h" />
<ClInclude Include="LoadOGLCore.h" />
<ClInclude Include="MiniGLFW.h" />
<ClInclude Include="MiniGLUT.h" />
<ClInclude Include="MiniSDL12.h" />
<ClInclude Include="MiniSDL13.h" />
<ClInclude Include="MiniSFML16.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="TwBar.h" />
<ClInclude Include="TwColors.h" />
<ClInclude Include="TwDirect3D10.h" />
<ClInclude Include="TwDirect3D11.h" />
<ClInclude Include="TwDirect3D9.h" />
<ClInclude Include="TwFonts.h" />
<ClInclude Include="TwGraph.h" />
<ClInclude Include="TwMgr.h" />
<ClInclude Include="TwOpenGL.h" />
<ClInclude Include="TwOpenGLCore.h" />
<ClInclude Include="TwPrecomp.h" />
<ClInclude Include="res\TwXCursors.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="AntTweakBar.rc" />
</ItemGroup>
<ItemGroup>
<None Include="res\cur00000.cur" />
<None Include="res\cur00001.cur" />
<None Include="res\cur00002.cur" />
<None Include="res\cur00003.cur" />
<None Include="res\cur00004.cur" />
<None Include="res\cur00005.cur" />
<None Include="res\cur00006.cur" />
<None Include="res\cur00007.cur" />
<None Include="res\cur00008.cur" />
<None Include="res\cur00009.cur" />
<None Include="res\cur00010.cur" />
<None Include="res\cur00011.cur" />
<None Include="res\cur00012.cur" />
<None Include="res\cur00013.cur" />
<None Include="res\FontFixed1.pgm" />
<None Include="res\FontLargeAA.pgm" />
<None Include="res\FontNormal.pgm" />
<None Include="FontSmall.pgm" />
</ItemGroup>
<ItemGroup>
<Text Include="res\FontChars.txt" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,496 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}</ProjectGuid>
<RootNamespace>AntTweakBar</RootNamespace>
<ProjectName>AntTweakBar</ProjectName>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>../lib\</OutDir>
<IntDir>release64\</IntDir>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<TargetName>$(ProjectName)64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<TargetName>$(ProjectName)</TargetName>
<OutDir>../lib\</OutDir>
<IntDir>release32\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>../lib/debug\</OutDir>
<IntDir>debug64\</IntDir>
<LinkIncremental>true</LinkIncremental>
<TargetName>$(ProjectName)64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<TargetName>$(ProjectName)</TargetName>
<OutDir>../lib/debug\</OutDir>
<IntDir>debug32\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PreBuildEvent>
<Command>fxc /T vs_4_0_level_9_1 /E LineRectVS /Fh $(IntDir)TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
fxc/T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh $(IntDir)TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
fxc /T ps_4_0_level_9_1 /E LineRectPS /Fh $(IntDir)TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E TextVS /Fh $(IntDir)TwDirect3D11_TextVS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E TextCstColorVS /Fh $(IntDir)TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
fxc /T ps_4_0_level_9_1 /E TextPS /Fh $(IntDir)TwDirect3D11_TextPS.h TwDirect3D11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>X64</TargetEnvironment>
<TypeLibraryName>$(OutDir)AntTweakBar.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_WIN64;NDEBUG;_WINDOWS;_USRDLL;TW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling />
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>TwPrecomp.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)AntTweakBar.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<RegisterOutput>false</RegisterOutput>
<OutputFile>$(OutDir)AntTweakBar64.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<MapExports>false</MapExports>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>mkdir "$(SolutionDir)$(Platform)/$(Configuration)"
xcopy /y /f "$(TargetPath)" "$(SolutionDir)$(Platform)/$(Configuration)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Command>fxc /T vs_4_0_level_9_1 /E LineRectVS /Fh $(IntDir)TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
fxc/T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh $(IntDir)TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
fxc /T ps_4_0_level_9_1 /E LineRectPS /Fh $(IntDir)TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E TextVS /Fh $(IntDir)TwDirect3D11_TextVS.h TwDirect3D11.hlsl
fxc /T vs_4_0_level_9_1 /E TextCstColorVS /Fh $(IntDir)TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
fxc /T ps_4_0_level_9_1 /E TextPS /Fh $(IntDir)TwDirect3D11_TextPS.h TwDirect3D11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TypeLibraryName>$(OutDir)AntTweakBar.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;TW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>TwPrecomp.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)AntTweakBar.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>
</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<RegisterOutput>false</RegisterOutput>
<OutputFile>$(OutDir)AntTweakBar.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<MapExports>false</MapExports>
<SetChecksum>true</SetChecksum>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>mkdir "$(SolutionDir)$(Platform)/$(Configuration)"
xcopy /y /f "$(TargetPath)" "$(SolutionDir)$(Platform)/$(Configuration)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PreBuildEvent>
<Command>fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectVS /Fh $(IntDir)TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh $(IntDir)TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E LineRectPS /Fh $(IntDir)TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E TextVS /Fh $(IntDir)TwDirect3D11_TextVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E TextCstColorVS /Fh $(IntDir)TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E TextPS /Fh $(IntDir)TwDirect3D11_TextPS.h TwDirect3D11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>X64</TargetEnvironment>
<TypeLibraryName>$(OutDir)AntTweakBar.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_WIN64;_DEBUG;_WINDOWS;_USRDLL;TW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>TwPrecomp.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)AntTweakBar.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<OutputFile>$(OutDir)AntTweakBar64.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>mkdir "$(SolutionDir)$(Platform)/$(Configuration)"
xcopy /y /f "$(TargetPath)" "$(SolutionDir)$(Platform)/$(Configuration)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command>fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectVS /Fh $(IntDir)TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh $(IntDir)TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E LineRectPS /Fh $(IntDir)TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E TextVS /Fh $(IntDir)TwDirect3D11_TextVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T vs_4_0_level_9_1 /E TextCstColorVS /Fh $(IntDir)TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
fxc /Od /Zi /T ps_4_0_level_9_1 /E TextPS /Fh $(IntDir)TwDirect3D11_TextPS.h TwDirect3D11.hlsl
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TypeLibraryName>$(OutDir)AntTweakBar.tlb</TypeLibraryName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;TW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>TwPrecomp.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)AntTweakBar.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<OutputFile>$(OutDir)AntTweakBar.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>mkdir "$(SolutionDir)$(Platform)/$(Configuration)"
xcopy /y /f "$(TargetPath)" "$(SolutionDir)$(Platform)/$(Configuration)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="LoadOGL.cpp" />
<ClCompile Include="LoadOGLCore.cpp" />
<ClCompile Include="TwBar.cpp" />
<ClCompile Include="TwColors.cpp" />
<ClCompile Include="TwDirect3D10.cpp" />
<ClCompile Include="TwDirect3D11.cpp" />
<ClCompile Include="TwDirect3D9.cpp" />
<ClCompile Include="TwEventGLFW.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventGLUT.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventSDL.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventSDL12.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventSDL13.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventSFML.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwEventWin.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwFonts.cpp" />
<ClCompile Include="TwMgr.cpp" />
<ClCompile Include="TwOpenGL.cpp" />
<ClCompile Include="TwOpenGLCore.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TwPrecomp.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="TwDirect3D11.hlsl">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\AntTweakBar.h" />
<ClInclude Include="AntPerfTimer.h" />
<ClInclude Include="LoadOGL.h" />
<ClInclude Include="LoadOGLCore.h" />
<ClInclude Include="MiniGLFW.h" />
<ClInclude Include="MiniGLUT.h" />
<ClInclude Include="MiniSDL12.h" />
<ClInclude Include="MiniSDL13.h" />
<ClInclude Include="MiniSFML16.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="TwBar.h" />
<ClInclude Include="TwColors.h" />
<ClInclude Include="TwDirect3D10.h" />
<ClInclude Include="TwDirect3D11.h" />
<ClInclude Include="TwDirect3D9.h" />
<ClInclude Include="TwFonts.h" />
<ClInclude Include="TwGraph.h" />
<ClInclude Include="TwMgr.h" />
<ClInclude Include="TwOpenGL.h" />
<ClInclude Include="TwOpenGLCore.h" />
<ClInclude Include="TwPrecomp.h" />
<ClInclude Include="res\TwXCursors.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="AntTweakBar.rc" />
</ItemGroup>
<ItemGroup>
<None Include="res\cur00000.cur" />
<None Include="res\cur00001.cur" />
<None Include="res\cur00002.cur" />
<None Include="res\cur00003.cur" />
<None Include="res\cur00004.cur" />
<None Include="res\cur00005.cur" />
<None Include="res\cur00006.cur" />
<None Include="res\cur00007.cur" />
<None Include="res\cur00008.cur" />
<None Include="res\cur00009.cur" />
<None Include="res\cur00010.cur" />
<None Include="res\cur00011.cur" />
<None Include="res\cur00012.cur" />
<None Include="res\cur00013.cur" />
<None Include="res\FontFixed1.pgm" />
<None Include="res\FontLargeAA.pgm" />
<None Include="res\FontNormal.pgm" />
<None Include="FontSmall.pgm" />
</ItemGroup>
<ItemGroup>
<Text Include="res\FontChars.txt" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AntTweakBar", "AntTweakBar.vcproj", "{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Debug|Win32.ActiveCfg = Debug|Win32
{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Debug|Win32.Build.0 = Debug|Win32
{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Debug|x64.ActiveCfg = Debug|x64
{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Debug|x64.Build.0 = Debug|x64
{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Release|Win32.ActiveCfg = Release|Win32
{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Release|Win32.Build.0 = Release|Win32
{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Release|x64.ActiveCfg = Release|x64
{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AntTweakBar", "AntTweakBar.vcxproj", "{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Debug|Win32.ActiveCfg = Debug|Win32
{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Debug|Win32.Build.0 = Debug|Win32
{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Debug|x64.ActiveCfg = Debug|x64
{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Debug|x64.Build.0 = Debug|x64
{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Release|Win32.ActiveCfg = Release|Win32
{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Release|Win32.Build.0 = Release|Win32
{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Release|x64.ActiveCfg = Release|x64
{B99E1FA1-C30A-45F2-9D57-9E9C21B2DF42}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

545
AntTweakBar/src/LoadOGL.cpp Normal file
View File

@@ -0,0 +1,545 @@
// ---------------------------------------------------------------------------
//
// @file LoadOGL.cpp
// @author Philippe Decaudin
// @license This file is part of the AntTweakBar library.
// For conditions of distribution and use, see License.txt
//
// ---------------------------------------------------------------------------
#include "TwPrecomp.h"
#include "LoadOGL.h"
// ---------------------------------------------------------------------------
#define ANT_NB_OGL_FUNC_MAX 1024
struct COGLFuncRec
{
const char * m_Name;
GL::PFNOpenGL * m_FuncPtr;
COGLFuncRec() : m_Name(NULL), m_FuncPtr(NULL) {}
};
COGLFuncRec g_OGLFuncRec[ANT_NB_OGL_FUNC_MAX];
int g_NbOGLFunc = 0;
#if defined(ANT_WINDOWS)
HMODULE g_OGLModule = NULL;
#endif
// ---------------------------------------------------------------------------
ANT_GL_IMPL(glAccum)
ANT_GL_IMPL(glAlphaFunc)
ANT_GL_IMPL(glAreTexturesResident)
ANT_GL_IMPL(glArrayElement)
ANT_GL_IMPL(glBegin)
ANT_GL_IMPL(glBindTexture)
ANT_GL_IMPL(glBitmap)
ANT_GL_IMPL(glBlendFunc)
ANT_GL_IMPL(glCallList)
ANT_GL_IMPL(glCallLists)
ANT_GL_IMPL(glClear)
ANT_GL_IMPL(glClearAccum)
ANT_GL_IMPL(glClearColor)
ANT_GL_IMPL(glClearDepth)
ANT_GL_IMPL(glClearIndex)
ANT_GL_IMPL(glClearStencil)
ANT_GL_IMPL(glClipPlane)
ANT_GL_IMPL(glColor3b)
ANT_GL_IMPL(glColor3bv)
ANT_GL_IMPL(glColor3d)
ANT_GL_IMPL(glColor3dv)
ANT_GL_IMPL(glColor3f)
ANT_GL_IMPL(glColor3fv)
ANT_GL_IMPL(glColor3i)
ANT_GL_IMPL(glColor3iv)
ANT_GL_IMPL(glColor3s)
ANT_GL_IMPL(glColor3sv)
ANT_GL_IMPL(glColor3ub)
ANT_GL_IMPL(glColor3ubv)
ANT_GL_IMPL(glColor3ui)
ANT_GL_IMPL(glColor3uiv)
ANT_GL_IMPL(glColor3us)
ANT_GL_IMPL(glColor3usv)
ANT_GL_IMPL(glColor4b)
ANT_GL_IMPL(glColor4bv)
ANT_GL_IMPL(glColor4d)
ANT_GL_IMPL(glColor4dv)
ANT_GL_IMPL(glColor4f)
ANT_GL_IMPL(glColor4fv)
ANT_GL_IMPL(glColor4i)
ANT_GL_IMPL(glColor4iv)
ANT_GL_IMPL(glColor4s)
ANT_GL_IMPL(glColor4sv)
ANT_GL_IMPL(glColor4ub)
ANT_GL_IMPL(glColor4ubv)
ANT_GL_IMPL(glColor4ui)
ANT_GL_IMPL(glColor4uiv)
ANT_GL_IMPL(glColor4us)
ANT_GL_IMPL(glColor4usv)
ANT_GL_IMPL(glColorMask)
ANT_GL_IMPL(glColorMaterial)
ANT_GL_IMPL(glColorPointer)
ANT_GL_IMPL(glCopyPixels)
ANT_GL_IMPL(glCopyTexImage1D)
ANT_GL_IMPL(glCopyTexImage2D)
ANT_GL_IMPL(glCopyTexSubImage1D)
ANT_GL_IMPL(glCopyTexSubImage2D)
ANT_GL_IMPL(glCullFace)
ANT_GL_IMPL(glDeleteLists)
ANT_GL_IMPL(glDeleteTextures)
ANT_GL_IMPL(glDepthFunc)
ANT_GL_IMPL(glDepthMask)
ANT_GL_IMPL(glDepthRange)
ANT_GL_IMPL(glDisable)
ANT_GL_IMPL(glDisableClientState)
ANT_GL_IMPL(glDrawArrays)
ANT_GL_IMPL(glDrawBuffer)
ANT_GL_IMPL(glDrawElements)
ANT_GL_IMPL(glDrawPixels)
ANT_GL_IMPL(glEdgeFlag)
ANT_GL_IMPL(glEdgeFlagPointer)
ANT_GL_IMPL(glEdgeFlagv)
ANT_GL_IMPL(glEnable)
ANT_GL_IMPL(glEnableClientState)
ANT_GL_IMPL(glEnd)
ANT_GL_IMPL(glEndList)
ANT_GL_IMPL(glEvalCoord1d)
ANT_GL_IMPL(glEvalCoord1dv)
ANT_GL_IMPL(glEvalCoord1f)
ANT_GL_IMPL(glEvalCoord1fv)
ANT_GL_IMPL(glEvalCoord2d)
ANT_GL_IMPL(glEvalCoord2dv)
ANT_GL_IMPL(glEvalCoord2f)
ANT_GL_IMPL(glEvalCoord2fv)
ANT_GL_IMPL(glEvalMesh1)
ANT_GL_IMPL(glEvalMesh2)
ANT_GL_IMPL(glEvalPoint1)
ANT_GL_IMPL(glEvalPoint2)
ANT_GL_IMPL(glFeedbackBuffer)
ANT_GL_IMPL(glFinish)
ANT_GL_IMPL(glFlush)
ANT_GL_IMPL(glFogf)
ANT_GL_IMPL(glFogfv)
ANT_GL_IMPL(glFogi)
ANT_GL_IMPL(glFogiv)
ANT_GL_IMPL(glFrontFace)
ANT_GL_IMPL(glFrustum)
ANT_GL_IMPL(glGenLists)
ANT_GL_IMPL(glGenTextures)
ANT_GL_IMPL(glGetBooleanv)
ANT_GL_IMPL(glGetClipPlane)
ANT_GL_IMPL(glGetDoublev)
ANT_GL_IMPL(glGetError)
ANT_GL_IMPL(glGetFloatv)
ANT_GL_IMPL(glGetIntegerv)
ANT_GL_IMPL(glGetLightfv)
ANT_GL_IMPL(glGetLightiv)
ANT_GL_IMPL(glGetMapdv)
ANT_GL_IMPL(glGetMapfv)
ANT_GL_IMPL(glGetMapiv)
ANT_GL_IMPL(glGetMaterialfv)
ANT_GL_IMPL(glGetMaterialiv)
ANT_GL_IMPL(glGetPixelMapfv)
ANT_GL_IMPL(glGetPixelMapuiv)
ANT_GL_IMPL(glGetPixelMapusv)
ANT_GL_IMPL(glGetPointerv)
ANT_GL_IMPL(glGetPolygonStipple)
ANT_GL_IMPL(glGetString)
ANT_GL_IMPL(glGetTexEnvfv)
ANT_GL_IMPL(glGetTexEnviv)
ANT_GL_IMPL(glGetTexGendv)
ANT_GL_IMPL(glGetTexGenfv)
ANT_GL_IMPL(glGetTexGeniv)
ANT_GL_IMPL(glGetTexImage)
ANT_GL_IMPL(glGetTexLevelParameterfv)
ANT_GL_IMPL(glGetTexLevelParameteriv)
ANT_GL_IMPL(glGetTexParameterfv)
ANT_GL_IMPL(glGetTexParameteriv)
ANT_GL_IMPL(glHint)
ANT_GL_IMPL(glIndexMask)
ANT_GL_IMPL(glIndexPointer)
ANT_GL_IMPL(glIndexd)
ANT_GL_IMPL(glIndexdv)
ANT_GL_IMPL(glIndexf)
ANT_GL_IMPL(glIndexfv)
ANT_GL_IMPL(glIndexi)
ANT_GL_IMPL(glIndexiv)
ANT_GL_IMPL(glIndexs)
ANT_GL_IMPL(glIndexsv)
ANT_GL_IMPL(glIndexub)
ANT_GL_IMPL(glIndexubv)
ANT_GL_IMPL(glInitNames)
ANT_GL_IMPL(glInterleavedArrays)
ANT_GL_IMPL(glIsEnabled)
ANT_GL_IMPL(glIsList)
ANT_GL_IMPL(glIsTexture)
ANT_GL_IMPL(glLightModelf)
ANT_GL_IMPL(glLightModelfv)
ANT_GL_IMPL(glLightModeli)
ANT_GL_IMPL(glLightModeliv)
ANT_GL_IMPL(glLightf)
ANT_GL_IMPL(glLightfv)
ANT_GL_IMPL(glLighti)
ANT_GL_IMPL(glLightiv)
ANT_GL_IMPL(glLineStipple)
ANT_GL_IMPL(glLineWidth)
ANT_GL_IMPL(glListBase)
ANT_GL_IMPL(glLoadIdentity)
ANT_GL_IMPL(glLoadMatrixd)
ANT_GL_IMPL(glLoadMatrixf)
ANT_GL_IMPL(glLoadName)
ANT_GL_IMPL(glLogicOp)
ANT_GL_IMPL(glMap1d)
ANT_GL_IMPL(glMap1f)
ANT_GL_IMPL(glMap2d)
ANT_GL_IMPL(glMap2f)
ANT_GL_IMPL(glMapGrid1d)
ANT_GL_IMPL(glMapGrid1f)
ANT_GL_IMPL(glMapGrid2d)
ANT_GL_IMPL(glMapGrid2f)
ANT_GL_IMPL(glMaterialf)
ANT_GL_IMPL(glMaterialfv)
ANT_GL_IMPL(glMateriali)
ANT_GL_IMPL(glMaterialiv)
ANT_GL_IMPL(glMatrixMode)
ANT_GL_IMPL(glMultMatrixd)
ANT_GL_IMPL(glMultMatrixf)
ANT_GL_IMPL(glNewList)
ANT_GL_IMPL(glNormal3b)
ANT_GL_IMPL(glNormal3bv)
ANT_GL_IMPL(glNormal3d)
ANT_GL_IMPL(glNormal3dv)
ANT_GL_IMPL(glNormal3f)
ANT_GL_IMPL(glNormal3fv)
ANT_GL_IMPL(glNormal3i)
ANT_GL_IMPL(glNormal3iv)
ANT_GL_IMPL(glNormal3s)
ANT_GL_IMPL(glNormal3sv)
ANT_GL_IMPL(glNormalPointer)
ANT_GL_IMPL(glOrtho)
ANT_GL_IMPL(glPassThrough)
ANT_GL_IMPL(glPixelMapfv)
ANT_GL_IMPL(glPixelMapuiv)
ANT_GL_IMPL(glPixelMapusv)
ANT_GL_IMPL(glPixelStoref)
ANT_GL_IMPL(glPixelStorei)
ANT_GL_IMPL(glPixelTransferf)
ANT_GL_IMPL(glPixelTransferi)
ANT_GL_IMPL(glPixelZoom)
ANT_GL_IMPL(glPointSize)
ANT_GL_IMPL(glPolygonMode)
ANT_GL_IMPL(glPolygonOffset)
ANT_GL_IMPL(glPolygonStipple)
ANT_GL_IMPL(glPopAttrib)
ANT_GL_IMPL(glPopClientAttrib)
ANT_GL_IMPL(glPopMatrix)
ANT_GL_IMPL(glPopName)
ANT_GL_IMPL(glPrioritizeTextures)
ANT_GL_IMPL(glPushAttrib)
ANT_GL_IMPL(glPushClientAttrib)
ANT_GL_IMPL(glPushMatrix)
ANT_GL_IMPL(glPushName)
ANT_GL_IMPL(glRasterPos2d)
ANT_GL_IMPL(glRasterPos2dv)
ANT_GL_IMPL(glRasterPos2f)
ANT_GL_IMPL(glRasterPos2fv)
ANT_GL_IMPL(glRasterPos2i)
ANT_GL_IMPL(glRasterPos2iv)
ANT_GL_IMPL(glRasterPos2s)
ANT_GL_IMPL(glRasterPos2sv)
ANT_GL_IMPL(glRasterPos3d)
ANT_GL_IMPL(glRasterPos3dv)
ANT_GL_IMPL(glRasterPos3f)
ANT_GL_IMPL(glRasterPos3fv)
ANT_GL_IMPL(glRasterPos3i)
ANT_GL_IMPL(glRasterPos3iv)
ANT_GL_IMPL(glRasterPos3s)
ANT_GL_IMPL(glRasterPos3sv)
ANT_GL_IMPL(glRasterPos4d)
ANT_GL_IMPL(glRasterPos4dv)
ANT_GL_IMPL(glRasterPos4f)
ANT_GL_IMPL(glRasterPos4fv)
ANT_GL_IMPL(glRasterPos4i)
ANT_GL_IMPL(glRasterPos4iv)
ANT_GL_IMPL(glRasterPos4s)
ANT_GL_IMPL(glRasterPos4sv)
ANT_GL_IMPL(glReadBuffer)
ANT_GL_IMPL(glReadPixels)
ANT_GL_IMPL(glRectd)
ANT_GL_IMPL(glRectdv)
ANT_GL_IMPL(glRectf)
ANT_GL_IMPL(glRectfv)
ANT_GL_IMPL(glRecti)
ANT_GL_IMPL(glRectiv)
ANT_GL_IMPL(glRects)
ANT_GL_IMPL(glRectsv)
ANT_GL_IMPL(glRenderMode)
ANT_GL_IMPL(glRotated)
ANT_GL_IMPL(glRotatef)
ANT_GL_IMPL(glScaled)
ANT_GL_IMPL(glScalef)
ANT_GL_IMPL(glScissor)
ANT_GL_IMPL(glSelectBuffer)
ANT_GL_IMPL(glShadeModel)
ANT_GL_IMPL(glStencilFunc)
ANT_GL_IMPL(glStencilMask)
ANT_GL_IMPL(glStencilOp)
ANT_GL_IMPL(glTexCoord1d)
ANT_GL_IMPL(glTexCoord1dv)
ANT_GL_IMPL(glTexCoord1f)
ANT_GL_IMPL(glTexCoord1fv)
ANT_GL_IMPL(glTexCoord1i)
ANT_GL_IMPL(glTexCoord1iv)
ANT_GL_IMPL(glTexCoord1s)
ANT_GL_IMPL(glTexCoord1sv)
ANT_GL_IMPL(glTexCoord2d)
ANT_GL_IMPL(glTexCoord2dv)
ANT_GL_IMPL(glTexCoord2f)
ANT_GL_IMPL(glTexCoord2fv)
ANT_GL_IMPL(glTexCoord2i)
ANT_GL_IMPL(glTexCoord2iv)
ANT_GL_IMPL(glTexCoord2s)
ANT_GL_IMPL(glTexCoord2sv)
ANT_GL_IMPL(glTexCoord3d)
ANT_GL_IMPL(glTexCoord3dv)
ANT_GL_IMPL(glTexCoord3f)
ANT_GL_IMPL(glTexCoord3fv)
ANT_GL_IMPL(glTexCoord3i)
ANT_GL_IMPL(glTexCoord3iv)
ANT_GL_IMPL(glTexCoord3s)
ANT_GL_IMPL(glTexCoord3sv)
ANT_GL_IMPL(glTexCoord4d)
ANT_GL_IMPL(glTexCoord4dv)
ANT_GL_IMPL(glTexCoord4f)
ANT_GL_IMPL(glTexCoord4fv)
ANT_GL_IMPL(glTexCoord4i)
ANT_GL_IMPL(glTexCoord4iv)
ANT_GL_IMPL(glTexCoord4s)
ANT_GL_IMPL(glTexCoord4sv)
ANT_GL_IMPL(glTexCoordPointer)
ANT_GL_IMPL(glTexEnvf)
ANT_GL_IMPL(glTexEnvfv)
ANT_GL_IMPL(glTexEnvi)
ANT_GL_IMPL(glTexEnviv)
ANT_GL_IMPL(glTexGend)
ANT_GL_IMPL(glTexGendv)
ANT_GL_IMPL(glTexGenf)
ANT_GL_IMPL(glTexGenfv)
ANT_GL_IMPL(glTexGeni)
ANT_GL_IMPL(glTexGeniv)
ANT_GL_IMPL(glTexImage1D)
ANT_GL_IMPL(glTexImage2D)
ANT_GL_IMPL(glTexParameterf)
ANT_GL_IMPL(glTexParameterfv)
ANT_GL_IMPL(glTexParameteri)
ANT_GL_IMPL(glTexParameteriv)
ANT_GL_IMPL(glTexSubImage1D)
ANT_GL_IMPL(glTexSubImage2D)
ANT_GL_IMPL(glTranslated)
ANT_GL_IMPL(glTranslatef)
ANT_GL_IMPL(glVertex2d)
ANT_GL_IMPL(glVertex2dv)
ANT_GL_IMPL(glVertex2f)
ANT_GL_IMPL(glVertex2fv)
ANT_GL_IMPL(glVertex2i)
ANT_GL_IMPL(glVertex2iv)
ANT_GL_IMPL(glVertex2s)
ANT_GL_IMPL(glVertex2sv)
ANT_GL_IMPL(glVertex3d)
ANT_GL_IMPL(glVertex3dv)
ANT_GL_IMPL(glVertex3f)
ANT_GL_IMPL(glVertex3fv)
ANT_GL_IMPL(glVertex3i)
ANT_GL_IMPL(glVertex3iv)
ANT_GL_IMPL(glVertex3s)
ANT_GL_IMPL(glVertex3sv)
ANT_GL_IMPL(glVertex4d)
ANT_GL_IMPL(glVertex4dv)
ANT_GL_IMPL(glVertex4f)
ANT_GL_IMPL(glVertex4fv)
ANT_GL_IMPL(glVertex4i)
ANT_GL_IMPL(glVertex4iv)
ANT_GL_IMPL(glVertex4s)
ANT_GL_IMPL(glVertex4sv)
ANT_GL_IMPL(glVertexPointer)
ANT_GL_IMPL(glViewport)
#if defined(ANT_WINDOWS)
ANT_GL_IMPL(wglGetProcAddress)
#endif
namespace GL { PFNGLGetProcAddress _glGetProcAddress = NULL; }
// ---------------------------------------------------------------------------
#if defined(ANT_WINDOWS)
// ---------------------------------------------------------------------------
int LoadOpenGL()
{
if( g_OGLModule!=NULL )
{
return 1; // "OpenGL library already loaded"
}
g_OGLModule = LoadLibrary("OPENGL32.DLL");
if( g_OGLModule )
{
// Info(VERB_LOW, "Load %d OpenGL functions", g_NbOGLFunc);
int Res = 1;
for(int i=0; i<g_NbOGLFunc; ++i)
{
assert(g_OGLFuncRec[i].m_FuncPtr!=NULL);
assert(*(g_OGLFuncRec[i].m_FuncPtr)==NULL);
assert(g_OGLFuncRec[i].m_Name!=NULL);
assert(strlen(g_OGLFuncRec[i].m_Name)>0);
*(g_OGLFuncRec[i].m_FuncPtr) = reinterpret_cast<GL::PFNOpenGL>(GetProcAddress(g_OGLModule, g_OGLFuncRec[i].m_Name));
if( *(g_OGLFuncRec[i].m_FuncPtr)==NULL )
Res = 0; // Error("cannot find OpenGL function");
}
_glGetProcAddress = reinterpret_cast<GL::PFNGLGetProcAddress>(_wglGetProcAddress);
if( _glGetProcAddress==NULL )
Res = 0;
return Res;
}
else
{
// InternDisplayLastErrorWIN("Cannot load opengl32 DLL", false);
return 0; // cannot load DLL
}
}
// ---------------------------------------------------------------------------
int UnloadOpenGL()
{
if( g_OGLModule==NULL )
{
return 1; // "OpenGL library not loaded"
}
// Info(VERB_LOW, "Unload %d OpenGL functions", g_NbOGLFunc);
for(int i=0; i<g_NbOGLFunc; ++i)
{
assert(g_OGLFuncRec[i].m_FuncPtr!=NULL);
assert(*(g_OGLFuncRec[i].m_FuncPtr)!=NULL);
assert(g_OGLFuncRec[i].m_Name!=NULL);
assert(strlen(g_OGLFuncRec[i].m_Name)>0);
*(g_OGLFuncRec[i].m_FuncPtr) = NULL;
}
if( FreeLibrary(g_OGLModule) )
{
// Info(VERB_LOW, "OpenGL library unloaded");
g_OGLModule = NULL;
return 1;
}
else
{
// InternDisplayLastErrorWIN("Cannot unload opengl32 DLL", false);
return 0; // cannot unload opengl32.dll
}
}
// ---------------------------------------------------------------------------
namespace GL
{
PFNOpenGL Record(const char *_FuncName, PFNOpenGL *_FuncPtr)
{
if( g_NbOGLFunc>=ANT_NB_OGL_FUNC_MAX )
{
fprintf(stderr, "Too many OpenGL functions declared. Change ANT_NB_OGL_FUNC_MAX.");
exit(-1);
}
g_OGLFuncRec[g_NbOGLFunc].m_Name = _FuncName;
g_OGLFuncRec[g_NbOGLFunc].m_FuncPtr = _FuncPtr;
++g_NbOGLFunc;
return NULL;
}
} // namespace GL
// ---------------------------------------------------------------------------
#endif // defined(ANT_WINDOWS)
// ---------------------------------------------------------------------------
#if defined(ANT_UNIX)
int LoadOpenGL()
{
_glGetProcAddress = reinterpret_cast<GL::PFNGLGetProcAddress>(glXGetProcAddressARB);
return 1; // "OpenGL library is statically linked"
}
int UnloadOpenGL()
{
return 1; // "OpenGL library is statically linked"
}
#elif defined(ANT_OSX)
#include <dlfcn.h>
static void *gl_dyld = NULL;
static const char *gl_prefix = "_";
void *NSGLGetProcAddressNew(const GLubyte *name)
{
void *proc=NULL;
if (gl_dyld == NULL)
{
gl_dyld = dlopen("OpenGL",RTLD_LAZY);
}
if (gl_dyld)
{
NSString *sym = [[NSString alloc] initWithFormat: @"%s%s",gl_prefix,name];
proc = dlsym(gl_dyld,[sym UTF8String]);
[sym release];
}
return proc;
}
int LoadOpenGL()
{
_glGetProcAddress = reinterpret_cast<GL::PFNGLGetProcAddress>(NSGLGetProcAddressNew);
// try to load a symbol
if (_glGetProcAddress("glBindBufferARB") == NULL)
{
// remove the symbols underscore prefix (OSX 10.7 and later)
gl_prefix = "";
if (_glGetProcAddress("glBindBufferARB") == NULL)
{
// fail: fall back to underscore
gl_prefix = "_";
}
}
return 1;
}
int UnloadOpenGL()
{
if (gl_dyld)
{
dlclose(gl_dyld);
gl_dyld = NULL;
}
return 1;
}
#endif // defined(ANT_UNIX)
// ---------------------------------------------------------------------------

397
AntTweakBar/src/LoadOGL.h Normal file
View File

@@ -0,0 +1,397 @@
// ---------------------------------------------------------------------------
//
// @file LoadOGL.h
// @brief OpenGL declarations for dynamic loading
// @author Philippe Decaudin
// @license This file is part of the AntTweakBar library.
// For conditions of distribution and use, see License.txt
//
// note: Private header
//
// ---------------------------------------------------------------------------
#if !defined ANT_LOAD_OGL_INCLUDED
#define ANT_LOAD_OGL_INCLUDED
#define ANT_GL_DECL(_Ret, _Fct, _Params) \
extern "C" { typedef _Ret (APIENTRY* PFN##_Fct)_Params; } \
namespace GL { extern PFN##_Fct _##_Fct; } \
using GL::_##_Fct;
#if defined(ANT_WINDOWS)
# define ANT_GL_IMPL(_Fct) \
namespace GL { PFN##_Fct _##_Fct = (PFN##_Fct)Record(#_Fct, (PFNOpenGL*)(&_##_Fct)); }
#elif defined(ANT_UNIX) || defined(ANT_OSX)
# define ANT_GL_IMPL(_Fct) \
namespace GL { PFN##_Fct _##_Fct = _Fct; }
# if !defined(APIENTRY)
# define APIENTRY
# endif
#endif
int LoadOpenGL();
int UnloadOpenGL();
namespace GL
{
extern "C" { typedef void (APIENTRY* PFNOpenGL)(); }
PFNOpenGL Record(const char *_FuncName, PFNOpenGL *_FuncPtr);
extern "C" { typedef PFNOpenGL (APIENTRY *PFNGLGetProcAddress)(const char *); }
extern PFNGLGetProcAddress _glGetProcAddress;
}
using GL::_glGetProcAddress;
ANT_GL_DECL(void, glAccum, (GLenum op, GLfloat value))
ANT_GL_DECL(void, glAlphaFunc, (GLenum func, GLclampf ref))
ANT_GL_DECL(GLboolean, glAreTexturesResident, (GLsizei n, const GLuint *textures, GLboolean *residences))
ANT_GL_DECL(void, glArrayElement, (GLint i))
ANT_GL_DECL(void, glBegin, (GLenum mode))
ANT_GL_DECL(void, glBindTexture, (GLenum target, GLuint texture))
ANT_GL_DECL(void, glBitmap, (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap))
ANT_GL_DECL(void, glBlendFunc, (GLenum sfactor, GLenum dfactor))
ANT_GL_DECL(void, glCallList, (GLuint list))
ANT_GL_DECL(void, glCallLists, (GLsizei n, GLenum type, const GLvoid *lists))
ANT_GL_DECL(void, glClear, (GLbitfield mask))
ANT_GL_DECL(void, glClearAccum, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha))
ANT_GL_DECL(void, glClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha))
ANT_GL_DECL(void, glClearDepth, (GLclampd depth))
ANT_GL_DECL(void, glClearIndex, (GLfloat c))
ANT_GL_DECL(void, glClearStencil, (GLint s))
ANT_GL_DECL(void, glClipPlane, (GLenum plane, const GLdouble *equation))
ANT_GL_DECL(void, glColor3b, (GLbyte red, GLbyte green, GLbyte blue))
ANT_GL_DECL(void, glColor3bv, (const GLbyte *v))
ANT_GL_DECL(void, glColor3d, (GLdouble red, GLdouble green, GLdouble blue))
ANT_GL_DECL(void, glColor3dv, (const GLdouble *v))
ANT_GL_DECL(void, glColor3f, (GLfloat red, GLfloat green, GLfloat blue))
ANT_GL_DECL(void, glColor3fv, (const GLfloat *v))
ANT_GL_DECL(void, glColor3i, (GLint red, GLint green, GLint blue))
ANT_GL_DECL(void, glColor3iv, (const GLint *v))
ANT_GL_DECL(void, glColor3s, (GLshort red, GLshort green, GLshort blue))
ANT_GL_DECL(void, glColor3sv, (const GLshort *v))
ANT_GL_DECL(void, glColor3ub, (GLubyte red, GLubyte green, GLubyte blue))
ANT_GL_DECL(void, glColor3ubv, (const GLubyte *v))
ANT_GL_DECL(void, glColor3ui, (GLuint red, GLuint green, GLuint blue))
ANT_GL_DECL(void, glColor3uiv, (const GLuint *v))
ANT_GL_DECL(void, glColor3us, (GLushort red, GLushort green, GLushort blue))
ANT_GL_DECL(void, glColor3usv, (const GLushort *v))
ANT_GL_DECL(void, glColor4b, (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha))
ANT_GL_DECL(void, glColor4bv, (const GLbyte *v))
ANT_GL_DECL(void, glColor4d, (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha))
ANT_GL_DECL(void, glColor4dv, (const GLdouble *v))
ANT_GL_DECL(void, glColor4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha))
ANT_GL_DECL(void, glColor4fv, (const GLfloat *v))
ANT_GL_DECL(void, glColor4i, (GLint red, GLint green, GLint blue, GLint alpha))
ANT_GL_DECL(void, glColor4iv, (const GLint *v))
ANT_GL_DECL(void, glColor4s, (GLshort red, GLshort green, GLshort blue, GLshort alpha))
ANT_GL_DECL(void, glColor4sv, (const GLshort *v))
ANT_GL_DECL(void, glColor4ub, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha))
ANT_GL_DECL(void, glColor4ubv, (const GLubyte *v))
ANT_GL_DECL(void, glColor4ui, (GLuint red, GLuint green, GLuint blue, GLuint alpha))
ANT_GL_DECL(void, glColor4uiv, (const GLuint *v))
ANT_GL_DECL(void, glColor4us, (GLushort red, GLushort green, GLushort blue, GLushort alpha))
ANT_GL_DECL(void, glColor4usv, (const GLushort *v))
ANT_GL_DECL(void, glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha))
ANT_GL_DECL(void, glColorMaterial, (GLenum face, GLenum mode))
ANT_GL_DECL(void, glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer))
ANT_GL_DECL(void, glCopyPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type))
ANT_GL_DECL(void, glCopyTexImage1D, (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border))
ANT_GL_DECL(void, glCopyTexImage2D, (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border))
ANT_GL_DECL(void, glCopyTexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width))
ANT_GL_DECL(void, glCopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height))
ANT_GL_DECL(void, glCullFace, (GLenum mode))
ANT_GL_DECL(void, glDeleteLists, (GLuint list, GLsizei range))
ANT_GL_DECL(void, glDeleteTextures, (GLsizei n, const GLuint *textures))
ANT_GL_DECL(void, glDepthFunc, (GLenum func))
ANT_GL_DECL(void, glDepthMask, (GLboolean flag))
ANT_GL_DECL(void, glDepthRange, (GLclampd zNear, GLclampd zFar))
ANT_GL_DECL(void, glDisable, (GLenum cap))
ANT_GL_DECL(void, glDisableClientState, (GLenum array))
ANT_GL_DECL(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count))
ANT_GL_DECL(void, glDrawBuffer, (GLenum mode))
ANT_GL_DECL(void, glDrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices))
ANT_GL_DECL(void, glDrawPixels, (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels))
ANT_GL_DECL(void, glEdgeFlag, (GLboolean flag))
ANT_GL_DECL(void, glEdgeFlagPointer, (GLsizei stride, const void *pointer))
ANT_GL_DECL(void, glEdgeFlagv, (const GLboolean *flag))
ANT_GL_DECL(void, glEnable, (GLenum cap))
ANT_GL_DECL(void, glEnableClientState, (GLenum array))
ANT_GL_DECL(void, glEnd, (void))
ANT_GL_DECL(void, glEndList, (void))
ANT_GL_DECL(void, glEvalCoord1d, (GLdouble u))
ANT_GL_DECL(void, glEvalCoord1dv, (const GLdouble *u))
ANT_GL_DECL(void, glEvalCoord1f, (GLfloat u))
ANT_GL_DECL(void, glEvalCoord1fv, (const GLfloat *u))
ANT_GL_DECL(void, glEvalCoord2d, (GLdouble u, GLdouble v))
ANT_GL_DECL(void, glEvalCoord2dv, (const GLdouble *u))
ANT_GL_DECL(void, glEvalCoord2f, (GLfloat u, GLfloat v))
ANT_GL_DECL(void, glEvalCoord2fv, (const GLfloat *u))
ANT_GL_DECL(void, glEvalMesh1, (GLenum mode, GLint i1, GLint i2))
ANT_GL_DECL(void, glEvalMesh2, (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2))
ANT_GL_DECL(void, glEvalPoint1, (GLint i))
ANT_GL_DECL(void, glEvalPoint2, (GLint i, GLint j))
ANT_GL_DECL(void, glFeedbackBuffer, (GLsizei size, GLenum type, GLfloat *buffer))
ANT_GL_DECL(void, glFinish, (void))
ANT_GL_DECL(void, glFlush, (void))
ANT_GL_DECL(void, glFogf, (GLenum pname, GLfloat param))
ANT_GL_DECL(void, glFogfv, (GLenum pname, const GLfloat *params))
ANT_GL_DECL(void, glFogi, (GLenum pname, GLint param))
ANT_GL_DECL(void, glFogiv, (GLenum pname, const GLint *params))
ANT_GL_DECL(void, glFrontFace, (GLenum mode))
ANT_GL_DECL(void, glFrustum, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar))
ANT_GL_DECL(GLuint, glGenLists, (GLsizei range))
ANT_GL_DECL(void, glGenTextures, (GLsizei n, GLuint *textures))
ANT_GL_DECL(void, glGetBooleanv, (GLenum pname, GLboolean *params))
ANT_GL_DECL(void, glGetClipPlane, (GLenum plane, GLdouble *equation))
ANT_GL_DECL(void, glGetDoublev, (GLenum pname, GLdouble *params))
ANT_GL_DECL(GLenum, glGetError, (void))
ANT_GL_DECL(void, glGetFloatv, (GLenum pname, GLfloat *params))
ANT_GL_DECL(void, glGetIntegerv, (GLenum pname, GLint *params))
ANT_GL_DECL(void, glGetLightfv, (GLenum light, GLenum pname, GLfloat *params))
ANT_GL_DECL(void, glGetLightiv, (GLenum light, GLenum pname, GLint *params))
ANT_GL_DECL(void, glGetMapdv, (GLenum target, GLenum query, GLdouble *v))
ANT_GL_DECL(void, glGetMapfv, (GLenum target, GLenum query, GLfloat *v))
ANT_GL_DECL(void, glGetMapiv, (GLenum target, GLenum query, GLint *v))
ANT_GL_DECL(void, glGetMaterialfv, (GLenum face, GLenum pname, GLfloat *params))
ANT_GL_DECL(void, glGetMaterialiv, (GLenum face, GLenum pname, GLint *params))
ANT_GL_DECL(void, glGetPixelMapfv, (GLenum map, GLfloat *values))
ANT_GL_DECL(void, glGetPixelMapuiv, (GLenum map, GLuint *values))
ANT_GL_DECL(void, glGetPixelMapusv, (GLenum map, GLushort *values))
ANT_GL_DECL(void, glGetPointerv, (GLenum pname, GLvoid* *params))
ANT_GL_DECL(void, glGetPolygonStipple, (GLubyte *mask))
ANT_GL_DECL(const GLubyte *, glGetString, (GLenum name))
ANT_GL_DECL(void, glGetTexEnvfv, (GLenum target, GLenum pname, GLfloat *params))
ANT_GL_DECL(void, glGetTexEnviv, (GLenum target, GLenum pname, GLint *params))
ANT_GL_DECL(void, glGetTexGendv, (GLenum coord, GLenum pname, GLdouble *params))
ANT_GL_DECL(void, glGetTexGenfv, (GLenum coord, GLenum pname, GLfloat *params))
ANT_GL_DECL(void, glGetTexGeniv, (GLenum coord, GLenum pname, GLint *params))
ANT_GL_DECL(void, glGetTexImage, (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels))
ANT_GL_DECL(void, glGetTexLevelParameterfv, (GLenum target, GLint level, GLenum pname, GLfloat *params))
ANT_GL_DECL(void, glGetTexLevelParameteriv, (GLenum target, GLint level, GLenum pname, GLint *params))
ANT_GL_DECL(void, glGetTexParameterfv, (GLenum target, GLenum pname, GLfloat *params))
ANT_GL_DECL(void, glGetTexParameteriv, (GLenum target, GLenum pname, GLint *params))
ANT_GL_DECL(void, glHint, (GLenum target, GLenum mode))
ANT_GL_DECL(void, glIndexMask, (GLuint mask))
ANT_GL_DECL(void, glIndexPointer, (GLenum type, GLsizei stride, const GLvoid *pointer))
ANT_GL_DECL(void, glIndexd, (GLdouble c))
ANT_GL_DECL(void, glIndexdv, (const GLdouble *c))
ANT_GL_DECL(void, glIndexf, (GLfloat c))
ANT_GL_DECL(void, glIndexfv, (const GLfloat *c))
ANT_GL_DECL(void, glIndexi, (GLint c))
ANT_GL_DECL(void, glIndexiv, (const GLint *c))
ANT_GL_DECL(void, glIndexs, (GLshort c))
ANT_GL_DECL(void, glIndexsv, (const GLshort *c))
ANT_GL_DECL(void, glIndexub, (GLubyte c))
ANT_GL_DECL(void, glIndexubv, (const GLubyte *c))
ANT_GL_DECL(void, glInitNames, (void))
ANT_GL_DECL(void, glInterleavedArrays, (GLenum format, GLsizei stride, const GLvoid *pointer))
ANT_GL_DECL(GLboolean, glIsEnabled, (GLenum cap))
ANT_GL_DECL(GLboolean, glIsList, (GLuint list))
ANT_GL_DECL(GLboolean, glIsTexture, (GLuint texture))
ANT_GL_DECL(void, glLightModelf, (GLenum pname, GLfloat param))
ANT_GL_DECL(void, glLightModelfv, (GLenum pname, const GLfloat *params))
ANT_GL_DECL(void, glLightModeli, (GLenum pname, GLint param))
ANT_GL_DECL(void, glLightModeliv, (GLenum pname, const GLint *params))
ANT_GL_DECL(void, glLightf, (GLenum light, GLenum pname, GLfloat param))
ANT_GL_DECL(void, glLightfv, (GLenum light, GLenum pname, const GLfloat *params))
ANT_GL_DECL(void, glLighti, (GLenum light, GLenum pname, GLint param))
ANT_GL_DECL(void, glLightiv, (GLenum light, GLenum pname, const GLint *params))
ANT_GL_DECL(void, glLineStipple, (GLint factor, GLushort pattern))
ANT_GL_DECL(void, glLineWidth, (GLfloat width))
ANT_GL_DECL(void, glListBase, (GLuint base))
ANT_GL_DECL(void, glLoadIdentity, (void))
ANT_GL_DECL(void, glLoadMatrixd, (const GLdouble *m))
ANT_GL_DECL(void, glLoadMatrixf, (const GLfloat *m))
ANT_GL_DECL(void, glLoadName, (GLuint name))
ANT_GL_DECL(void, glLogicOp, (GLenum opcode))
ANT_GL_DECL(void, glMap1d, (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points))
ANT_GL_DECL(void, glMap1f, (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points))
ANT_GL_DECL(void, glMap2d, (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points))
ANT_GL_DECL(void, glMap2f, (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points))
ANT_GL_DECL(void, glMapGrid1d, (GLint un, GLdouble u1, GLdouble u2))
ANT_GL_DECL(void, glMapGrid1f, (GLint un, GLfloat u1, GLfloat u2))
ANT_GL_DECL(void, glMapGrid2d, (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2))
ANT_GL_DECL(void, glMapGrid2f, (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2))
ANT_GL_DECL(void, glMaterialf, (GLenum face, GLenum pname, GLfloat param))
ANT_GL_DECL(void, glMaterialfv, (GLenum face, GLenum pname, const GLfloat *params))
ANT_GL_DECL(void, glMateriali, (GLenum face, GLenum pname, GLint param))
ANT_GL_DECL(void, glMaterialiv, (GLenum face, GLenum pname, const GLint *params))
ANT_GL_DECL(void, glMatrixMode, (GLenum mode))
ANT_GL_DECL(void, glMultMatrixd, (const GLdouble *m))
ANT_GL_DECL(void, glMultMatrixf, (const GLfloat *m))
ANT_GL_DECL(void, glNewList, (GLuint list, GLenum mode))
ANT_GL_DECL(void, glNormal3b, (GLbyte nx, GLbyte ny, GLbyte nz))
ANT_GL_DECL(void, glNormal3bv, (const GLbyte *v))
ANT_GL_DECL(void, glNormal3d, (GLdouble nx, GLdouble ny, GLdouble nz))
ANT_GL_DECL(void, glNormal3dv, (const GLdouble *v))
ANT_GL_DECL(void, glNormal3f, (GLfloat nx, GLfloat ny, GLfloat nz))
ANT_GL_DECL(void, glNormal3fv, (const GLfloat *v))
ANT_GL_DECL(void, glNormal3i, (GLint nx, GLint ny, GLint nz))
ANT_GL_DECL(void, glNormal3iv, (const GLint *v))
ANT_GL_DECL(void, glNormal3s, (GLshort nx, GLshort ny, GLshort nz))
ANT_GL_DECL(void, glNormal3sv, (const GLshort *v))
ANT_GL_DECL(void, glNormalPointer, (GLenum type, GLsizei stride, const GLvoid *pointer))
ANT_GL_DECL(void, glOrtho, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar))
ANT_GL_DECL(void, glPassThrough, (GLfloat token))
ANT_GL_DECL(void, glPixelMapfv, (GLenum map, GLsizei mapsize, const GLfloat *values))
ANT_GL_DECL(void, glPixelMapuiv, (GLenum map, GLsizei mapsize, const GLuint *values))
ANT_GL_DECL(void, glPixelMapusv, (GLenum map, GLsizei mapsize, const GLushort *values))
ANT_GL_DECL(void, glPixelStoref, (GLenum pname, GLfloat param))
ANT_GL_DECL(void, glPixelStorei, (GLenum pname, GLint param))
ANT_GL_DECL(void, glPixelTransferf, (GLenum pname, GLfloat param))
ANT_GL_DECL(void, glPixelTransferi, (GLenum pname, GLint param))
ANT_GL_DECL(void, glPixelZoom, (GLfloat xfactor, GLfloat yfactor))
ANT_GL_DECL(void, glPointSize, (GLfloat size))
ANT_GL_DECL(void, glPolygonMode, (GLenum face, GLenum mode))
ANT_GL_DECL(void, glPolygonOffset, (GLfloat factor, GLfloat units))
ANT_GL_DECL(void, glPolygonStipple, (const GLubyte *mask))
ANT_GL_DECL(void, glPopAttrib, (void))
ANT_GL_DECL(void, glPopClientAttrib, (void))
ANT_GL_DECL(void, glPopMatrix, (void))
ANT_GL_DECL(void, glPopName, (void))
ANT_GL_DECL(void, glPrioritizeTextures, (GLsizei n, const GLuint *textures, const GLclampf *priorities))
ANT_GL_DECL(void, glPushAttrib, (GLbitfield mask))
ANT_GL_DECL(void, glPushClientAttrib, (GLbitfield mask))
ANT_GL_DECL(void, glPushMatrix, (void))
ANT_GL_DECL(void, glPushName, (GLuint name))
ANT_GL_DECL(void, glRasterPos2d, (GLdouble x, GLdouble y))
ANT_GL_DECL(void, glRasterPos2dv, (const GLdouble *v))
ANT_GL_DECL(void, glRasterPos2f, (GLfloat x, GLfloat y))
ANT_GL_DECL(void, glRasterPos2fv, (const GLfloat *v))
ANT_GL_DECL(void, glRasterPos2i, (GLint x, GLint y))
ANT_GL_DECL(void, glRasterPos2iv, (const GLint *v))
ANT_GL_DECL(void, glRasterPos2s, (GLshort x, GLshort y))
ANT_GL_DECL(void, glRasterPos2sv, (const GLshort *v))
ANT_GL_DECL(void, glRasterPos3d, (GLdouble x, GLdouble y, GLdouble z))
ANT_GL_DECL(void, glRasterPos3dv, (const GLdouble *v))
ANT_GL_DECL(void, glRasterPos3f, (GLfloat x, GLfloat y, GLfloat z))
ANT_GL_DECL(void, glRasterPos3fv, (const GLfloat *v))
ANT_GL_DECL(void, glRasterPos3i, (GLint x, GLint y, GLint z))
ANT_GL_DECL(void, glRasterPos3iv, (const GLint *v))
ANT_GL_DECL(void, glRasterPos3s, (GLshort x, GLshort y, GLshort z))
ANT_GL_DECL(void, glRasterPos3sv, (const GLshort *v))
ANT_GL_DECL(void, glRasterPos4d, (GLdouble x, GLdouble y, GLdouble z, GLdouble w))
ANT_GL_DECL(void, glRasterPos4dv, (const GLdouble *v))
ANT_GL_DECL(void, glRasterPos4f, (GLfloat x, GLfloat y, GLfloat z, GLfloat w))
ANT_GL_DECL(void, glRasterPos4fv, (const GLfloat *v))
ANT_GL_DECL(void, glRasterPos4i, (GLint x, GLint y, GLint z, GLint w))
ANT_GL_DECL(void, glRasterPos4iv, (const GLint *v))
ANT_GL_DECL(void, glRasterPos4s, (GLshort x, GLshort y, GLshort z, GLshort w))
ANT_GL_DECL(void, glRasterPos4sv, (const GLshort *v))
ANT_GL_DECL(void, glReadBuffer, (GLenum mode))
ANT_GL_DECL(void, glReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels))
ANT_GL_DECL(void, glRectd, (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2))
ANT_GL_DECL(void, glRectdv, (const GLdouble *v1, const GLdouble *v2))
ANT_GL_DECL(void, glRectf, (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2))
ANT_GL_DECL(void, glRectfv, (const GLfloat *v1, const GLfloat *v2))
ANT_GL_DECL(void, glRecti, (GLint x1, GLint y1, GLint x2, GLint y2))
ANT_GL_DECL(void, glRectiv, (const GLint *v1, const GLint *v2))
ANT_GL_DECL(void, glRects, (GLshort x1, GLshort y1, GLshort x2, GLshort y2))
ANT_GL_DECL(void, glRectsv, (const GLshort *v1, const GLshort *v2))
ANT_GL_DECL(GLint, glRenderMode, (GLenum mode))
ANT_GL_DECL(void, glRotated, (GLdouble angle, GLdouble x, GLdouble y, GLdouble z))
ANT_GL_DECL(void, glRotatef, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z))
ANT_GL_DECL(void, glScaled, (GLdouble x, GLdouble y, GLdouble z))
ANT_GL_DECL(void, glScalef, (GLfloat x, GLfloat y, GLfloat z))
ANT_GL_DECL(void, glScissor, (GLint x, GLint y, GLsizei width, GLsizei height))
ANT_GL_DECL(void, glSelectBuffer, (GLsizei size, GLuint *buffer))
ANT_GL_DECL(void, glShadeModel, (GLenum mode))
ANT_GL_DECL(void, glStencilFunc, (GLenum func, GLint ref, GLuint mask))
ANT_GL_DECL(void, glStencilMask, (GLuint mask))
ANT_GL_DECL(void, glStencilOp, (GLenum fail, GLenum zfail, GLenum zpass))
ANT_GL_DECL(void, glTexCoord1d, (GLdouble s))
ANT_GL_DECL(void, glTexCoord1dv, (const GLdouble *v))
ANT_GL_DECL(void, glTexCoord1f, (GLfloat s))
ANT_GL_DECL(void, glTexCoord1fv, (const GLfloat *v))
ANT_GL_DECL(void, glTexCoord1i, (GLint s))
ANT_GL_DECL(void, glTexCoord1iv, (const GLint *v))
ANT_GL_DECL(void, glTexCoord1s, (GLshort s))
ANT_GL_DECL(void, glTexCoord1sv, (const GLshort *v))
ANT_GL_DECL(void, glTexCoord2d, (GLdouble s, GLdouble t))
ANT_GL_DECL(void, glTexCoord2dv, (const GLdouble *v))
ANT_GL_DECL(void, glTexCoord2f, (GLfloat s, GLfloat t))
ANT_GL_DECL(void, glTexCoord2fv, (const GLfloat *v))
ANT_GL_DECL(void, glTexCoord2i, (GLint s, GLint t))
ANT_GL_DECL(void, glTexCoord2iv, (const GLint *v))
ANT_GL_DECL(void, glTexCoord2s, (GLshort s, GLshort t))
ANT_GL_DECL(void, glTexCoord2sv, (const GLshort *v))
ANT_GL_DECL(void, glTexCoord3d, (GLdouble s, GLdouble t, GLdouble r))
ANT_GL_DECL(void, glTexCoord3dv, (const GLdouble *v))
ANT_GL_DECL(void, glTexCoord3f, (GLfloat s, GLfloat t, GLfloat r))
ANT_GL_DECL(void, glTexCoord3fv, (const GLfloat *v))
ANT_GL_DECL(void, glTexCoord3i, (GLint s, GLint t, GLint r))
ANT_GL_DECL(void, glTexCoord3iv, (const GLint *v))
ANT_GL_DECL(void, glTexCoord3s, (GLshort s, GLshort t, GLshort r))
ANT_GL_DECL(void, glTexCoord3sv, (const GLshort *v))
ANT_GL_DECL(void, glTexCoord4d, (GLdouble s, GLdouble t, GLdouble r, GLdouble q))
ANT_GL_DECL(void, glTexCoord4dv, (const GLdouble *v))
ANT_GL_DECL(void, glTexCoord4f, (GLfloat s, GLfloat t, GLfloat r, GLfloat q))
ANT_GL_DECL(void, glTexCoord4fv, (const GLfloat *v))
ANT_GL_DECL(void, glTexCoord4i, (GLint s, GLint t, GLint r, GLint q))
ANT_GL_DECL(void, glTexCoord4iv, (const GLint *v))
ANT_GL_DECL(void, glTexCoord4s, (GLshort s, GLshort t, GLshort r, GLshort q))
ANT_GL_DECL(void, glTexCoord4sv, (const GLshort *v))
ANT_GL_DECL(void, glTexCoordPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer))
ANT_GL_DECL(void, glTexEnvf, (GLenum target, GLenum pname, GLfloat param))
ANT_GL_DECL(void, glTexEnvfv, (GLenum target, GLenum pname, const GLfloat *params))
ANT_GL_DECL(void, glTexEnvi, (GLenum target, GLenum pname, GLint param))
ANT_GL_DECL(void, glTexEnviv, (GLenum target, GLenum pname, const GLint *params))
ANT_GL_DECL(void, glTexGend, (GLenum coord, GLenum pname, GLdouble param))
ANT_GL_DECL(void, glTexGendv, (GLenum coord, GLenum pname, const GLdouble *params))
ANT_GL_DECL(void, glTexGenf, (GLenum coord, GLenum pname, GLfloat param))
ANT_GL_DECL(void, glTexGenfv, (GLenum coord, GLenum pname, const GLfloat *params))
ANT_GL_DECL(void, glTexGeni, (GLenum coord, GLenum pname, GLint param))
ANT_GL_DECL(void, glTexGeniv, (GLenum coord, GLenum pname, const GLint *params))
#if defined(ANT_OSX) && (MAC_OS_X_VERSION_MAX_ALLOWED < 1070)
// Mac OSX < 10.7 redefines these OpenGL calls: glTexImage1D, glTexImage2D
ANT_GL_DECL(void, glTexImage1D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels))
ANT_GL_DECL(void, glTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels))
#else
ANT_GL_DECL(void, glTexImage1D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels))
ANT_GL_DECL(void, glTexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels))
#endif
ANT_GL_DECL(void, glTexParameterf, (GLenum target, GLenum pname, GLfloat param))
ANT_GL_DECL(void, glTexParameterfv, (GLenum target, GLenum pname, const GLfloat *params))
ANT_GL_DECL(void, glTexParameteri, (GLenum target, GLenum pname, GLint param))
ANT_GL_DECL(void, glTexParameteriv, (GLenum target, GLenum pname, const GLint *params))
ANT_GL_DECL(void, glTexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels))
ANT_GL_DECL(void, glTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels))
ANT_GL_DECL(void, glTranslated, (GLdouble x, GLdouble y, GLdouble z))
ANT_GL_DECL(void, glTranslatef, (GLfloat x, GLfloat y, GLfloat z))
ANT_GL_DECL(void, glVertex2d, (GLdouble x, GLdouble y))
ANT_GL_DECL(void, glVertex2dv, (const GLdouble *v))
ANT_GL_DECL(void, glVertex2f, (GLfloat x, GLfloat y))
ANT_GL_DECL(void, glVertex2fv, (const GLfloat *v))
ANT_GL_DECL(void, glVertex2i, (GLint x, GLint y))
ANT_GL_DECL(void, glVertex2iv, (const GLint *v))
ANT_GL_DECL(void, glVertex2s, (GLshort x, GLshort y))
ANT_GL_DECL(void, glVertex2sv, (const GLshort *v))
ANT_GL_DECL(void, glVertex3d, (GLdouble x, GLdouble y, GLdouble z))
ANT_GL_DECL(void, glVertex3dv, (const GLdouble *v))
ANT_GL_DECL(void, glVertex3f, (GLfloat x, GLfloat y, GLfloat z))
ANT_GL_DECL(void, glVertex3fv, (const GLfloat *v))
ANT_GL_DECL(void, glVertex3i, (GLint x, GLint y, GLint z))
ANT_GL_DECL(void, glVertex3iv, (const GLint *v))
ANT_GL_DECL(void, glVertex3s, (GLshort x, GLshort y, GLshort z))
ANT_GL_DECL(void, glVertex3sv, (const GLshort *v))
ANT_GL_DECL(void, glVertex4d, (GLdouble x, GLdouble y, GLdouble z, GLdouble w))
ANT_GL_DECL(void, glVertex4dv, (const GLdouble *v))
ANT_GL_DECL(void, glVertex4f, (GLfloat x, GLfloat y, GLfloat z, GLfloat w))
ANT_GL_DECL(void, glVertex4fv, (const GLfloat *v))
ANT_GL_DECL(void, glVertex4i, (GLint x, GLint y, GLint z, GLint w))
ANT_GL_DECL(void, glVertex4iv, (const GLint *v))
ANT_GL_DECL(void, glVertex4s, (GLshort x, GLshort y, GLshort z, GLshort w))
ANT_GL_DECL(void, glVertex4sv, (const GLshort *v))
ANT_GL_DECL(void, glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer))
ANT_GL_DECL(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height))
#ifdef ANT_WINDOWS
ANT_GL_DECL(PROC, wglGetProcAddress, (LPCSTR))
#endif
#endif // !defined ANT_LOAD_OGL_INCLUDED

View File

@@ -0,0 +1,539 @@
// ---------------------------------------------------------------------------
//
// @file LoadOGLCore.cpp
// @author Philippe Decaudin
// @license This file is part of the AntTweakBar library.
// For conditions of distribution and use, see License.txt
//
// ---------------------------------------------------------------------------
#include "TwPrecomp.h"
#include "LoadOGLCore.h"
// ---------------------------------------------------------------------------
#define ANT_NB_OGL_CORE_FUNC_MAX 512
struct COGLCoreFuncRec
{
const char * m_Name;
GLCore::PFNOpenGL * m_FuncPtr;
COGLCoreFuncRec() : m_Name(NULL), m_FuncPtr(NULL) {}
};
COGLCoreFuncRec g_OGLCoreFuncRec[ANT_NB_OGL_CORE_FUNC_MAX];
int g_NbOGLCoreFunc = 0;
#if defined(ANT_WINDOWS)
HMODULE g_OGLCoreModule = NULL;
#endif
// ---------------------------------------------------------------------------
// GL 1.0
ANT_GL_CORE_IMPL(glCullFace)
ANT_GL_CORE_IMPL(glFrontFace)
ANT_GL_CORE_IMPL(glHint)
ANT_GL_CORE_IMPL(glLineWidth)
ANT_GL_CORE_IMPL(glPointSize)
ANT_GL_CORE_IMPL(glPolygonMode)
ANT_GL_CORE_IMPL(glScissor)
ANT_GL_CORE_IMPL(glTexParameterf)
ANT_GL_CORE_IMPL(glTexParameterfv)
ANT_GL_CORE_IMPL(glTexParameteri)
ANT_GL_CORE_IMPL(glTexParameteriv)
ANT_GL_CORE_IMPL(glTexImage1D)
ANT_GL_CORE_IMPL(glTexImage2D)
ANT_GL_CORE_IMPL(glDrawBuffer)
ANT_GL_CORE_IMPL(glClear)
ANT_GL_CORE_IMPL(glClearColor)
ANT_GL_CORE_IMPL(glClearStencil)
ANT_GL_CORE_IMPL(glClearDepth)
ANT_GL_CORE_IMPL(glStencilMask)
ANT_GL_CORE_IMPL(glColorMask)
ANT_GL_CORE_IMPL(glDepthMask)
ANT_GL_CORE_IMPL(glDisable)
ANT_GL_CORE_IMPL(glEnable)
ANT_GL_CORE_IMPL(glFinish)
ANT_GL_CORE_IMPL(glFlush)
ANT_GL_CORE_IMPL(glBlendFunc)
ANT_GL_CORE_IMPL(glLogicOp)
ANT_GL_CORE_IMPL(glStencilFunc)
ANT_GL_CORE_IMPL(glStencilOp)
ANT_GL_CORE_IMPL(glDepthFunc)
ANT_GL_CORE_IMPL(glPixelStoref)
ANT_GL_CORE_IMPL(glPixelStorei)
ANT_GL_CORE_IMPL(glReadBuffer)
ANT_GL_CORE_IMPL(glReadPixels)
ANT_GL_CORE_IMPL(glGetBooleanv)
ANT_GL_CORE_IMPL(glGetDoublev)
ANT_GL_CORE_IMPL(glGetError)
ANT_GL_CORE_IMPL(glGetFloatv)
ANT_GL_CORE_IMPL(glGetIntegerv)
ANT_GL_CORE_IMPL(glGetString)
ANT_GL_CORE_IMPL(glGetTexImage)
ANT_GL_CORE_IMPL(glGetTexParameterfv)
ANT_GL_CORE_IMPL(glGetTexParameteriv)
ANT_GL_CORE_IMPL(glGetTexLevelParameterfv)
ANT_GL_CORE_IMPL(glGetTexLevelParameteriv)
ANT_GL_CORE_IMPL(glIsEnabled)
ANT_GL_CORE_IMPL(glDepthRange)
ANT_GL_CORE_IMPL(glViewport)
// GL 1.1
ANT_GL_CORE_IMPL(glDrawArrays)
ANT_GL_CORE_IMPL(glDrawElements)
ANT_GL_CORE_IMPL(glGetPointerv)
ANT_GL_CORE_IMPL(glPolygonOffset)
ANT_GL_CORE_IMPL(glCopyTexImage1D)
ANT_GL_CORE_IMPL(glCopyTexImage2D)
ANT_GL_CORE_IMPL(glCopyTexSubImage1D)
ANT_GL_CORE_IMPL(glCopyTexSubImage2D)
ANT_GL_CORE_IMPL(glTexSubImage1D)
ANT_GL_CORE_IMPL(glTexSubImage2D)
ANT_GL_CORE_IMPL(glBindTexture)
ANT_GL_CORE_IMPL(glDeleteTextures)
ANT_GL_CORE_IMPL(glGenTextures)
ANT_GL_CORE_IMPL(glIsTexture)
// GL 1.2
ANT_GL_CORE_IMPL(glBlendColor)
ANT_GL_CORE_IMPL(glBlendEquation)
ANT_GL_CORE_IMPL(glDrawRangeElements)
ANT_GL_CORE_IMPL(glTexImage3D)
ANT_GL_CORE_IMPL(glTexSubImage3D)
ANT_GL_CORE_IMPL(glCopyTexSubImage3D)
// GL 1.3
ANT_GL_CORE_IMPL(glActiveTexture)
ANT_GL_CORE_IMPL(glSampleCoverage)
ANT_GL_CORE_IMPL(glCompressedTexImage3D)
ANT_GL_CORE_IMPL(glCompressedTexImage2D)
ANT_GL_CORE_IMPL(glCompressedTexImage1D)
ANT_GL_CORE_IMPL(glCompressedTexSubImage3D)
ANT_GL_CORE_IMPL(glCompressedTexSubImage2D)
ANT_GL_CORE_IMPL(glCompressedTexSubImage1D)
ANT_GL_CORE_IMPL(glGetCompressedTexImage)
// GL 1.4
ANT_GL_CORE_IMPL(glBlendFuncSeparate)
ANT_GL_CORE_IMPL(glMultiDrawArrays)
ANT_GL_CORE_IMPL(glMultiDrawElements)
ANT_GL_CORE_IMPL(glPointParameterf)
ANT_GL_CORE_IMPL(glPointParameterfv)
ANT_GL_CORE_IMPL(glPointParameteri)
ANT_GL_CORE_IMPL(glPointParameteriv)
// GL 1.5
ANT_GL_CORE_IMPL(glGenQueries)
ANT_GL_CORE_IMPL(glDeleteQueries)
ANT_GL_CORE_IMPL(glIsQuery)
ANT_GL_CORE_IMPL(glBeginQuery)
ANT_GL_CORE_IMPL(glEndQuery)
ANT_GL_CORE_IMPL(glGetQueryiv)
ANT_GL_CORE_IMPL(glGetQueryObjectiv)
ANT_GL_CORE_IMPL(glGetQueryObjectuiv)
ANT_GL_CORE_IMPL(glBindBuffer)
ANT_GL_CORE_IMPL(glDeleteBuffers)
ANT_GL_CORE_IMPL(glGenBuffers)
ANT_GL_CORE_IMPL(glIsBuffer)
ANT_GL_CORE_IMPL(glBufferData)
ANT_GL_CORE_IMPL(glBufferSubData)
ANT_GL_CORE_IMPL(glGetBufferSubData)
ANT_GL_CORE_IMPL(glMapBuffer)
ANT_GL_CORE_IMPL(glUnmapBuffer)
ANT_GL_CORE_IMPL(glGetBufferParameteriv)
ANT_GL_CORE_IMPL(glGetBufferPointerv)
// GL 2.0
ANT_GL_CORE_IMPL(glBlendEquationSeparate)
ANT_GL_CORE_IMPL(glDrawBuffers)
ANT_GL_CORE_IMPL(glStencilOpSeparate)
ANT_GL_CORE_IMPL(glStencilFuncSeparate)
ANT_GL_CORE_IMPL(glStencilMaskSeparate)
ANT_GL_CORE_IMPL(glAttachShader)
ANT_GL_CORE_IMPL(glBindAttribLocation)
ANT_GL_CORE_IMPL(glCompileShader)
ANT_GL_CORE_IMPL(glCreateProgram)
ANT_GL_CORE_IMPL(glCreateShader)
ANT_GL_CORE_IMPL(glDeleteProgram)
ANT_GL_CORE_IMPL(glDeleteShader)
ANT_GL_CORE_IMPL(glDetachShader)
ANT_GL_CORE_IMPL(glDisableVertexAttribArray)
ANT_GL_CORE_IMPL(glEnableVertexAttribArray)
ANT_GL_CORE_IMPL(glGetActiveAttrib)
ANT_GL_CORE_IMPL(glGetActiveUniform)
ANT_GL_CORE_IMPL(glGetAttachedShaders)
ANT_GL_CORE_IMPL(glGetAttribLocation)
ANT_GL_CORE_IMPL(glGetProgramiv)
ANT_GL_CORE_IMPL(glGetProgramInfoLog)
ANT_GL_CORE_IMPL(glGetShaderiv)
ANT_GL_CORE_IMPL(glGetShaderInfoLog)
ANT_GL_CORE_IMPL(glGetShaderSource)
ANT_GL_CORE_IMPL(glGetUniformLocation)
ANT_GL_CORE_IMPL(glGetUniformfv)
ANT_GL_CORE_IMPL(glGetUniformiv)
ANT_GL_CORE_IMPL(glGetVertexAttribdv)
ANT_GL_CORE_IMPL(glGetVertexAttribfv)
ANT_GL_CORE_IMPL(glGetVertexAttribiv)
ANT_GL_CORE_IMPL(glGetVertexAttribPointerv)
ANT_GL_CORE_IMPL(glIsProgram)
ANT_GL_CORE_IMPL(glIsShader)
ANT_GL_CORE_IMPL(glLinkProgram)
ANT_GL_CORE_IMPL(glShaderSource)
ANT_GL_CORE_IMPL(glUseProgram)
ANT_GL_CORE_IMPL(glUniform1f)
ANT_GL_CORE_IMPL(glUniform2f)
ANT_GL_CORE_IMPL(glUniform3f)
ANT_GL_CORE_IMPL(glUniform4f)
ANT_GL_CORE_IMPL(glUniform1i)
ANT_GL_CORE_IMPL(glUniform2i)
ANT_GL_CORE_IMPL(glUniform3i)
ANT_GL_CORE_IMPL(glUniform4i)
ANT_GL_CORE_IMPL(glUniform1fv)
ANT_GL_CORE_IMPL(glUniform2fv)
ANT_GL_CORE_IMPL(glUniform3fv)
ANT_GL_CORE_IMPL(glUniform4fv)
ANT_GL_CORE_IMPL(glUniform1iv)
ANT_GL_CORE_IMPL(glUniform2iv)
ANT_GL_CORE_IMPL(glUniform3iv)
ANT_GL_CORE_IMPL(glUniform4iv)
ANT_GL_CORE_IMPL(glUniformMatrix2fv)
ANT_GL_CORE_IMPL(glUniformMatrix3fv)
ANT_GL_CORE_IMPL(glUniformMatrix4fv)
ANT_GL_CORE_IMPL(glValidateProgram)
ANT_GL_CORE_IMPL(glVertexAttrib1d)
ANT_GL_CORE_IMPL(glVertexAttrib1dv)
ANT_GL_CORE_IMPL(glVertexAttrib1f)
ANT_GL_CORE_IMPL(glVertexAttrib1fv)
ANT_GL_CORE_IMPL(glVertexAttrib1s)
ANT_GL_CORE_IMPL(glVertexAttrib1sv)
ANT_GL_CORE_IMPL(glVertexAttrib2d)
ANT_GL_CORE_IMPL(glVertexAttrib2dv)
ANT_GL_CORE_IMPL(glVertexAttrib2f)
ANT_GL_CORE_IMPL(glVertexAttrib2fv)
ANT_GL_CORE_IMPL(glVertexAttrib2s)
ANT_GL_CORE_IMPL(glVertexAttrib2sv)
ANT_GL_CORE_IMPL(glVertexAttrib3d)
ANT_GL_CORE_IMPL(glVertexAttrib3dv)
ANT_GL_CORE_IMPL(glVertexAttrib3f)
ANT_GL_CORE_IMPL(glVertexAttrib3fv)
ANT_GL_CORE_IMPL(glVertexAttrib3s)
ANT_GL_CORE_IMPL(glVertexAttrib3sv)
ANT_GL_CORE_IMPL(glVertexAttrib4Nbv)
ANT_GL_CORE_IMPL(glVertexAttrib4Niv)
ANT_GL_CORE_IMPL(glVertexAttrib4Nsv)
ANT_GL_CORE_IMPL(glVertexAttrib4Nub)
ANT_GL_CORE_IMPL(glVertexAttrib4Nubv)
ANT_GL_CORE_IMPL(glVertexAttrib4Nuiv)
ANT_GL_CORE_IMPL(glVertexAttrib4Nusv)
ANT_GL_CORE_IMPL(glVertexAttrib4bv)
ANT_GL_CORE_IMPL(glVertexAttrib4d)
ANT_GL_CORE_IMPL(glVertexAttrib4dv)
ANT_GL_CORE_IMPL(glVertexAttrib4f)
ANT_GL_CORE_IMPL(glVertexAttrib4fv)
ANT_GL_CORE_IMPL(glVertexAttrib4iv)
ANT_GL_CORE_IMPL(glVertexAttrib4s)
ANT_GL_CORE_IMPL(glVertexAttrib4sv)
ANT_GL_CORE_IMPL(glVertexAttrib4ubv)
ANT_GL_CORE_IMPL(glVertexAttrib4uiv)
ANT_GL_CORE_IMPL(glVertexAttrib4usv)
ANT_GL_CORE_IMPL(glVertexAttribPointer)
/*
// GL 2.1
ANT_GL_CORE_IMPL(glUniformMatrix2x3fv)
ANT_GL_CORE_IMPL(glUniformMatrix3x2fv)
ANT_GL_CORE_IMPL(glUniformMatrix2x4fv)
ANT_GL_CORE_IMPL(glUniformMatrix4x2fv)
ANT_GL_CORE_IMPL(glUniformMatrix3x4fv)
ANT_GL_CORE_IMPL(glUniformMatrix4x3fv)
// GL 3.0
ANT_GL_CORE_IMPL(glColorMaski)
ANT_GL_CORE_IMPL(glGetBooleani_v)
ANT_GL_CORE_IMPL(glGetIntegeri_v)
ANT_GL_CORE_IMPL(glEnablei)
ANT_GL_CORE_IMPL(glDisablei)
ANT_GL_CORE_IMPL(glIsEnabledi)
ANT_GL_CORE_IMPL(glBeginTransformFeedback)
ANT_GL_CORE_IMPL(glEndTransformFeedback)
ANT_GL_CORE_IMPL(glBindBufferRange)
ANT_GL_CORE_IMPL(glBindBufferBase)
ANT_GL_CORE_IMPL(glTransformFeedbackVaryings)
ANT_GL_CORE_IMPL(glGetTransformFeedbackVarying)
ANT_GL_CORE_IMPL(glClampColor)
ANT_GL_CORE_IMPL(glBeginConditionalRender)
ANT_GL_CORE_IMPL(glEndConditionalRender)
ANT_GL_CORE_IMPL(glVertexAttribIPointer)
ANT_GL_CORE_IMPL(glGetVertexAttribIiv)
ANT_GL_CORE_IMPL(glGetVertexAttribIuiv)
ANT_GL_CORE_IMPL(glVertexAttribI1i)
ANT_GL_CORE_IMPL(glVertexAttribI2i)
ANT_GL_CORE_IMPL(glVertexAttribI3i)
ANT_GL_CORE_IMPL(glVertexAttribI4i)
ANT_GL_CORE_IMPL(glVertexAttribI1ui)
ANT_GL_CORE_IMPL(glVertexAttribI2ui)
ANT_GL_CORE_IMPL(glVertexAttribI3ui)
ANT_GL_CORE_IMPL(glVertexAttribI4ui)
ANT_GL_CORE_IMPL(glVertexAttribI1iv)
ANT_GL_CORE_IMPL(glVertexAttribI2iv)
ANT_GL_CORE_IMPL(glVertexAttribI3iv)
ANT_GL_CORE_IMPL(glVertexAttribI4iv)
ANT_GL_CORE_IMPL(glVertexAttribI1uiv)
ANT_GL_CORE_IMPL(glVertexAttribI2uiv)
ANT_GL_CORE_IMPL(glVertexAttribI3uiv)
ANT_GL_CORE_IMPL(glVertexAttribI4uiv)
ANT_GL_CORE_IMPL(glVertexAttribI4bv)
ANT_GL_CORE_IMPL(glVertexAttribI4sv)
ANT_GL_CORE_IMPL(glVertexAttribI4ubv)
ANT_GL_CORE_IMPL(glVertexAttribI4usv)
ANT_GL_CORE_IMPL(glGetUniformuiv)
ANT_GL_CORE_IMPL(glBindFragDataLocation)
ANT_GL_CORE_IMPL(glGetFragDataLocation)
ANT_GL_CORE_IMPL(glUniform1ui)
ANT_GL_CORE_IMPL(glUniform2ui)
ANT_GL_CORE_IMPL(glUniform3ui)
ANT_GL_CORE_IMPL(glUniform4ui)
ANT_GL_CORE_IMPL(glUniform1uiv)
ANT_GL_CORE_IMPL(glUniform2uiv)
ANT_GL_CORE_IMPL(glUniform3uiv)
ANT_GL_CORE_IMPL(glUniform4uiv)
ANT_GL_CORE_IMPL(glTexParameterIiv)
ANT_GL_CORE_IMPL(glTexParameterIuiv)
ANT_GL_CORE_IMPL(glGetTexParameterIiv)
ANT_GL_CORE_IMPL(glGetTexParameterIuiv)
ANT_GL_CORE_IMPL(glClearBufferiv)
ANT_GL_CORE_IMPL(glClearBufferuiv)
ANT_GL_CORE_IMPL(glClearBufferfv)
ANT_GL_CORE_IMPL(glClearBufferfi)
ANT_GL_CORE_IMPL(glGetStringi)
// GL 3.1
ANT_GL_CORE_IMPL(glDrawArraysInstanced)
ANT_GL_CORE_IMPL(glDrawElementsInstanced)
ANT_GL_CORE_IMPL(glTexBuffer)
ANT_GL_CORE_IMPL(glPrimitiveRestartIndex)
// GL 3.2
//ANT_GL_CORE_IMPL(glGetInteger64i_v)
//ANT_GL_CORE_IMPL(glGetBufferParameteri64v)
ANT_GL_CORE_IMPL(glFramebufferTexture)
*/
// GL_ARB_vertex_array_object
#if defined(ANT_WINDOWS)
ANT_GL_CORE_IMPL(glBindVertexArray)
ANT_GL_CORE_IMPL(glDeleteVertexArrays)
ANT_GL_CORE_IMPL(glGenVertexArrays)
ANT_GL_CORE_IMPL(glIsVertexArray)
#else
// these extensions are loaded explicitely by LoadOpenGLCore
// because they may not be avialable on non-OpenGL 3.2 environments
namespace GLCore
{
PFNglBindVertexArray _glBindVertexArray = NULL;
PFNglDeleteVertexArrays _glDeleteVertexArrays = NULL;
PFNglGenVertexArrays _glGenVertexArrays = NULL;
PFNglIsVertexArray _glIsVertexArray = NULL;
}
#endif
#if defined(ANT_WINDOWS)
ANT_GL_CORE_IMPL(wglGetProcAddress)
#endif
namespace GLCore { PFNGLGetProcAddress _glGetProcAddress = NULL; }
// ---------------------------------------------------------------------------
#if defined(ANT_WINDOWS)
// ---------------------------------------------------------------------------
int LoadOpenGLCore()
{
if( g_OGLCoreModule!=NULL )
{
return 1; // "OpenGL library already loaded"
}
g_OGLCoreModule = LoadLibrary("OPENGL32.DLL");
if( g_OGLCoreModule )
{
// Info(VERB_LOW, "Load %d OpenGL Core functions", g_NbOGLCoreFunc);
int Res = 1;
// Use wglGetProcAddress to retreive Core functions
_glGetProcAddress = reinterpret_cast<GLCore::PFNGLGetProcAddress>(GetProcAddress(g_OGLCoreModule, "wglGetProcAddress"));
if( _glGetProcAddress!=NULL )
for(int i=0; i<g_NbOGLCoreFunc; ++i)
{
assert(g_OGLCoreFuncRec[i].m_FuncPtr!=NULL);
assert(*(g_OGLCoreFuncRec[i].m_FuncPtr)==NULL);
assert(g_OGLCoreFuncRec[i].m_Name!=NULL);
assert(strlen(g_OGLCoreFuncRec[i].m_Name)>0);
// Try to get the function pointer with wglGetProcAddress
*(g_OGLCoreFuncRec[i].m_FuncPtr) = reinterpret_cast<GLCore::PFNOpenGL>(_glGetProcAddress(g_OGLCoreFuncRec[i].m_Name));
if( *(g_OGLCoreFuncRec[i].m_FuncPtr)==NULL )
{
// Try to get the function pointer with GetProcAddress
*(g_OGLCoreFuncRec[i].m_FuncPtr) = reinterpret_cast<GLCore::PFNOpenGL>(GetProcAddress(g_OGLCoreModule, g_OGLCoreFuncRec[i].m_Name));
if( *(g_OGLCoreFuncRec[i].m_FuncPtr)==NULL )
{
#ifdef _DEBUG
fprintf(stderr, "AntTweakBar: Cannot load function %s\n", g_OGLCoreFuncRec[i].m_Name);
#endif
Res = 0; // Error("cannot find OpenGL Core function");
}
}
}
return Res;
}
else
{
// InternDisplayLastErrorWIN("Cannot load opengl32 DLL", false);
return 0; // cannot load DLL
}
}
// ---------------------------------------------------------------------------
int UnloadOpenGLCore()
{
if( g_OGLCoreModule==NULL )
{
return 1; // "OpenGL library not loaded"
}
// Info(VERB_LOW, "Unload %d OpenGL Core functions", g_NbOGLCoreFunc);
for(int i=0; i<g_NbOGLCoreFunc; ++i)
{
assert(g_OGLCoreFuncRec[i].m_FuncPtr!=NULL);
assert(*(g_OGLCoreFuncRec[i].m_FuncPtr)!=NULL);
assert(g_OGLCoreFuncRec[i].m_Name!=NULL);
assert(strlen(g_OGLCoreFuncRec[i].m_Name)>0);
*(g_OGLCoreFuncRec[i].m_FuncPtr) = NULL;
}
if( FreeLibrary(g_OGLCoreModule) )
{
// Info(VERB_LOW, "OpenGL library unloaded");
g_OGLCoreModule = NULL;
return 1;
}
else
{
// InternDisplayLastErrorWIN("Cannot unload opengl32 DLL", false);
return 0; // cannot unload opengl32.dll
}
}
// ---------------------------------------------------------------------------
namespace GLCore
{
PFNOpenGL Record(const char *_FuncName, PFNOpenGL *_FuncPtr)
{
if( g_NbOGLCoreFunc>=ANT_NB_OGL_CORE_FUNC_MAX )
{
fprintf(stderr, "Too many OpenGL Core functions declared. Change ANT_NB_OGL_CORE_FUNC_MAX.");
exit(-1);
}
g_OGLCoreFuncRec[g_NbOGLCoreFunc].m_Name = _FuncName;
g_OGLCoreFuncRec[g_NbOGLCoreFunc].m_FuncPtr = _FuncPtr;
++g_NbOGLCoreFunc;
return NULL;
}
} // namespace GL
// ---------------------------------------------------------------------------
#endif // defined(ANT_WINDOWS)
// ---------------------------------------------------------------------------
#if defined(ANT_UNIX)
int LoadOpenGLCore()
{
_glGetProcAddress = reinterpret_cast<GLCore::PFNGLGetProcAddress>(glXGetProcAddressARB);
_glBindVertexArray = reinterpret_cast<PFNglBindVertexArray>(_glGetProcAddress("glBindVertexArray"));
_glDeleteVertexArrays = reinterpret_cast<PFNglDeleteVertexArrays>(_glGetProcAddress("glDeleteVertexArrays"));
_glGenVertexArrays = reinterpret_cast<PFNglGenVertexArrays>(_glGetProcAddress("glGenVertexArrays"));
_glIsVertexArray = reinterpret_cast<PFNglIsVertexArray>(_glGetProcAddress("glIsVertexArray"));
if( _glBindVertexArray==NULL || _glDeleteVertexArrays==NULL || _glGenVertexArrays==NULL || _glIsVertexArray==NULL )
{
fprintf(stderr, "AntTweakBar: OpenGL Core Profile functions cannot be loaded.\n");
return 0;
}
else
return 1;
}
int UnloadOpenGLCore()
{
return 1;
}
#elif defined(ANT_OSX)
#include <dlfcn.h>
static void *gl_dyld = NULL;
static const char *gl_prefix = "_";
void *NSGLCoreGetProcAddressNew(const GLubyte *name)
{
void *proc=NULL;
if (gl_dyld == NULL)
{
gl_dyld = dlopen("OpenGL",RTLD_LAZY);
}
if (gl_dyld)
{
NSString *sym = [[NSString alloc] initWithFormat: @"%s%s",gl_prefix,name];
proc = dlsym(gl_dyld,[sym UTF8String]);
[sym release];
}
return proc;
}
int LoadOpenGLCore()
{
_glGetProcAddress = reinterpret_cast<GLCore::PFNGLGetProcAddress>(NSGLCoreGetProcAddressNew);
_glBindVertexArray = reinterpret_cast<PFNglBindVertexArray>(_glGetProcAddress("glBindVertexArray"));
_glDeleteVertexArrays = reinterpret_cast<PFNglDeleteVertexArrays>(_glGetProcAddress("glDeleteVertexArrays"));
_glGenVertexArrays = reinterpret_cast<PFNglGenVertexArrays>(_glGetProcAddress("glGenVertexArrays"));
_glIsVertexArray = reinterpret_cast<PFNglIsVertexArray>(_glGetProcAddress("glIsVertexArray"));
if( _glBindVertexArray==NULL || _glDeleteVertexArrays==NULL || _glGenVertexArrays==NULL || _glIsVertexArray==NULL )
{
// remove the symbols underscore prefix (OSX 10.7 and later)
gl_prefix = "";
_glBindVertexArray = reinterpret_cast<PFNglBindVertexArray>(_glGetProcAddress("glBindVertexArray"));
_glDeleteVertexArrays = reinterpret_cast<PFNglDeleteVertexArrays>(_glGetProcAddress("glDeleteVertexArrays"));
_glGenVertexArrays = reinterpret_cast<PFNglGenVertexArrays>(_glGetProcAddress("glGenVertexArrays"));
_glIsVertexArray = reinterpret_cast<PFNglIsVertexArray>(_glGetProcAddress("glIsVertexArray"));
if( _glBindVertexArray==NULL || _glDeleteVertexArrays==NULL || _glGenVertexArrays==NULL || _glIsVertexArray==NULL )
{
fprintf(stderr, "AntTweakBar: OpenGL Core Profile functions cannot be loaded.\n");
return 0;
}
}
return 1;
}
int UnloadOpenGLCore()
{
if (gl_dyld)
{
dlclose(gl_dyld);
gl_dyld = NULL;
}
return 1;
}
#endif
// ---------------------------------------------------------------------------

View File

@@ -0,0 +1,403 @@
// ---------------------------------------------------------------------------
//
// @file LoadOGLCore.h
// @brief OpenGL Core Profile declarations for dynamic loading
// @author Philippe Decaudin
// @license This file is part of the AntTweakBar library.
// For conditions of distribution and use, see License.txt
//
// note: Private header
//
// ---------------------------------------------------------------------------
#if !defined ANT_LOAD_OGL_CORE_INCLUDED
#define ANT_LOAD_OGL_CORE_INCLUDED
#define ANT_GL_CORE_DECL_NO_FORWARD(_Ret, _Fct, _Params) \
extern "C" { typedef _Ret (APIENTRY* PFN##_Fct)_Params; } \
namespace GLCore { extern PFN##_Fct _##_Fct; } \
using GLCore::_##_Fct;
#if defined(ANT_WINDOWS)
# define ANT_GL_CORE_DECL(_Ret, _Fct, _Params) \
ANT_GL_CORE_DECL_NO_FORWARD(_Ret, _Fct, _Params)
# define ANT_GL_CORE_IMPL(_Fct) \
namespace GLCore { PFN##_Fct _##_Fct = (PFN##_Fct)Record(#_Fct, (PFNOpenGL*)(&_##_Fct)); }
#elif defined(ANT_UNIX) || defined(ANT_OSX)
# if !defined(APIENTRY)
# define APIENTRY
# endif
# define ANT_GL_CORE_DECL(_Ret, _Fct, _Params) \
ANT_GL_CORE_DECL_NO_FORWARD(_Ret, _Fct, _Params) \
extern "C" { _Ret APIENTRY _Fct _Params; }
# define ANT_GL_CORE_IMPL(_Fct) \
namespace GLCore { PFN##_Fct _##_Fct = _Fct; }
#endif
int LoadOpenGLCore();
int UnloadOpenGLCore();
namespace GLCore
{
extern "C" { typedef void (APIENTRY* PFNOpenGL)(); }
PFNOpenGL Record(const char *_FuncName, PFNOpenGL *_FuncPtr);
extern "C" { typedef PFNOpenGL (APIENTRY *PFNGLGetProcAddress)(const char *); }
extern PFNGLGetProcAddress _glGetProcAddress;
}
using GLCore::_glGetProcAddress;
// GL 1.0
ANT_GL_CORE_DECL(void, glCullFace, (GLenum mode))
ANT_GL_CORE_DECL(void, glFrontFace, (GLenum mode))
ANT_GL_CORE_DECL(void, glHint, (GLenum target, GLenum mode))
ANT_GL_CORE_DECL(void, glLineWidth, (GLfloat width))
ANT_GL_CORE_DECL(void, glPointSize, (GLfloat size))
ANT_GL_CORE_DECL(void, glPolygonMode, (GLenum face, GLenum mode))
ANT_GL_CORE_DECL(void, glScissor, (GLint x, GLint y, GLsizei width, GLsizei height))
ANT_GL_CORE_DECL(void, glTexParameterf, (GLenum target, GLenum pname, GLfloat param))
ANT_GL_CORE_DECL(void, glTexParameterfv, (GLenum target, GLenum pname, const GLfloat *params))
ANT_GL_CORE_DECL(void, glTexParameteri, (GLenum target, GLenum pname, GLint param))
ANT_GL_CORE_DECL(void, glTexParameteriv, (GLenum target, GLenum pname, const GLint *params))
#if defined(ANT_OSX) && (MAC_OS_X_VERSION_MAX_ALLOWED < 1070)
// Mac OSX < 10.7 redefines these OpenGL calls: glTexImage1D, glTexImage2D
ANT_GL_CORE_DECL(void, glTexImage1D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels))
ANT_GL_CORE_DECL(void, glTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels))
#else
ANT_GL_CORE_DECL(void, glTexImage1D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels))
ANT_GL_CORE_DECL(void, glTexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels))
#endif
ANT_GL_CORE_DECL(void, glDrawBuffer, (GLenum mode))
ANT_GL_CORE_DECL(void, glClear, (GLbitfield mask))
ANT_GL_CORE_DECL(void, glClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha))
ANT_GL_CORE_DECL(void, glClearStencil, (GLint s))
ANT_GL_CORE_DECL(void, glClearDepth, (GLclampd depth))
ANT_GL_CORE_DECL(void, glStencilMask, (GLuint mask))
ANT_GL_CORE_DECL(void, glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha))
ANT_GL_CORE_DECL(void, glDepthMask, (GLboolean flag))
ANT_GL_CORE_DECL(void, glDisable, (GLenum cap))
ANT_GL_CORE_DECL(void, glEnable, (GLenum cap))
ANT_GL_CORE_DECL(void, glFinish, (void))
ANT_GL_CORE_DECL(void, glFlush, (void))
ANT_GL_CORE_DECL(void, glBlendFunc, (GLenum sfactor, GLenum dfactor))
ANT_GL_CORE_DECL(void, glLogicOp, (GLenum opcode))
ANT_GL_CORE_DECL(void, glStencilFunc, (GLenum func, GLint ref, GLuint mask))
ANT_GL_CORE_DECL(void, glStencilOp, (GLenum fail, GLenum zfail, GLenum zpass))
ANT_GL_CORE_DECL(void, glDepthFunc, (GLenum func))
ANT_GL_CORE_DECL(void, glPixelStoref, (GLenum pname, GLfloat param))
ANT_GL_CORE_DECL(void, glPixelStorei, (GLenum pname, GLint param))
ANT_GL_CORE_DECL(void, glReadBuffer, (GLenum mode))
ANT_GL_CORE_DECL(void, glReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels))
ANT_GL_CORE_DECL(void, glGetBooleanv, (GLenum pname, GLboolean *params))
ANT_GL_CORE_DECL(void, glGetDoublev, (GLenum pname, GLdouble *params))
ANT_GL_CORE_DECL(GLenum, glGetError, (void))
ANT_GL_CORE_DECL(void, glGetFloatv, (GLenum pname, GLfloat *params))
ANT_GL_CORE_DECL(void, glGetIntegerv, (GLenum pname, GLint *params))
ANT_GL_CORE_DECL(const GLubyte *, glGetString, (GLenum name))
ANT_GL_CORE_DECL(void, glGetTexImage, (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels))
ANT_GL_CORE_DECL(void, glGetTexParameterfv, (GLenum target, GLenum pname, GLfloat *params))
ANT_GL_CORE_DECL(void, glGetTexParameteriv, (GLenum target, GLenum pname, GLint *params))
ANT_GL_CORE_DECL(void, glGetTexLevelParameterfv, (GLenum target, GLint level, GLenum pname, GLfloat *params))
ANT_GL_CORE_DECL(void, glGetTexLevelParameteriv, (GLenum target, GLint level, GLenum pname, GLint *params))
ANT_GL_CORE_DECL(GLboolean, glIsEnabled, (GLenum cap))
ANT_GL_CORE_DECL(void, glDepthRange, (GLclampd near, GLclampd far))
ANT_GL_CORE_DECL(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height))
// GL 1.1
ANT_GL_CORE_DECL(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count))
ANT_GL_CORE_DECL(void, glDrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices))
ANT_GL_CORE_DECL(void, glGetPointerv, (GLenum pname, GLvoid* *params))
ANT_GL_CORE_DECL(void, glPolygonOffset, (GLfloat factor, GLfloat units))
ANT_GL_CORE_DECL(void, glCopyTexImage1D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border))
ANT_GL_CORE_DECL(void, glCopyTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border))
ANT_GL_CORE_DECL(void, glCopyTexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width))
ANT_GL_CORE_DECL(void, glCopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height))
ANT_GL_CORE_DECL(void, glTexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels))
ANT_GL_CORE_DECL(void, glTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels))
ANT_GL_CORE_DECL(void, glBindTexture, (GLenum target, GLuint texture))
ANT_GL_CORE_DECL(void, glDeleteTextures, (GLsizei n, const GLuint *textures))
ANT_GL_CORE_DECL(void, glGenTextures, (GLsizei n, GLuint *textures))
ANT_GL_CORE_DECL(GLboolean, glIsTexture, (GLuint texture))
// GL 1.2
ANT_GL_CORE_DECL(void, glBlendColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha))
ANT_GL_CORE_DECL(void, glBlendEquation, (GLenum mode))
ANT_GL_CORE_DECL(void, glDrawRangeElements, (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices))
#if defined(ANT_OSX) && (MAC_OS_X_VERSION_MAX_ALLOWED < 1070)
// Mac OSX < 10.7 redefines this OpenGL call: glTexImage3D
ANT_GL_CORE_DECL(void, glTexImage3D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels))
#else
ANT_GL_CORE_DECL(void, glTexImage3D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels))
#endif
ANT_GL_CORE_DECL(void, glTexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels))
ANT_GL_CORE_DECL(void, glCopyTexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height))
// GL 1.3
ANT_GL_CORE_DECL(void, glActiveTexture, (GLenum texture))
ANT_GL_CORE_DECL(void, glSampleCoverage, (GLclampf value, GLboolean invert))
ANT_GL_CORE_DECL(void, glCompressedTexImage3D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data))
ANT_GL_CORE_DECL(void, glCompressedTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data))
ANT_GL_CORE_DECL(void, glCompressedTexImage1D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data))
ANT_GL_CORE_DECL(void, glCompressedTexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data))
ANT_GL_CORE_DECL(void, glCompressedTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data))
ANT_GL_CORE_DECL(void, glCompressedTexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data))
ANT_GL_CORE_DECL(void, glGetCompressedTexImage, (GLenum target, GLint level, GLvoid *img))
// GL 1.4
ANT_GL_CORE_DECL(void, glBlendFuncSeparate, (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha))
ANT_GL_CORE_DECL(void, glMultiDrawArrays, (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount))
ANT_GL_CORE_DECL(void, glMultiDrawElements, (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount))
ANT_GL_CORE_DECL(void, glPointParameterf, (GLenum pname, GLfloat param))
ANT_GL_CORE_DECL(void, glPointParameterfv, (GLenum pname, const GLfloat *params))
ANT_GL_CORE_DECL(void, glPointParameteri, (GLenum pname, GLint param))
ANT_GL_CORE_DECL(void, glPointParameteriv, (GLenum pname, const GLint *params))
// GL 1.5
#ifndef ANT_OSX
typedef ptrdiff_t GLintptr;
typedef ptrdiff_t GLsizeiptr;
#endif
ANT_GL_CORE_DECL(void, glGenQueries, (GLsizei n, GLuint *ids))
ANT_GL_CORE_DECL(void, glDeleteQueries, (GLsizei n, const GLuint *ids))
ANT_GL_CORE_DECL(GLboolean, glIsQuery, (GLuint id))
ANT_GL_CORE_DECL(void, glBeginQuery, (GLenum target, GLuint id))
ANT_GL_CORE_DECL(void, glEndQuery, (GLenum target))
ANT_GL_CORE_DECL(void, glGetQueryiv, (GLenum target, GLenum pname, GLint *params))
ANT_GL_CORE_DECL(void, glGetQueryObjectiv, (GLuint id, GLenum pname, GLint *params))
ANT_GL_CORE_DECL(void, glGetQueryObjectuiv, (GLuint id, GLenum pname, GLuint *params))
ANT_GL_CORE_DECL(void, glBindBuffer, (GLenum target, GLuint buffer))
ANT_GL_CORE_DECL(void, glDeleteBuffers, (GLsizei n, const GLuint *buffers))
ANT_GL_CORE_DECL(void, glGenBuffers, (GLsizei n, GLuint *buffers))
ANT_GL_CORE_DECL(GLboolean, glIsBuffer, (GLuint buffer))
ANT_GL_CORE_DECL(void, glBufferData, (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage))
ANT_GL_CORE_DECL(void, glBufferSubData, (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data))
ANT_GL_CORE_DECL(void, glGetBufferSubData, (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data))
ANT_GL_CORE_DECL(GLvoid*, glMapBuffer, (GLenum target, GLenum access))
ANT_GL_CORE_DECL(GLboolean, glUnmapBuffer, (GLenum target))
ANT_GL_CORE_DECL(void, glGetBufferParameteriv, (GLenum target, GLenum pname, GLint *params))
ANT_GL_CORE_DECL(void, glGetBufferPointerv, (GLenum target, GLenum pname, GLvoid* *params))
// GL 2.0
typedef char GLchar;
ANT_GL_CORE_DECL(void, glBlendEquationSeparate, (GLenum modeRGB, GLenum modeAlpha))
ANT_GL_CORE_DECL(void, glDrawBuffers, (GLsizei n, const GLenum *bufs))
ANT_GL_CORE_DECL(void, glStencilOpSeparate, (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass))
ANT_GL_CORE_DECL(void, glStencilFuncSeparate, (GLenum face, GLenum func, GLint ref, GLuint mask))
ANT_GL_CORE_DECL(void, glStencilMaskSeparate, (GLenum face, GLuint mask))
ANT_GL_CORE_DECL(void, glAttachShader, (GLuint program, GLuint shader))
ANT_GL_CORE_DECL(void, glBindAttribLocation, (GLuint program, GLuint index, const GLchar *name))
ANT_GL_CORE_DECL(void, glCompileShader, (GLuint shader))
ANT_GL_CORE_DECL(GLuint, glCreateProgram, (void))
ANT_GL_CORE_DECL(GLuint, glCreateShader, (GLenum type))
ANT_GL_CORE_DECL(void, glDeleteProgram, (GLuint program))
ANT_GL_CORE_DECL(void, glDeleteShader, (GLuint shader))
ANT_GL_CORE_DECL(void, glDetachShader, (GLuint program, GLuint shader))
ANT_GL_CORE_DECL(void, glDisableVertexAttribArray, (GLuint index))
ANT_GL_CORE_DECL(void, glEnableVertexAttribArray, (GLuint index))
ANT_GL_CORE_DECL(void, glGetActiveAttrib, (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name))
ANT_GL_CORE_DECL(void, glGetActiveUniform, (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name))
ANT_GL_CORE_DECL(void, glGetAttachedShaders, (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj))
ANT_GL_CORE_DECL(GLint, glGetAttribLocation, (GLuint program, const GLchar *name))
ANT_GL_CORE_DECL(void, glGetProgramiv, (GLuint program, GLenum pname, GLint *params))
ANT_GL_CORE_DECL(void, glGetProgramInfoLog, (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog))
ANT_GL_CORE_DECL(void, glGetShaderiv, (GLuint shader, GLenum pname, GLint *params))
ANT_GL_CORE_DECL(void, glGetShaderInfoLog, (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog))
ANT_GL_CORE_DECL(void, glGetShaderSource, (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source))
ANT_GL_CORE_DECL(GLint, glGetUniformLocation, (GLuint program, const GLchar *name))
ANT_GL_CORE_DECL(void, glGetUniformfv, (GLuint program, GLint location, GLfloat *params))
ANT_GL_CORE_DECL(void, glGetUniformiv, (GLuint program, GLint location, GLint *params))
ANT_GL_CORE_DECL(void, glGetVertexAttribdv, (GLuint index, GLenum pname, GLdouble *params))
ANT_GL_CORE_DECL(void, glGetVertexAttribfv, (GLuint index, GLenum pname, GLfloat *params))
ANT_GL_CORE_DECL(void, glGetVertexAttribiv, (GLuint index, GLenum pname, GLint *params))
ANT_GL_CORE_DECL(void, glGetVertexAttribPointerv, (GLuint index, GLenum pname, GLvoid* *pointer))
ANT_GL_CORE_DECL(GLboolean, glIsProgram, (GLuint program))
ANT_GL_CORE_DECL(GLboolean, glIsShader, (GLuint shader))
ANT_GL_CORE_DECL(void, glLinkProgram, (GLuint program))
ANT_GL_CORE_DECL(void, glShaderSource, (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length))
ANT_GL_CORE_DECL(void, glUseProgram, (GLuint program))
ANT_GL_CORE_DECL(void, glUniform1f, (GLint location, GLfloat v0))
ANT_GL_CORE_DECL(void, glUniform2f, (GLint location, GLfloat v0, GLfloat v1))
ANT_GL_CORE_DECL(void, glUniform3f, (GLint location, GLfloat v0, GLfloat v1, GLfloat v2))
ANT_GL_CORE_DECL(void, glUniform4f, (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3))
ANT_GL_CORE_DECL(void, glUniform1i, (GLint location, GLint v0))
ANT_GL_CORE_DECL(void, glUniform2i, (GLint location, GLint v0, GLint v1))
ANT_GL_CORE_DECL(void, glUniform3i, (GLint location, GLint v0, GLint v1, GLint v2))
ANT_GL_CORE_DECL(void, glUniform4i, (GLint location, GLint v0, GLint v1, GLint v2, GLint v3))
ANT_GL_CORE_DECL(void, glUniform1fv, (GLint location, GLsizei count, const GLfloat *value))
ANT_GL_CORE_DECL(void, glUniform2fv, (GLint location, GLsizei count, const GLfloat *value))
ANT_GL_CORE_DECL(void, glUniform3fv, (GLint location, GLsizei count, const GLfloat *value))
ANT_GL_CORE_DECL(void, glUniform4fv, (GLint location, GLsizei count, const GLfloat *value))
ANT_GL_CORE_DECL(void, glUniform1iv, (GLint location, GLsizei count, const GLint *value))
ANT_GL_CORE_DECL(void, glUniform2iv, (GLint location, GLsizei count, const GLint *value))
ANT_GL_CORE_DECL(void, glUniform3iv, (GLint location, GLsizei count, const GLint *value))
ANT_GL_CORE_DECL(void, glUniform4iv, (GLint location, GLsizei count, const GLint *value))
ANT_GL_CORE_DECL(void, glUniformMatrix2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
ANT_GL_CORE_DECL(void, glUniformMatrix3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
ANT_GL_CORE_DECL(void, glUniformMatrix4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
ANT_GL_CORE_DECL(void, glValidateProgram, (GLuint program))
ANT_GL_CORE_DECL(void, glVertexAttrib1d, (GLuint index, GLdouble x))
ANT_GL_CORE_DECL(void, glVertexAttrib1dv, (GLuint index, const GLdouble *v))
ANT_GL_CORE_DECL(void, glVertexAttrib1f, (GLuint index, GLfloat x))
ANT_GL_CORE_DECL(void, glVertexAttrib1fv, (GLuint index, const GLfloat *v))
ANT_GL_CORE_DECL(void, glVertexAttrib1s, (GLuint index, GLshort x))
ANT_GL_CORE_DECL(void, glVertexAttrib1sv, (GLuint index, const GLshort *v))
ANT_GL_CORE_DECL(void, glVertexAttrib2d, (GLuint index, GLdouble x, GLdouble y))
ANT_GL_CORE_DECL(void, glVertexAttrib2dv, (GLuint index, const GLdouble *v))
ANT_GL_CORE_DECL(void, glVertexAttrib2f, (GLuint index, GLfloat x, GLfloat y))
ANT_GL_CORE_DECL(void, glVertexAttrib2fv, (GLuint index, const GLfloat *v))
ANT_GL_CORE_DECL(void, glVertexAttrib2s, (GLuint index, GLshort x, GLshort y))
ANT_GL_CORE_DECL(void, glVertexAttrib2sv, (GLuint index, const GLshort *v))
ANT_GL_CORE_DECL(void, glVertexAttrib3d, (GLuint index, GLdouble x, GLdouble y, GLdouble z))
ANT_GL_CORE_DECL(void, glVertexAttrib3dv, (GLuint index, const GLdouble *v))
ANT_GL_CORE_DECL(void, glVertexAttrib3f, (GLuint index, GLfloat x, GLfloat y, GLfloat z))
ANT_GL_CORE_DECL(void, glVertexAttrib3fv, (GLuint index, const GLfloat *v))
ANT_GL_CORE_DECL(void, glVertexAttrib3s, (GLuint index, GLshort x, GLshort y, GLshort z))
ANT_GL_CORE_DECL(void, glVertexAttrib3sv, (GLuint index, const GLshort *v))
ANT_GL_CORE_DECL(void, glVertexAttrib4Nbv, (GLuint index, const GLbyte *v))
ANT_GL_CORE_DECL(void, glVertexAttrib4Niv, (GLuint index, const GLint *v))
ANT_GL_CORE_DECL(void, glVertexAttrib4Nsv, (GLuint index, const GLshort *v))
ANT_GL_CORE_DECL(void, glVertexAttrib4Nub, (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w))
ANT_GL_CORE_DECL(void, glVertexAttrib4Nubv, (GLuint index, const GLubyte *v))
ANT_GL_CORE_DECL(void, glVertexAttrib4Nuiv, (GLuint index, const GLuint *v))
ANT_GL_CORE_DECL(void, glVertexAttrib4Nusv, (GLuint index, const GLushort *v))
ANT_GL_CORE_DECL(void, glVertexAttrib4bv, (GLuint index, const GLbyte *v))
ANT_GL_CORE_DECL(void, glVertexAttrib4d, (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w))
ANT_GL_CORE_DECL(void, glVertexAttrib4dv, (GLuint index, const GLdouble *v))
ANT_GL_CORE_DECL(void, glVertexAttrib4f, (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w))
ANT_GL_CORE_DECL(void, glVertexAttrib4fv, (GLuint index, const GLfloat *v))
ANT_GL_CORE_DECL(void, glVertexAttrib4iv, (GLuint index, const GLint *v))
ANT_GL_CORE_DECL(void, glVertexAttrib4s, (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w))
ANT_GL_CORE_DECL(void, glVertexAttrib4sv, (GLuint index, const GLshort *v))
ANT_GL_CORE_DECL(void, glVertexAttrib4ubv, (GLuint index, const GLubyte *v))
ANT_GL_CORE_DECL(void, glVertexAttrib4uiv, (GLuint index, const GLuint *v))
ANT_GL_CORE_DECL(void, glVertexAttrib4usv, (GLuint index, const GLushort *v))
ANT_GL_CORE_DECL(void, glVertexAttribPointer, (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer))
/*
// GL 2.1
ANT_GL_CORE_DECL(void, glUniformMatrix2x3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
ANT_GL_CORE_DECL(void, glUniformMatrix3x2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
ANT_GL_CORE_DECL(void, glUniformMatrix2x4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
ANT_GL_CORE_DECL(void, glUniformMatrix4x2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
ANT_GL_CORE_DECL(void, glUniformMatrix3x4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
ANT_GL_CORE_DECL(void, glUniformMatrix4x3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
// GL 3.0
ANT_GL_CORE_DECL(void, glColorMaski, (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a))
ANT_GL_CORE_DECL(void, glGetBooleani_v, (GLenum target, GLuint index, GLboolean *data))
ANT_GL_CORE_DECL(void, glGetIntegeri_v, (GLenum target, GLuint index, GLint *data))
ANT_GL_CORE_DECL(void, glEnablei, (GLenum target, GLuint index))
ANT_GL_CORE_DECL(void, glDisablei, (GLenum target, GLuint index))
ANT_GL_CORE_DECL(GLboolean, glIsEnabledi, (GLenum target, GLuint index))
ANT_GL_CORE_DECL(void, glBeginTransformFeedback, (GLenum primitiveMode))
ANT_GL_CORE_DECL(void, glEndTransformFeedback, (void))
ANT_GL_CORE_DECL(void, glBindBufferRange, (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size))
ANT_GL_CORE_DECL(void, glBindBufferBase, (GLenum target, GLuint index, GLuint buffer))
ANT_GL_CORE_DECL(void, glTransformFeedbackVaryings, (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode))
ANT_GL_CORE_DECL(void, glGetTransformFeedbackVarying, (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name))
ANT_GL_CORE_DECL(void, glClampColor, (GLenum target, GLenum clamp))
ANT_GL_CORE_DECL(void, glBeginConditionalRender, (GLuint id, GLenum mode))
ANT_GL_CORE_DECL(void, glEndConditionalRender, (void))
ANT_GL_CORE_DECL(void, glVertexAttribIPointer, (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer))
ANT_GL_CORE_DECL(void, glGetVertexAttribIiv, (GLuint index, GLenum pname, GLint *params))
ANT_GL_CORE_DECL(void, glGetVertexAttribIuiv, (GLuint index, GLenum pname, GLuint *params))
ANT_GL_CORE_DECL(void, glVertexAttribI1i, (GLuint index, GLint x))
ANT_GL_CORE_DECL(void, glVertexAttribI2i, (GLuint index, GLint x, GLint y))
ANT_GL_CORE_DECL(void, glVertexAttribI3i, (GLuint index, GLint x, GLint y, GLint z))
ANT_GL_CORE_DECL(void, glVertexAttribI4i, (GLuint index, GLint x, GLint y, GLint z, GLint w))
ANT_GL_CORE_DECL(void, glVertexAttribI1ui, (GLuint index, GLuint x))
ANT_GL_CORE_DECL(void, glVertexAttribI2ui, (GLuint index, GLuint x, GLuint y))
ANT_GL_CORE_DECL(void, glVertexAttribI3ui, (GLuint index, GLuint x, GLuint y, GLuint z))
ANT_GL_CORE_DECL(void, glVertexAttribI4ui, (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w))
ANT_GL_CORE_DECL(void, glVertexAttribI1iv, (GLuint index, const GLint *v))
ANT_GL_CORE_DECL(void, glVertexAttribI2iv, (GLuint index, const GLint *v))
ANT_GL_CORE_DECL(void, glVertexAttribI3iv, (GLuint index, const GLint *v))
ANT_GL_CORE_DECL(void, glVertexAttribI4iv, (GLuint index, const GLint *v))
ANT_GL_CORE_DECL(void, glVertexAttribI1uiv, (GLuint index, const GLuint *v))
ANT_GL_CORE_DECL(void, glVertexAttribI2uiv, (GLuint index, const GLuint *v))
ANT_GL_CORE_DECL(void, glVertexAttribI3uiv, (GLuint index, const GLuint *v))
ANT_GL_CORE_DECL(void, glVertexAttribI4uiv, (GLuint index, const GLuint *v))
ANT_GL_CORE_DECL(void, glVertexAttribI4bv, (GLuint index, const GLbyte *v))
ANT_GL_CORE_DECL(void, glVertexAttribI4sv, (GLuint index, const GLshort *v))
ANT_GL_CORE_DECL(void, glVertexAttribI4ubv, (GLuint index, const GLubyte *v))
ANT_GL_CORE_DECL(void, glVertexAttribI4usv, (GLuint index, const GLushort *v))
ANT_GL_CORE_DECL(void, glGetUniformuiv, (GLuint program, GLint location, GLuint *params))
ANT_GL_CORE_DECL(void, glBindFragDataLocation, (GLuint program, GLuint color, const GLchar *name))
ANT_GL_CORE_DECL(GLint, glGetFragDataLocation, (GLuint program, const GLchar *name))
ANT_GL_CORE_DECL(void, glUniform1ui, (GLint location, GLuint v0))
ANT_GL_CORE_DECL(void, glUniform2ui, (GLint location, GLuint v0, GLuint v1))
ANT_GL_CORE_DECL(void, glUniform3ui, (GLint location, GLuint v0, GLuint v1, GLuint v2))
ANT_GL_CORE_DECL(void, glUniform4ui, (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3))
ANT_GL_CORE_DECL(void, glUniform1uiv, (GLint location, GLsizei count, const GLuint *value))
ANT_GL_CORE_DECL(void, glUniform2uiv, (GLint location, GLsizei count, const GLuint *value))
ANT_GL_CORE_DECL(void, glUniform3uiv, (GLint location, GLsizei count, const GLuint *value))
ANT_GL_CORE_DECL(void, glUniform4uiv, (GLint location, GLsizei count, const GLuint *value))
ANT_GL_CORE_DECL(void, glTexParameterIiv, (GLenum target, GLenum pname, const GLint *params))
ANT_GL_CORE_DECL(void, glTexParameterIuiv, (GLenum target, GLenum pname, const GLuint *params))
ANT_GL_CORE_DECL(void, glGetTexParameterIiv, (GLenum target, GLenum pname, GLint *params))
ANT_GL_CORE_DECL(void, glGetTexParameterIuiv, (GLenum target, GLenum pname, GLuint *params))
ANT_GL_CORE_DECL(void, glClearBufferiv, (GLenum buffer, GLint drawbuffer, const GLint *value))
ANT_GL_CORE_DECL(void, glClearBufferuiv, (GLenum buffer, GLint drawbuffer, const GLuint *value))
ANT_GL_CORE_DECL(void, glClearBufferfv, (GLenum buffer, GLint drawbuffer, const GLfloat *value))
ANT_GL_CORE_DECL(void, glClearBufferfi, (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil))
ANT_GL_CORE_DECL(const GLubyte *, glGetStringi, (GLenum name, GLuint index))
// GL 3.1
ANT_GL_CORE_DECL(void, glDrawArraysInstanced, (GLenum mode, GLint first, GLsizei count, GLsizei primcount))
ANT_GL_CORE_DECL(void, glDrawElementsInstanced, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount))
ANT_GL_CORE_DECL(void, glTexBuffer, (GLenum target, GLenum internalformat, GLuint buffer))
ANT_GL_CORE_DECL(void, glPrimitiveRestartIndex, (GLuint index))
// GL 3.2
//typedef int64_t GLint64;
//ANT_GL_CORE_DECL(void, glGetInteger64i_v, (GLenum target, GLuint index, GLint64 *data))
//ANT_GL_CORE_DECL(void, glGetBufferParameteri64v, (GLenum target, GLenum pname, GLint64 *params))
ANT_GL_CORE_DECL(void, glFramebufferTexture, (GLenum target, GLenum attachment, GLuint texture, GLint level))
*/
// GL_ARB_vertex_array_object
ANT_GL_CORE_DECL_NO_FORWARD(void, glBindVertexArray, (GLuint array))
ANT_GL_CORE_DECL_NO_FORWARD(void, glDeleteVertexArrays, (GLsizei n, const GLuint *arrays))
ANT_GL_CORE_DECL_NO_FORWARD(void, glGenVertexArrays, (GLsizei n, GLuint *arrays))
ANT_GL_CORE_DECL_NO_FORWARD(GLboolean, glIsVertexArray, (GLuint array))
#ifdef ANT_WINDOWS
ANT_GL_CORE_DECL(PROC, wglGetProcAddress, (LPCSTR))
#endif
#ifndef GL_CLAMP_TO_EDGE
# define GL_CLAMP_TO_EDGE 0x812F
#endif
#ifndef GL_COMPILE_STATUS
# define GL_COMPILE_STATUS 0x8B81
#endif
#ifndef GL_INFO_LOG_LENGTH
# define GL_INFO_LOG_LENGTH 0x8B84
#endif
#ifndef GL_LINK_STATUS
# define GL_LINK_STATUS 0x8B82
#endif
#ifndef GL_ARRAY_BUFFER
# define GL_ARRAY_BUFFER 0x8892
#endif
#ifndef GL_DYNAMIC_DRAW
# define GL_DYNAMIC_DRAW 0x88E8
#endif
#ifndef GL_VERTEX_SHADER
# define GL_VERTEX_SHADER 0x8B31
#endif
#ifndef GL_FRAGMENT_SHADER
# define GL_FRAGMENT_SHADER 0x8B30
#endif
#ifndef GL_VERTEX_ARRAY_BINDING
# define GL_VERTEX_ARRAY_BINDING 0x85B5
#endif
#ifndef GL_CURRENT_PROGRAM
# define GL_CURRENT_PROGRAM 0x8B8D
#endif
#ifndef GL_ACTIVE_TEXTURE
# define GL_ACTIVE_TEXTURE 0x84E0
#endif
#ifndef GL_TEXTURE0
# define GL_TEXTURE0 0x84C0
#endif
#ifndef GL_BGRA
# define GL_BGRA 0x80E1
#endif
#endif // !defined ANT_LOAD_OGL_CORE_INCLUDED

102
AntTweakBar/src/Makefile Normal file
View File

@@ -0,0 +1,102 @@
####### Compiler, tools and options
#---- LINUX
SO_EXT = .so
SO_VERSION = 1
AR_EXT = .a
#---- Release
CXXCFG = -O3
LFLAGS =
OUT_DIR = ../lib
#---- Debug
#CXXCFG = -g -D_DEBUG
#LFLAGS =
#OUT_DIR = ../lib/debug
CXX = gcc
CXXFLAGS = $(CXXCFG) -Wall -fPIC -fno-strict-aliasing -D_UNIX -D__PLACEMENT_NEW_INLINE
INCPATH = -I../include -I/usr/local/include -I/usr/X11R6/include -I/usr/include
LINK = gcc
#LIBS = -L/usr/X11R6/lib -L. -lglfw -lGL -lGLU -lX11 -lXxf86vm -lXext -lpthread -lm
#LIBS = -L/usr/X11R6/lib -lGL -lX11 -lXxf86vm -lXext -lpthread -lm
LIBS =
AR = ar cqs
RANLIB =
TAR = tar -cf
GZIP = gzip -9f
COPY = cp -f
COPY_FILE = $(COPY) -p
COPY_DIR = $(COPY) -pR
DEL_FILE = rm -f
SYMLINK = ln -sf
DEL_DIR = rmdir
MOVE = mv
NO_STDERR = 2> /dev/null
####### Files
# name of the application:
TARGET = AntTweakBar
# source files without extension:
SRC_FILES = TwColors.cpp TwFonts.cpp TwOpenGL.cpp TwOpenGLCore.cpp TwBar.cpp TwMgr.cpp TwPrecomp.cpp LoadOGL.cpp LoadOGLCore.cpp TwEventGLFW.c TwEventGLUT.c TwEventSDL.c TwEventSDL12.c TwEventSDL13.c TwEventSFML.cpp TwEventX11.c
# build object list from source files
OBJS_1 = $(SRC_FILES:.c=.o)
OBJS = $(OBJS_1:.cpp=.o)
####### Build rules
#first: depend all
first: all
all: Makefile $(TARGET)
# append dependencies to this Makefile
#depend:
# @echo "==== Make dependencies ====="
# makedepend -Y
# makedepend -a -Y -- $(CXXFLAGS) $(INCPATH) -- $(SRC_FILES) $(NO_STDERR)
$(TARGET): $(OBJS)
@echo "===== Link $@ ====="
$(LINK) $(LFLAGS) -shared -Wl,-soname,lib$(TARGET)$(SO_EXT).$(SO_VERSION) -o $(OUT_DIR)/lib$(TARGET)$(SO_EXT) $(OBJS) $(LIBS)
$(SYMLINK) $(OUT_DIR)/lib$(TARGET)$(SO_EXT) $(OUT_DIR)/lib$(TARGET)$(SO_EXT).$(SO_VERSION)
$(AR) $(OUT_DIR)/lib$(TARGET)$(AR_EXT) $(OBJS) $(LIBS)
.cpp.o:
@echo "===== Compile $< ====="
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.c.o:
@echo "===== Compile $< ====="
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
clean:
@echo "===== Clean ====="
-$(DEL_FILE) *.o
-$(DEL_FILE) *~ core *.core *.stackdump
####### DEPENDENCIES
TwColors.o: TwPrecomp.h TwColors.h
TwFonts.o: TwPrecomp.h ../include/AntTweakBar.h TwFonts.h TwMgr.h TwColors.h TwGraph.h AntPerfTimer.h
TwOpenGL.o: TwPrecomp.h ../include/AntTweakBar.h TwOpenGL.h LoadOGL.h TwGraph.h TwColors.h TwFonts.h TwMgr.h AntPerfTimer.h
TwOpenGLCore.o: TwPrecomp.h ../include/AntTweakBar.h TwOpenGLCore.h LoadOGLCore.h TwGraph.h TwColors.h TwFonts.h TwMgr.h AntPerfTimer.h
TwBar.o: TwPrecomp.h ../include/AntTweakBar.h TwBar.h TwMgr.h TwColors.h TwFonts.h TwGraph.h AntPerfTimer.h
TwMgr.o: TwPrecomp.h ../include/AntTweakBar.h TwMgr.h TwColors.h TwFonts.h TwGraph.h AntPerfTimer.h TwBar.h TwOpenGL.h res/TwXCursors.h
TwPrecomp.o: TwPrecomp.h
LoadOGL.o: TwPrecomp.h LoadOGL.h
TwEventGLFW.o: ../include/AntTweakBar.h MiniGLFW.h
TwEventGLUT.o: ../include/AntTweakBar.h MiniGLUT.h
TwEventSDL.o: ../include/AntTweakBar.h
TwEventSDL12.o: ../include/AntTweakBar.h MiniSDL12.h
TwEventSDL13.o: ../include/AntTweakBar.h MiniSDL13.h
TwEventX11.o: ../include/AntTweakBar.h

View File

@@ -0,0 +1,97 @@
####### Compiler, tools and options
SO_EXT = .dylib
AR_EXT = .a
#---- Release
CXXCFG = -O3
LFLAGS =
OUT_DIR = ../lib
#---- Debug
#CXXCFG = -g -D_DEBUG
#LFLAGS =
#OUT_DIR = ../lib/debug
#BASE = /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks
CXX = g++
CXXFLAGS = $(CXXCFG) -Wall -fPIC -fno-strict-aliasing -D_MACOSX -ObjC++ -D__PLACEMENT_NEW_INLINE
INCPATH = -I../include -I/usr/local/include -I/usr/X11R6/include -I/usr/include
#-I$(BASE)/OpenGL.framework/Headers/ -I$(BASE)/GLUT.framework/Headers/ -I$(BASE)/AppKit.framework/Headers/
LINK = g++
LIBS = -framework OpenGL -framework GLUT -framework AppKit
AR = ar cqs
RANLIB =
TAR = tar -cf
GZIP = gzip -9f
COPY = cp -f
COPY_FILE = $(COPY) -p
COPY_DIR = $(COPY) -pR
DEL_FILE = rm -f
SYMLINK = ln -sf
DEL_DIR = rmdir
MOVE = mv
NO_STDERR = 2> /dev/null
####### Files
# name of the application:
TARGET = AntTweakBar
# source files without extension:
SRC_FILES = TwColors.cpp TwFonts.cpp TwOpenGL.cpp TwOpenGLCore.cpp TwBar.cpp TwMgr.cpp LoadOGL.cpp LoadOGLCore.cpp TwEventGLFW.c TwEventGLUT.c TwEventSDL.c TwEventSDL12.c TwEventSDL13.c TwEventSFML.cpp
# build object list from source files
OBJS_1 = $(SRC_FILES:.c=.o)
OBJS = $(OBJS_1:.cpp=.o)
####### Build rules
#first: depend all
first: all
all: Makefile $(TARGET)
# append dependencies to this Makefile
#depend:
# @echo "==== Make dependencies ====="
# makedepend -Y
# makedepend -a -Y -- $(CXXFLAGS) $(INCPATH) -- $(SRC_FILES) $(NO_STDERR)
$(TARGET): $(OBJS)
@echo "===== Link $@ ====="
$(LINK) $(LFLAGS) -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -o $(OUT_DIR)/lib$(TARGET)$(SO_EXT) $(OBJS) $(LIBS)
$(AR) $(OUT_DIR)/lib$(TARGET)$(AR_EXT) $(OBJS)
.cpp.o:
@echo "===== Compile $< ====="
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.c.o:
@echo "===== Compile $< ====="
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
clean:
@echo "===== Clean ====="
-$(DEL_FILE) *.o
-$(DEL_FILE) *~ core *.core *.stackdump
####### DEPENDENCIES
TwColors.o: TwPrecomp.h TwColors.h
TwFonts.o: TwPrecomp.h ../include/AntTweakBar.h TwFonts.h TwMgr.h TwColors.h TwGraph.h AntPerfTimer.h
TwOpenGL.o: TwPrecomp.h ../include/AntTweakBar.h TwOpenGL.h LoadOGL.h TwGraph.h TwColors.h TwFonts.h TwMgr.h AntPerfTimer.h
TwOpenGLCore.o: TwPrecomp.h ../include/AntTweakBar.h TwOpenGLCore.h LoadOGLCore.h TwGraph.h TwColors.h TwFonts.h TwMgr.h AntPerfTimer.h
TwBar.o: TwPrecomp.h ../include/AntTweakBar.h TwBar.h TwMgr.h TwColors.h TwFonts.h TwGraph.h AntPerfTimer.h
TwMgr.o: TwPrecomp.h ../include/AntTweakBar.h TwMgr.h TwColors.h TwFonts.h TwGraph.h AntPerfTimer.h TwBar.h TwOpenGL.h res/TwXCursors.h
TwPrecomp.o: TwPrecomp.h
LoadOGL.o: TwPrecomp.h LoadOGL.h
TwEventGLFW.o: ../include/AntTweakBar.h MiniGLFW.h
TwEventGLUT.o: ../include/AntTweakBar.h MiniGLUT.h
TwEventSDL.o: ../include/AntTweakBar.h
TwEventSDL12.o: ../include/AntTweakBar.h MiniSDL12.h
TwEventSDL13.o: ../include/AntTweakBar.h MiniSDL13.h

109
AntTweakBar/src/MiniGLFW.h Normal file
View File

@@ -0,0 +1,109 @@
// ---------------------------------------------------------------------------
//
// @file MiniGLFW.h
// @brief A subset of GLFW definitions needed to compile helper functions
// implemented in TwEventGLFW.c
//
// notes: - Private header
// - AntTweakBar.dll does not need to link with GLFW,
// it just needs some definitions for its helper functions.
// - This header is provided to avoid the need of having GLFW
// installed to recompile AntTweakBar.
// - Do not use this header in your own programs, better use the
// glfw.h header from the actual GLFW library SDK :
// http://www.glfw.org
//
// ---------------------------------------------------------------------------
#if !defined MINI_GLFW_INCLUDED
#define MINI_GLFW_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
// Key and button state/action definitions
#define GLFW_RELEASE 0
#define GLFW_PRESS 1
// Keyboard key definitions
#define GLFW_KEY_UNKNOWN -1
#define GLFW_KEY_SPACE 32
#define GLFW_KEY_SPECIAL 256
#define GLFW_KEY_ESC (GLFW_KEY_SPECIAL+1)
#define GLFW_KEY_F1 (GLFW_KEY_SPECIAL+2)
#define GLFW_KEY_F2 (GLFW_KEY_SPECIAL+3)
#define GLFW_KEY_F3 (GLFW_KEY_SPECIAL+4)
#define GLFW_KEY_F4 (GLFW_KEY_SPECIAL+5)
#define GLFW_KEY_F5 (GLFW_KEY_SPECIAL+6)
#define GLFW_KEY_F6 (GLFW_KEY_SPECIAL+7)
#define GLFW_KEY_F7 (GLFW_KEY_SPECIAL+8)
#define GLFW_KEY_F8 (GLFW_KEY_SPECIAL+9)
#define GLFW_KEY_F9 (GLFW_KEY_SPECIAL+10)
#define GLFW_KEY_F10 (GLFW_KEY_SPECIAL+11)
#define GLFW_KEY_F11 (GLFW_KEY_SPECIAL+12)
#define GLFW_KEY_F12 (GLFW_KEY_SPECIAL+13)
#define GLFW_KEY_F13 (GLFW_KEY_SPECIAL+14)
#define GLFW_KEY_F14 (GLFW_KEY_SPECIAL+15)
#define GLFW_KEY_F15 (GLFW_KEY_SPECIAL+16)
#define GLFW_KEY_F16 (GLFW_KEY_SPECIAL+17)
#define GLFW_KEY_F17 (GLFW_KEY_SPECIAL+18)
#define GLFW_KEY_F18 (GLFW_KEY_SPECIAL+19)
#define GLFW_KEY_F19 (GLFW_KEY_SPECIAL+20)
#define GLFW_KEY_F20 (GLFW_KEY_SPECIAL+21)
#define GLFW_KEY_F21 (GLFW_KEY_SPECIAL+22)
#define GLFW_KEY_F22 (GLFW_KEY_SPECIAL+23)
#define GLFW_KEY_F23 (GLFW_KEY_SPECIAL+24)
#define GLFW_KEY_F24 (GLFW_KEY_SPECIAL+25)
#define GLFW_KEY_F25 (GLFW_KEY_SPECIAL+26)
#define GLFW_KEY_UP (GLFW_KEY_SPECIAL+27)
#define GLFW_KEY_DOWN (GLFW_KEY_SPECIAL+28)
#define GLFW_KEY_LEFT (GLFW_KEY_SPECIAL+29)
#define GLFW_KEY_RIGHT (GLFW_KEY_SPECIAL+30)
#define GLFW_KEY_LSHIFT (GLFW_KEY_SPECIAL+31)
#define GLFW_KEY_RSHIFT (GLFW_KEY_SPECIAL+32)
#define GLFW_KEY_LCTRL (GLFW_KEY_SPECIAL+33)
#define GLFW_KEY_RCTRL (GLFW_KEY_SPECIAL+34)
#define GLFW_KEY_LALT (GLFW_KEY_SPECIAL+35)
#define GLFW_KEY_RALT (GLFW_KEY_SPECIAL+36)
#define GLFW_KEY_TAB (GLFW_KEY_SPECIAL+37)
#define GLFW_KEY_ENTER (GLFW_KEY_SPECIAL+38)
#define GLFW_KEY_BACKSPACE (GLFW_KEY_SPECIAL+39)
#define GLFW_KEY_INSERT (GLFW_KEY_SPECIAL+40)
#define GLFW_KEY_DEL (GLFW_KEY_SPECIAL+41)
#define GLFW_KEY_PAGEUP (GLFW_KEY_SPECIAL+42)
#define GLFW_KEY_PAGEDOWN (GLFW_KEY_SPECIAL+43)
#define GLFW_KEY_HOME (GLFW_KEY_SPECIAL+44)
#define GLFW_KEY_END (GLFW_KEY_SPECIAL+45)
#define GLFW_KEY_KP_0 (GLFW_KEY_SPECIAL+46)
#define GLFW_KEY_KP_1 (GLFW_KEY_SPECIAL+47)
#define GLFW_KEY_KP_2 (GLFW_KEY_SPECIAL+48)
#define GLFW_KEY_KP_3 (GLFW_KEY_SPECIAL+49)
#define GLFW_KEY_KP_4 (GLFW_KEY_SPECIAL+50)
#define GLFW_KEY_KP_5 (GLFW_KEY_SPECIAL+51)
#define GLFW_KEY_KP_6 (GLFW_KEY_SPECIAL+52)
#define GLFW_KEY_KP_7 (GLFW_KEY_SPECIAL+53)
#define GLFW_KEY_KP_8 (GLFW_KEY_SPECIAL+54)
#define GLFW_KEY_KP_9 (GLFW_KEY_SPECIAL+55)
#define GLFW_KEY_KP_DIVIDE (GLFW_KEY_SPECIAL+56)
#define GLFW_KEY_KP_MULTIPLY (GLFW_KEY_SPECIAL+57)
#define GLFW_KEY_KP_SUBTRACT (GLFW_KEY_SPECIAL+58)
#define GLFW_KEY_KP_ADD (GLFW_KEY_SPECIAL+59)
#define GLFW_KEY_KP_DECIMAL (GLFW_KEY_SPECIAL+60)
#define GLFW_KEY_KP_EQUAL (GLFW_KEY_SPECIAL+61)
#define GLFW_KEY_KP_ENTER (GLFW_KEY_SPECIAL+62)
#define GLFW_KEY_LAST GLFW_KEY_KP_ENTER
// Mouse button
#define GLFW_MOUSE_BUTTON_LEFT 0
#define GLFW_MOUSE_BUTTON_RIGHT 1
#define GLFW_MOUSE_BUTTON_MIDDLE 2
#ifdef __cplusplus
}
#endif
#endif // !defined MINI_GLFW_INCLUDED

142
AntTweakBar/src/MiniGLUT.h Normal file
View File

@@ -0,0 +1,142 @@
// ---------------------------------------------------------------------------
//
// @file MiniGLUT.h
// @brief A subset of GLUT definitions needed to compile helper functions
// implemented in TwEventGLUT.c
//
// notes: - Private header
// - AntTweakBar.dll does not need to link with GLUT,
// it just needs some definitions for its helper functions.
// - This header is provided to avoid the need of having GLUT
// installed to recompile AntTweakBar.
// - Do not use this header in your own programs, better use the
// GLUT.h header from the actual GLUT library SDK :
// http://opengl.org/resources/libraries/glut
//
// ---------------------------------------------------------------------------
#if !defined MINI_GLUT_INCLUDED
#define MINI_GLUT_INCLUDED
#if defined(_WIN32) || defined(_WIN64)
# define WIN32_LEAN_AND_MEAN
# include <windows.h> // needed by gl.h
# define GLUT_CALL __stdcall
# define GLUT_CALLBACK __cdecl
# define GLUT_API __declspec(dllimport)
#else
# define GLUT_CALL
# define GLUT_CALLBACK
# define GLUT_API extern
#endif
#if defined(_MACOSX)
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
#else
# include <GL/gl.h> // must be included after windows.h
# include <GL/glu.h>
#endif
#ifdef __cplusplus
extern "C" {
#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
// glutGetModifiers return mask
#define GLUT_ACTIVE_SHIFT 1
#define GLUT_ACTIVE_CTRL 2
#define GLUT_ACTIVE_ALT 4
// 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
// 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
// timer
#define GLUT_ELAPSED_TIME ((GLenum) 700)
// functions subset
GLUT_API void GLUT_CALL glutInit(int *argcp, char **argv);
GLUT_API void GLUT_CALL glutInitDisplayMode(unsigned int mode);
GLUT_API int GLUT_CALL glutCreateWindow(const char *title);
GLUT_API int GLUT_CALL glutGetWindow(void);
GLUT_API void GLUT_CALL glutSetWindow(int win);
GLUT_API int GLUT_CALL glutCreateSubWindow(int win, int x, int y, int width, int height);
GLUT_API int GLUT_CALL glutGet(GLenum type);
GLUT_API void GLUT_CALL glutSwapBuffers();
GLUT_API void GLUT_CALL glutPostRedisplay();
GLUT_API void GLUT_CALL glutInitWindowPosition(int x, int y);
GLUT_API void GLUT_CALL glutInitWindowSize(int width, int height);
GLUT_API void GLUT_CALL glutPositionWindow(int x, int y);
GLUT_API void GLUT_CALL glutReshapeWindow(int width, int height);
GLUT_API void GLUT_CALL glutMainLoop();
GLUT_API int GLUT_CALL glutCreateMenu(void (GLUT_CALLBACK *func)(int));
GLUT_API void GLUT_CALL glutDisplayFunc(void (GLUT_CALLBACK *func)(void));
GLUT_API void GLUT_CALL glutReshapeFunc(void (GLUT_CALLBACK *func)(int width, int height));
GLUT_API void GLUT_CALL glutKeyboardFunc(void (GLUT_CALLBACK *func)(unsigned char key, int x, int y));
GLUT_API void GLUT_CALL glutMouseFunc(void (GLUT_CALLBACK *func)(int button, int state, int x, int y));
GLUT_API void GLUT_CALL glutMotionFunc(void (GLUT_CALLBACK *func)(int x, int y));
GLUT_API void GLUT_CALL glutPassiveMotionFunc(void (GLUT_CALLBACK *func)(int x, int y));
GLUT_API void GLUT_CALL glutSpecialFunc(void (GLUT_CALLBACK *func)(int key, int x, int y));
GLUT_API int GLUT_CALL glutGetModifiers(void);
GLUT_API void GLUT_CALL glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
GLUT_API void GLUT_CALL glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
GLUT_API void GLUT_CALL glutSolidTeapot(GLdouble size);
// GLUT exit problem workaround (see glut.h)
#if (defined(_WIN32) || defined(_WIN64)) && !defined(GLUT_DISABLE_ATEXIT_HACK)
extern void __cdecl exit(int);
GLUT_API void GLUT_CALL __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
static void GLUT_CALL glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
#define glutInit glutInit_ATEXIT_HACK
#endif
#ifdef __cplusplus
}
#endif
#endif // !defined MINI_GLUT_INCLUDED

339
AntTweakBar/src/MiniSDL12.h Normal file
View File

@@ -0,0 +1,339 @@
// ---------------------------------------------------------------------------
//
// @file MiniSDL12.h
// @brief A subset of SDL 1.2 definitions needed to compile helper
// functions implemented in TwEventSDL12.c
//
// notes: - Private header
// - AntTweakBar.dll does not need to link with SDL,
// it just needs some definitions for its helper functions.
// - This header is provided to avoid the need of having SDL
// installed to recompile AntTweakBar.
// - Do not use this header in your own programs, better use the
// SDL.h header from the actual SDL library SDK :
// http://www.libsdl.org
//
// ---------------------------------------------------------------------------
#if !defined MINI_SDL12_INCLUDED
#define MINI_SDL12_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#define SDL_MAJOR_VERSION 1
#define SDL_MINOR_VERSION 2
#if defined(_WIN32) || defined(_WIN64)
# define SDL_DECLSPEC __declspec(dllimport)
# define SDL_CALL __cdecl
#else
# define SDL_DECLSPEC
# define SDL_CALL
#endif
typedef unsigned char Uint8;
typedef signed char Sint8;
typedef unsigned short Uint16;
typedef signed short Sint16;
typedef unsigned int Uint32;
typedef signed int Sint32;
// Subset of SDL keysym
typedef enum {
SDLK_BACKSPACE = 8,
SDLK_TAB = 9,
SDLK_CLEAR = 12,
SDLK_RETURN = 13,
SDLK_PAUSE = 19,
SDLK_ESCAPE = 27,
SDLK_DELETE = 127,
SDLK_UP = 273,
SDLK_DOWN = 274,
SDLK_RIGHT = 275,
SDLK_LEFT = 276,
SDLK_INSERT = 277,
SDLK_HOME = 278,
SDLK_END = 279,
SDLK_PAGEUP = 280,
SDLK_PAGEDOWN = 281,
SDLK_F1 = 282,
SDLK_F2 = 283,
SDLK_F3 = 284,
SDLK_F4 = 285,
SDLK_F5 = 286,
SDLK_F6 = 287,
SDLK_F7 = 288,
SDLK_F8 = 289,
SDLK_F9 = 290,
SDLK_F10 = 291,
SDLK_F11 = 292,
SDLK_F12 = 293,
} SDLKey;
typedef enum {
KMOD_NONE = 0x0000,
KMOD_LSHIFT = 0x0001,
KMOD_RSHIFT = 0x0002,
KMOD_LCTRL = 0x0040,
KMOD_RCTRL = 0x0080,
KMOD_LALT = 0x0100,
KMOD_RALT = 0x0200,
KMOD_LMETA = 0x0400,
KMOD_RMETA = 0x0800,
KMOD_NUM = 0x1000,
KMOD_CAPS = 0x2000,
KMOD_MODE = 0x4000,
KMOD_RESERVED = 0x8000
} SDLMod;
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
#define KMOD_META (KMOD_LMETA|KMOD_RMETA)
typedef enum {
SDL_NOEVENT = 0,
SDL_ACTIVEEVENT,
SDL_KEYDOWN,
SDL_KEYUP,
SDL_MOUSEMOTION,
SDL_MOUSEBUTTONDOWN,
SDL_MOUSEBUTTONUP,
SDL_JOYAXISMOTION,
SDL_JOYBALLMOTION,
SDL_JOYHATMOTION,
SDL_JOYBUTTONDOWN,
SDL_JOYBUTTONUP,
SDL_QUIT,
SDL_SYSWMEVENT,
SDL_EVENT_RESERVEDA,
SDL_EVENT_RESERVEDB,
SDL_VIDEORESIZE,
SDL_VIDEOEXPOSE,
SDL_EVENT_RESERVED2,
SDL_EVENT_RESERVED3,
SDL_EVENT_RESERVED4,
SDL_EVENT_RESERVED5,
SDL_EVENT_RESERVED6,
SDL_EVENT_RESERVED7,
SDL_USEREVENT = 24,
SDL_NUMEVENTS = 32
} SDLEventEnum;
typedef struct SDL_keysym {
Uint8 scancode;
SDLKey sym;
SDLMod mod;
Uint16 unicode;
} SDL_keysym;
typedef struct SDL_ActiveEvent {
Uint8 type;
Uint8 gain;
Uint8 state;
} SDL_ActiveEvent;
typedef struct SDL_KeyboardEvent {
Uint8 type;
Uint8 which;
Uint8 state;
SDL_keysym keysym;
} SDL_KeyboardEvent;
typedef struct SDL_MouseMotionEvent {
Uint8 type;
Uint8 which;
Uint8 state;
Uint16 x, y;
Sint16 xrel;
Sint16 yrel;
} SDL_MouseMotionEvent;
typedef struct SDL_MouseButtonEvent {
Uint8 type;
Uint8 which;
Uint8 button;
Uint8 state;
Uint16 x, y;
} SDL_MouseButtonEvent;
typedef struct SDL_JoyAxisEvent {
Uint8 type;
Uint8 which;
Uint8 axis;
Sint16 value;
} SDL_JoyAxisEvent;
typedef struct SDL_JoyBallEvent {
Uint8 type;
Uint8 which;
Uint8 ball;
Sint16 xrel;
Sint16 yrel;
} SDL_JoyBallEvent;
typedef struct SDL_JoyHatEvent {
Uint8 type;
Uint8 which;
Uint8 hat;
Uint8 value;
} SDL_JoyHatEvent;
typedef struct SDL_JoyButtonEvent {
Uint8 type;
Uint8 which;
Uint8 button;
Uint8 state;
} SDL_JoyButtonEvent;
typedef struct SDL_ResizeEvent {
Uint8 type;
int w;
int h;
} SDL_ResizeEvent;
typedef struct SDL_ExposeEvent {
Uint8 type;
} SDL_ExposeEvent;
typedef struct SDL_QuitEvent {
Uint8 type;
} SDL_QuitEvent;
typedef struct SDL_UserEvent {
Uint8 type;
int code;
void *data1;
void *data2;
} SDL_UserEvent;
struct SDL_SysWMmsg;
typedef struct SDL_SysWMmsg SDL_SysWMmsg;
typedef struct SDL_SysWMEvent {
Uint8 type;
SDL_SysWMmsg *msg;
} SDL_SysWMEvent;
typedef union {
Uint8 type;
SDL_ActiveEvent active;
SDL_KeyboardEvent key;
SDL_MouseMotionEvent motion;
SDL_MouseButtonEvent button;
SDL_JoyAxisEvent jaxis;
SDL_JoyBallEvent jball;
SDL_JoyHatEvent jhat;
SDL_JoyButtonEvent jbutton;
SDL_ResizeEvent resize;
SDL_ExposeEvent expose;
SDL_QuitEvent quit;
SDL_UserEvent user;
SDL_SysWMEvent syswm;
char full[56];
} SDL_Event;
typedef struct SDL_PixelFormat {
void *palette;
Uint8 BitsPerPixel;
Uint8 BytesPerPixel;
Uint8 Rloss;
Uint8 Gloss;
Uint8 Bloss;
Uint8 Aloss;
Uint8 Rshift;
Uint8 Gshift;
Uint8 Bshift;
Uint8 Ashift;
Uint32 Rmask;
Uint32 Gmask;
Uint32 Bmask;
Uint32 Amask;
Uint32 colorkey;
Uint8 alpha;
} SDL_PixelFormat;
typedef enum {
SDL_GL_RED_SIZE,
SDL_GL_GREEN_SIZE,
SDL_GL_BLUE_SIZE,
SDL_GL_ALPHA_SIZE,
SDL_GL_BUFFER_SIZE,
SDL_GL_DOUBLEBUFFER,
SDL_GL_DEPTH_SIZE,
SDL_GL_STENCIL_SIZE,
SDL_GL_ACCUM_RED_SIZE,
SDL_GL_ACCUM_GREEN_SIZE,
SDL_GL_ACCUM_BLUE_SIZE,
SDL_GL_ACCUM_ALPHA_SIZE,
SDL_GL_STEREO,
SDL_GL_MULTISAMPLEBUFFERS,
SDL_GL_MULTISAMPLESAMPLES,
SDL_GL_ACCELERATED_VISUAL,
SDL_GL_RETAINED_BACKING,
SDL_GL_CONTEXT_MAJOR_VERSION,
SDL_GL_CONTEXT_MINOR_VERSION
} SDL_GLattr;
typedef struct SDL_VideoInfo {
Uint32 hw_available :1;
Uint32 wm_available :1;
Uint32 UnusedBits1 :6;
Uint32 UnusedBits2 :1;
Uint32 blit_hw :1;
Uint32 blit_hw_CC :1;
Uint32 blit_hw_A :1;
Uint32 blit_sw :1;
Uint32 blit_sw_CC :1;
Uint32 blit_sw_A :1;
Uint32 blit_fill :1;
Uint32 UnusedBits3 :16;
Uint32 video_mem;
SDL_PixelFormat *vfmt;
int current_w;
int current_h;
} SDL_VideoInfo;
#define SDL_INIT_VIDEO 0x00000020
#define SDL_SWSURFACE 0x00000000
#define SDL_HWSURFACE 0x00000001
#define SDL_ASYNCBLIT 0x00000004
#define SDL_ANYFORMAT 0x10000000
#define SDL_HWPALETTE 0x20000000
#define SDL_DOUBLEBUF 0x40000000
#define SDL_FULLSCREEN 0x80000000
#define SDL_OPENGL 0x00000002
#define SDL_OPENGLBLIT 0x0000000A
#define SDL_RESIZABLE 0x00000010
#define SDL_NOFRAME 0x00000020
#define SDL_DEFAULT_REPEAT_DELAY 500
#define SDL_DEFAULT_REPEAT_INTERVAL 30
// functions subset
extern SDL_DECLSPEC int SDL_CALL SDL_Init(Uint32 flags);
extern SDL_DECLSPEC void SDL_CALL SDL_Quit();
extern SDL_DECLSPEC char * SDL_CALL SDL_GetError();
extern SDL_DECLSPEC const SDL_VideoInfo * SDL_CALL SDL_GetVideoInfo();
extern SDL_DECLSPEC struct SDL_Surface * SDL_CALL SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags);
extern SDL_DECLSPEC int SDL_CALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
extern SDL_DECLSPEC void SDL_CALL SDL_GL_SwapBuffers();
extern SDL_DECLSPEC void SDL_CALL SDL_WM_SetCaption(const char *title, const char *icon);
extern SDL_DECLSPEC void SDL_CALL SDL_WM_GetCaption(char **title, char **icon);
extern SDL_DECLSPEC int SDL_CALL SDL_EnableUNICODE(int enable);
extern SDL_DECLSPEC int SDL_CALL SDL_EnableKeyRepeat(int delay, int interval);
extern SDL_DECLSPEC Uint32 SDL_CALL SDL_GetTicks();
extern SDL_DECLSPEC int SDL_CALL SDL_PollEvent(SDL_Event *event);
extern SDL_DECLSPEC int SDL_CALL SDL_WaitEvent(SDL_Event *event);
extern SDL_DECLSPEC int SDL_CALL SDL_PushEvent(SDL_Event *event);
#ifdef __cplusplus
}
#endif
#endif // !defined MINI_SDL12_INCLUDED

428
AntTweakBar/src/MiniSDL13.h Normal file
View File

@@ -0,0 +1,428 @@
// ---------------------------------------------------------------------------
//
// @file MiniSDL13.h
// @brief A subset of SDL 1.3 definitions needed to compile helper
// functions implemented in TwEventSDL13.c
//
// notes: - Private header
// - AntTweakBar.dll does not need to link with SDL,
// it just needs some definitions for its helper functions.
// - This header is provided to avoid the need of having SDL
// installed to recompile AntTweakBar.
// - Do not use this header in your own programs, better use the
// SDL.h header from the actual SDL library SDK :
// http://www.libsdl.org
//
// ---------------------------------------------------------------------------
#if !defined MINI_SDL_INCLUDED
#define MINI_SDL_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#define SDL_MAJOR_VERSION 1
#define SDL_MINOR_VERSION 3
#if defined(_WIN32) || defined(_WIN64)
# define SDL_DECLSPEC __declspec(dllimport)
# define SDL_CALL __cdecl
#else
# define SDL_DECLSPEC
# define SDL_CALL
#endif
typedef unsigned char Uint8;
typedef signed char Sint8;
typedef unsigned short Uint16;
typedef signed short Sint16;
typedef unsigned int Uint32;
typedef signed int Sint32;
#define SDLK_SCANCODE_MASK (1<<30)
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
// Subset of SDL scancodes.
// Note: some SDL scancodes seems to be wrong in the original
// SDL scancode header file.
typedef enum {
SDL_SCANCODE_F1 = 58,
SDL_SCANCODE_F2 = 59,
SDL_SCANCODE_F3 = 60,
SDL_SCANCODE_F4 = 61,
SDL_SCANCODE_F5 = 62,
SDL_SCANCODE_F6 = 63,
SDL_SCANCODE_F7 = 64,
SDL_SCANCODE_F8 = 65,
SDL_SCANCODE_F9 = 66,
SDL_SCANCODE_F10 = 67,
SDL_SCANCODE_F11 = 68,
SDL_SCANCODE_F12 = 69,
SDL_SCANCODE_INSERT = 98, //73,
SDL_SCANCODE_HOME = 95, //74,
SDL_SCANCODE_PAGEUP = 97, //75,
SDL_SCANCODE_DELETE = 99, //76,
SDL_SCANCODE_END = 89, //77,
SDL_SCANCODE_PAGEDOWN = 91, //78,
SDL_SCANCODE_RIGHT = 94, //79,
SDL_SCANCODE_LEFT = 92, //80,
SDL_SCANCODE_DOWN = 90, //81,
SDL_SCANCODE_UP = 96 //82
} SDL_scancode;
// Subset of SDL keysym
typedef enum {
SDLK_BACKSPACE = 8,
SDLK_TAB = 9,
SDLK_CLEAR = 12,
SDLK_RETURN = 13,
SDLK_PAUSE = 19,
SDLK_ESCAPE = 27,
SDLK_DELETE = 127,
SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP),
SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN),
SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT),
SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT),
SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT),
SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME),
SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END),
SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP),
SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN),
SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1),
SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2),
SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3),
SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4),
SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5),
SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6),
SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7),
SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8),
SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9),
SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10),
SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11),
SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12)
} SDLKey;
typedef enum {
KMOD_NONE = 0x0000,
KMOD_LSHIFT = 0x0001,
KMOD_RSHIFT = 0x0002,
KMOD_LCTRL = 0x0040,
KMOD_RCTRL = 0x0080,
KMOD_LALT = 0x0100,
KMOD_RALT = 0x0200,
KMOD_LGUI = 0x0400,
KMOD_RGUI = 0x0800,
KMOD_NUM = 0x1000,
KMOD_CAPS = 0x2000,
KMOD_MODE = 0x4000,
KMOD_RESERVED = 0x8000
} SDLMod;
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI)
typedef enum {
SDL_NOEVENT = 0,
SDL_WINDOWEVENT,
SDL_KEYDOWN,
SDL_KEYUP,
SDL_TEXTEDITING,
SDL_TEXTINPUT,
SDL_MOUSEMOTION,
SDL_MOUSEBUTTONDOWN,
SDL_MOUSEBUTTONUP,
SDL_MOUSEWHEEL,
SDL_JOYAXISMOTION,
SDL_JOYBALLMOTION,
SDL_JOYHATMOTION,
SDL_JOYBUTTONDOWN,
SDL_JOYBUTTONUP,
SDL_QUIT,
SDL_SYSWMEVENT,
SDL_PROXIMITYIN,
SDL_PROXIMITYOUT,
SDL_EVENT_RESERVED1,
SDL_EVENT_RESERVED2,
SDL_EVENT_RESERVED3,
SDL_USEREVENT = 24,
SDL_NUMEVENTS = 32
} SDL_EventType;
#define SDL_ACTIVEEVENT SDL_EVENT_RESERVED1
#define SDL_VIDEORESIZE SDL_EVENT_RESERVED2
#define SDL_VIDEOEXPOSE SDL_EVENT_RESERVED3
typedef Uint32 SDL_WindowID;
typedef struct SDL_keysym {
SDL_scancode scancode;
SDLKey sym;
Uint16 mod;
Uint32 unicode;
} SDL_keysym;
typedef struct SDL_WindowEvent {
Uint8 type;
SDL_WindowID windowID;
Uint8 event;
int data1;
int data2;
} SDL_WindowEvent;
typedef struct SDL_KeyboardEvent {
Uint8 type;
SDL_WindowID windowID;
Uint8 which;
Uint8 state;
SDL_keysym keysym;
} SDL_KeyboardEvent;
#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
typedef struct SDL_TextEditingEvent {
Uint8 type;
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
int start;
int length;
} SDL_TextEditingEvent;
#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
typedef struct SDL_TextInputEvent {
Uint8 type;
SDL_WindowID windowID;
Uint8 which;
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
} SDL_TextInputEvent;
typedef struct SDL_MouseMotionEvent {
Uint8 type;
SDL_WindowID windowID;
Uint8 which;
Uint8 state;
int x;
int y;
int z;
int pressure;
int pressure_max;
int pressure_min;
int rotation;
int tilt;
int cursor;
int xrel;
int yrel;
} SDL_MouseMotionEvent;
typedef struct SDL_MouseButtonEvent {
Uint8 type;
SDL_WindowID windowID;
Uint8 which;
Uint8 button;
Uint8 state;
int x;
int y;
} SDL_MouseButtonEvent;
typedef struct SDL_MouseWheelEvent {
Uint8 type;
SDL_WindowID windowID;
Uint8 which;
int x;
int y;
} SDL_MouseWheelEvent;
typedef struct SDL_JoyAxisEvent {
Uint8 type;
Uint8 which;
Uint8 axis;
Sint16 value;
} SDL_JoyAxisEvent;
typedef struct SDL_JoyBallEvent {
Uint8 type;
Uint8 which;
Uint8 ball;
Sint16 xrel;
Sint16 yrel;
} SDL_JoyBallEvent;
typedef struct SDL_JoyHatEvent {
Uint8 type;
Uint8 which;
Uint8 hat;
Uint8 value;
} SDL_JoyHatEvent;
typedef struct SDL_JoyButtonEvent {
Uint8 type;
Uint8 which;
Uint8 button;
Uint8 state;
} SDL_JoyButtonEvent;
typedef struct SDL_ActiveEvent
{
Uint8 type;
Uint8 gain;
Uint8 state;
} SDL_ActiveEvent;
typedef struct SDL_ResizeEvent {
Uint8 type;
int w;
int h;
} SDL_ResizeEvent;
typedef struct SDL_ExposeEvent {
Uint8 type;
} SDL_ExposeEvent;
typedef struct SDL_QuitEvent {
Uint8 type;
} SDL_QuitEvent;
typedef struct SDL_UserEvent {
Uint8 type;
SDL_WindowID windowID;
int code;
void *data1;
void *data2;
} SDL_UserEvent;
struct SDL_SysWMmsg;
typedef struct SDL_SysWMmsg SDL_SysWMmsg;
typedef struct SDL_SysWMEvent {
Uint8 type;
SDL_SysWMmsg *msg;
} SDL_SysWMEvent;
typedef struct SDL_ProximityEvent
{
Uint8 type;
SDL_WindowID windowID;
Uint8 which;
int cursor;
int x;
int y;
} SDL_ProximityEvent;
typedef union SDL_Event {
Uint8 type;
SDL_WindowEvent window;
SDL_KeyboardEvent key;
SDL_TextEditingEvent edit;
SDL_TextInputEvent text;
SDL_MouseMotionEvent motion;
SDL_MouseButtonEvent button;
SDL_MouseWheelEvent wheel;
SDL_JoyAxisEvent jaxis;
SDL_JoyBallEvent jball;
SDL_JoyHatEvent jhat;
SDL_JoyButtonEvent jbutton;
SDL_QuitEvent quit;
SDL_UserEvent user;
SDL_SysWMEvent syswm;
SDL_ProximityEvent proximity;
SDL_ActiveEvent active;
SDL_ResizeEvent resize;
} SDL_Event;
typedef struct SDL_PixelFormat {
void *palette;
Uint8 BitsPerPixel;
Uint8 BytesPerPixel;
Uint8 Rloss;
Uint8 Gloss;
Uint8 Bloss;
Uint8 Aloss;
Uint8 Rshift;
Uint8 Gshift;
Uint8 Bshift;
Uint8 Ashift;
Uint32 Rmask;
Uint32 Gmask;
Uint32 Bmask;
Uint32 Amask;
} SDL_PixelFormat;
typedef enum SDL_GLattr {
SDL_GL_RED_SIZE,
SDL_GL_GREEN_SIZE,
SDL_GL_BLUE_SIZE,
SDL_GL_ALPHA_SIZE,
SDL_GL_BUFFER_SIZE,
SDL_GL_DOUBLEBUFFER,
SDL_GL_DEPTH_SIZE,
SDL_GL_STENCIL_SIZE,
SDL_GL_ACCUM_RED_SIZE,
SDL_GL_ACCUM_GREEN_SIZE,
SDL_GL_ACCUM_BLUE_SIZE,
SDL_GL_ACCUM_ALPHA_SIZE,
SDL_GL_STEREO,
SDL_GL_MULTISAMPLEBUFFERS,
SDL_GL_MULTISAMPLESAMPLES,
SDL_GL_ACCELERATED_VISUAL,
SDL_GL_RETAINED_BACKING,
SDL_GL_CONTEXT_MAJOR_VERSION,
SDL_GL_CONTEXT_MINOR_VERSION
} SDL_GLattr;
typedef struct SDL_VideoInfo {
Uint32 hw_available :1;
Uint32 wm_available :1;
Uint32 UnusedBits1 :6;
Uint32 UnusedBits2 :1;
Uint32 blit_hw :1;
Uint32 blit_hw_CC :1;
Uint32 blit_hw_A :1;
Uint32 blit_sw :1;
Uint32 blit_sw_CC :1;
Uint32 blit_sw_A :1;
Uint32 blit_fill :1;
Uint32 UnusedBits3 :16;
Uint32 video_mem;
SDL_PixelFormat *vfmt;
int current_w;
int current_h;
} SDL_VideoInfo;
#define SDL_INIT_VIDEO 0x00000020
#define SDL_ANYFORMAT 0x00100000
#define SDL_HWPALETTE 0x00200000
#define SDL_DOUBLEBUF 0x00400000
#define SDL_FULLSCREEN 0x00800000
#define SDL_RESIZABLE 0x01000000
#define SDL_NOFRAME 0x02000000
#define SDL_OPENGL 0x04000000
#define SDL_HWSURFACE 0x08000001
#define SDL_DEFAULT_REPEAT_DELAY 500
#define SDL_DEFAULT_REPEAT_INTERVAL 30
// functions subset
extern SDL_DECLSPEC int SDL_CALL SDL_Init(Uint32 flags);
extern SDL_DECLSPEC void SDL_CALL SDL_Quit();
extern SDL_DECLSPEC char * SDL_CALL SDL_GetError();
extern SDL_DECLSPEC const SDL_VideoInfo * SDL_CALL SDL_GetVideoInfo();
extern SDL_DECLSPEC struct SDL_Surface * SDL_CALL SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags);
extern SDL_DECLSPEC int SDL_CALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
extern SDL_DECLSPEC void SDL_CALL SDL_GL_SwapBuffers();
extern SDL_DECLSPEC void SDL_CALL SDL_WM_SetCaption(const char *title, const char *icon);
extern SDL_DECLSPEC void SDL_CALL SDL_WM_GetCaption(char **title, char **icon);
extern SDL_DECLSPEC int SDL_CALL SDL_EnableUNICODE(int enable);
extern SDL_DECLSPEC int SDL_CALL SDL_EnableKeyRepeat(int delay, int interval);
extern SDL_DECLSPEC Uint32 SDL_CALL SDL_GetTicks();
extern SDL_DECLSPEC int SDL_CALL SDL_PollEvent(SDL_Event *event);
extern SDL_DECLSPEC int SDL_CALL SDL_WaitEvent(SDL_Event *event);
extern SDL_DECLSPEC int SDL_CALL SDL_PushEvent(SDL_Event *event);
#ifdef __cplusplus
}
#endif
#endif // !defined MINI_SDL_INCLUDED

View File

@@ -0,0 +1,220 @@
// ---------------------------------------------------------------------------
//
// @file MiniSFML16.h
// @brief A subset of SFML 1.6 definitions needed to compile helper
// functions implemented in TwEventSFML.cpp
//
// notes: - Private header
// - AntTweakBar.dll does not need to link with SFML,
// it just needs some definitions for its helper functions.
// - This header is provided to avoid the need of having SFML
// installed to recompile AntTweakBar.
// It declares a small and incomplete part of SFML classes.
// For instance, many non-virtual methods have been stripped out.
// - Do not use this header in your own programs, better use the
// SFML headers from the actual SFML library SDK :
// http://www.sfml-dev.org
//
// ---------------------------------------------------------------------------
#if !defined MINI_SFML16_INCLUDED
#define MINI_SFML16_INCLUDED
namespace sf
{
namespace Key { enum Code
{
A = 'a', B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z,
Num0 = '0', Num1, Num2, Num3, Num4, Num5, Num6, Num7, Num8, Num9,
Escape = 256,
LControl, LShift, LAlt, LSystem,
RControl, RShift, RAlt, RSystem, Menu,
LBracket, RBracket, SemiColon, Comma, Period, Quote, Slash, BackSlash,
Tilde, Equal, Dash, Space, Return, Back, Tab,
PageUp, PageDown, End, Home, Insert, Delete,
Add, Subtract, Multiply, Divide, Left, Right, Up, Down,
Numpad0, Numpad1, Numpad2, Numpad3, Numpad4, Numpad5, Numpad6, Numpad7, Numpad8, Numpad9,
F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, Pause,
Count
}; }
namespace Mouse { enum Button { Left, Right, Middle, XButton1, XButton2, Count }; }
namespace Joy { enum Axis { AxisX, AxisY, AxisZ, AxisR, AxisU, AxisV, AxisPOV, AxisCount };
enum { Count = 4, ButtonCount = 32}; }
typedef unsigned char Uint8;
typedef unsigned int Uint32;
class Event
{
public :
struct KeyEvent { Key::Code Code; bool Alt, Control, Shift; };
struct TextEvent { Uint32 Unicode; };
struct MouseMoveEvent { int X, Y; };
struct MouseButtonEvent { Mouse::Button Button; int X, Y; };
struct MouseWheelEvent { int Delta; };
struct JoyMoveEvent { unsigned int JoystickId; Joy::Axis Axis; float Position; };
struct JoyButtonEvent { unsigned int JoystickId, Button; };
struct SizeEvent { unsigned int Width, Height; };
enum EventType
{
Closed, Resized, LostFocus, GainedFocus, TextEntered, KeyPressed, KeyReleased,
MouseWheelMoved, MouseButtonPressed, MouseButtonReleased, MouseMoved, MouseEntered, MouseLeft,
JoyButtonPressed, JoyButtonReleased, JoyMoved
};
EventType Type;
union
{
KeyEvent Key;
TextEvent Text;
MouseMoveEvent MouseMove;
MouseButtonEvent MouseButton;
MouseWheelEvent MouseWheel;
JoyMoveEvent JoyMove;
JoyButtonEvent JoyButton;
SizeEvent Size;
};
};
} // namespace sf
#ifdef USE_MINI_SFML
// we also need some the definition of sf::RenderWindow to compile our SFML example
#include <string>
#include <queue>
namespace sf
{
class Input;
class Drawable;
typedef void* WindowHandle;
namespace priv { class WindowImpl; }
class WindowListener
{
public :
virtual void OnEvent(const Event& EventReceived) = 0;
protected :
virtual ~WindowListener();
};
class VideoMode
{
public :
VideoMode(unsigned int ModeWidth, unsigned int ModeHeight, unsigned int ModeBpp = 32);
unsigned int Width, Height, BitsPerPixel;
};
namespace Style { enum { None = 0, Titlebar = 1 << 0, Resize = 1 << 1, Close = 1 << 2, Fullscreen = 1 << 3 }; }
struct WindowSettings
{
explicit WindowSettings(unsigned int Depth = 24, unsigned int Stencil = 8, unsigned int Antialiasing = 0);
unsigned int DepthBits, StencilBits, AntialiasingLevel;
};
class Clock
{
public :
Clock();
float GetElapsedTime() const;
void Reset();
private :
double myStartTime;
};
class Input : public WindowListener
{
private :
virtual void OnEvent(const Event& EventReceived);
bool myKeys[Key::Count];
bool myMouseButtons[Mouse::Count];
int myMouseX;
int myMouseY;
bool myJoystickButtons[Joy::Count][Joy::ButtonCount];
float myJoystickAxis[Joy::Count][Joy::AxisCount];
};
class Window : public WindowListener
{
public :
Window(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const WindowSettings& Params = WindowSettings());
virtual ~Window();
void Close();
bool IsOpened() const;
unsigned int GetWidth() const;
unsigned int GetHeight() const;
bool GetEvent(Event& EventReceived);
void Display();
private :
virtual void OnCreate();
virtual void OnEvent(const Event& EventReceived);
priv::WindowImpl* myWindow;
std::queue<Event> myEvents;
Input myInput;
Clock myClock;
WindowSettings mySettings;
float myLastFrameTime;
bool myIsExternal;
unsigned int myFramerateLimit;
int mySetCursorPosX;
int mySetCursorPosY;
};
template <typename T> class Vector2 { public : T x, y; };
typedef Vector2<float> Vector2f;
template <typename T> class Rect { public : T Left, Top, Right, Bottom; };
typedef Rect<float> FloatRect;
class Matrix3 { private : float myData[16]; };
class View
{
private :
sf::Vector2f myCenter;
sf::Vector2f myHalfSize;
FloatRect myRect;
Matrix3 myMatrix;
bool myNeedUpdate;
};
class RenderTarget
{
public :
virtual ~RenderTarget();
virtual void Draw(const Drawable& Object);
virtual unsigned int GetWidth() const = 0;
virtual unsigned int GetHeight() const = 0;
void PreserveOpenGLStates(bool Preserve);
private :
virtual bool Activate(bool Active) = 0;
View myDefaultView;
const View* myCurrentView;
bool myPreserveStates;
bool myIsDrawing;
};
class RenderWindow : public Window, public RenderTarget
{
public :
RenderWindow(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const WindowSettings& Params = WindowSettings());
virtual ~RenderWindow();
virtual unsigned int GetWidth() const;
virtual unsigned int GetHeight() const;
private :
virtual void OnCreate();
virtual bool Activate(bool Active);
};
} // namespace sf
#endif // USE_MINI_SFML
#endif // !defined MINI_SFML16_INCLUDED

View File

@@ -0,0 +1,12 @@
Under Windows, it is not necessary to rebuild AntTweakBar since a precompiled
version is provided in the lib directory. But if you want to recompile it,
you can use the provided Visual Studio solution. You'd also need the DirectX
SDK (http://msdn.microsoft.com/directx) and the path to the DirectX shader
compiler fxc.exe (included in the DirectX SDK) must be listed in the VC++
directories.
To build the library on Linux, open a terminal, go in the src directory and
type make
To build the library on MacOSX, open a terminal, go in the src directory and
type make -f Makefile.osx

7771
AntTweakBar/src/TwBar.cpp Normal file

File diff suppressed because it is too large Load Diff

438
AntTweakBar/src/TwBar.h Normal file
View File

@@ -0,0 +1,438 @@
// ---------------------------------------------------------------------------
//
// @file TwBar.h
// @brief Tweak bar and var classes.
// @author Philippe Decaudin
// @license This file is part of the AntTweakBar library.
// For conditions of distribution and use, see License.txt
//
// note: Private header
//
// ---------------------------------------------------------------------------
#if !defined ANT_TW_BAR_INCLUDED
#define ANT_TW_BAR_INCLUDED
#include <AntTweakBar.h>
#include "TwColors.h"
#define ANT_TWEAK_BAR_DLL "AntTweakBar"
// ---------------------------------------------------------------------------
bool IsCustomType(int _Type);
struct CTwVar
{
std::string m_Name;
std::string m_Label;
std::string m_Help;
bool m_IsRoot;
bool m_DontClip;
bool m_Visible;
signed short m_LeftMargin;
signed short m_TopMargin;
const color32 * m_ColorPtr;
const color32 * m_BgColorPtr;
virtual bool IsGroup() const = 0;
virtual bool IsCustom() const { return false; }
virtual const CTwVar * Find(const char *_Name, struct CTwVarGroup **_Parent, int *_Index) const = 0;
virtual int HasAttrib(const char *_Attrib, bool *_HasValue) const;
virtual int SetAttrib(int _AttribID, const char *_Value, TwBar *_Bar, struct CTwVarGroup *_VarParent, int _VarIndex);
virtual ERetType GetAttrib(int _AttribID, TwBar *_Bar, struct CTwVarGroup *_VarParent, int _VarIndex, std::vector<double>& outDouble, std::ostringstream& outString) const;
virtual void SetReadOnly(bool _ReadOnly) = 0;
virtual bool IsReadOnly() const = 0;
CTwVar();
virtual ~CTwVar() {}
static size_t GetDataSize(TwType _Type);
};
struct CTwVarAtom : CTwVar
{
ETwType m_Type;
void * m_Ptr;
TwSetVarCallback m_SetCallback;
TwGetVarCallback m_GetCallback;
void * m_ClientData;
bool m_ReadOnly;
bool m_NoSlider;
int m_KeyIncr[2]; // [0]=key_code [1]=modifiers
int m_KeyDecr[2]; // [0]=key_code [1]=modifiers
template <typename _T> struct TVal
{
_T m_Min;
_T m_Max;
_T m_Step;
signed char m_Precision;
bool m_Hexa;
};
union UVal
{
TVal<unsigned char> m_Char;
TVal<signed char> m_Int8;
TVal<unsigned char> m_UInt8;
TVal<signed short> m_Int16;
TVal<unsigned short>m_UInt16;
TVal<signed int> m_Int32;
TVal<unsigned int> m_UInt32;
TVal<float> m_Float32;
TVal<double> m_Float64;
struct CBoolVal
{
char * m_TrueString;
char * m_FalseString;
bool m_FreeTrueString;
bool m_FreeFalseString;
} m_Bool;
struct CEnumVal // empty -> enum entries are deduced from m_Type
{
//typedef std::map<unsigned int, std::string> CEntries;
//CEntries * m_Entries;
} m_Enum;
struct CShortcutVal
{
int m_Incr[2];
int m_Decr[2];
} m_Shortcut;
struct CHelpStruct
{
int m_StructType;
} m_HelpStruct;
struct CButtonVal
{
TwButtonCallback m_Callback;
int m_Separator;
} m_Button;
struct CCustomVal
{
CTwMgr::CMemberProxy *m_MemberProxy;
} m_Custom;
};
UVal m_Val;
virtual bool IsGroup() const { return false; }
virtual bool IsCustom() const { return IsCustomType(m_Type); }
virtual void ValueToString(std::string *_Str) const;
virtual double ValueToDouble() const;
virtual void ValueFromDouble(double _Val);
virtual void MinMaxStepToDouble(double *_Min, double *_Max, double *_Step) const;
virtual const CTwVar * Find(const char *_Name, struct CTwVarGroup **_Parent, int *_Index) const;
virtual int HasAttrib(const char *_Attrib, bool *_HasValue) const;
virtual int SetAttrib(int _AttribID, const char *_Value, TwBar *_Bar, struct CTwVarGroup *_VarParent, int _VarIndex);
virtual ERetType GetAttrib(int _AttribID, TwBar *_Bar, struct CTwVarGroup *_VarParent, int _VarIndex, std::vector<double>& outDouble, std::ostringstream& outString) const;
virtual void Increment(int _Step);
virtual void SetDefaults();
virtual void SetReadOnly(bool _ReadOnly) { m_ReadOnly=_ReadOnly; if( m_Type!=TW_TYPE_BUTTON && m_SetCallback==NULL && m_Ptr==NULL ) m_ReadOnly=true; }
virtual bool IsReadOnly() const { if( m_Type!=TW_TYPE_BUTTON && m_SetCallback==NULL && m_Ptr==NULL ) return true; else return m_ReadOnly; }
//virtual int DefineEnum(const TwEnumVal *_EnumValues, unsigned int _NbValues);
CTwVarAtom();
virtual ~CTwVarAtom();
};
struct CTwVarGroup : CTwVar
{
std::vector<CTwVar *> m_Vars;
bool m_Open;
TwSummaryCallback m_SummaryCallback;
void * m_SummaryClientData;
void * m_StructValuePtr;
TwType m_StructType;
virtual bool IsGroup() const { return true; }
virtual const CTwVar * Find(const char *_Name, CTwVarGroup **_Parent, int *_Index) const;
virtual int HasAttrib(const char *_Attrib, bool *_HasValue) const;
virtual int SetAttrib(int _AttribID, const char *_Value, TwBar *_Bar, struct CTwVarGroup *_VarParent, int _VarIndex);
virtual ERetType GetAttrib(int _AttribID, TwBar *_Bar, struct CTwVarGroup *_VarParent, int _VarIndex, std::vector<double>& outDouble, std::ostringstream& outString) const;
virtual CTwVarAtom * FindShortcut(int _Key, int _Modifiers, bool *_DoIncr);
virtual void SetReadOnly(bool _ReadOnly) { for(size_t i=0; i<m_Vars.size(); ++i) if(m_Vars[i]) m_Vars[i]->SetReadOnly(_ReadOnly); }
virtual bool IsReadOnly() const { for(size_t i=0; i<m_Vars.size(); ++i) if(m_Vars[i] && !m_Vars[i]->IsReadOnly()) return false; return true; }
CTwVarGroup() { m_Open=false; m_StructType=TW_TYPE_UNDEF; m_SummaryCallback=NULL; m_SummaryClientData=NULL; m_StructValuePtr=NULL; }
virtual ~CTwVarGroup();
};
// ---------------------------------------------------------------------------
struct CTwBar
{
std::string m_Name;
std::string m_Label;
std::string m_Help;
bool m_Visible;
int m_PosX;
int m_PosY;
int m_Width;
int m_Height;
color32 m_Color;
bool m_DarkText;
const CTexFont * m_Font;
int m_ValuesWidth;
int m_Sep;
int m_LineSep;
int m_FirstLine;
float m_UpdatePeriod;
bool m_IsHelpBar;
int m_MinNumber; // accessed by TwDeleteBar
bool m_IsPopupList;
CTwVarAtom * m_VarEnumLinkedToPopupList;
CTwBar * m_BarLinkedToPopupList;
bool m_Resizable;
bool m_Movable;
bool m_Iconifiable;
bool m_Contained;
CTwVarGroup m_VarRoot;
enum EDrawPart { DRAW_BG=(1<<0), DRAW_CONTENT=(1<<1), DRAW_ALL=DRAW_BG|DRAW_CONTENT };
void Draw(int _DrawPart=DRAW_ALL);
void NotUpToDate();
const CTwVar * Find(const char *_Name, CTwVarGroup **_Parent=NULL, int *_Index=NULL) const;
CTwVar * Find(const char *_Name, CTwVarGroup **_Parent=NULL, int *_Index=NULL);
int HasAttrib(const char *_Attrib, bool *_HasValue) const;
int SetAttrib(int _AttribID, const char *_Value);
ERetType GetAttrib(int _AttribID, std::vector<double>& outDouble, std::ostringstream& outString) const;
bool MouseMotion(int _X, int _Y);
bool MouseButton(ETwMouseButtonID _Button, bool _Pressed, int _X, int _Y);
bool MouseWheel(int _Pos, int _PrevPos, int _MouseX, int _MouseY);
bool KeyPressed(int _Key, int _Modifiers);
bool KeyTest(int _Key, int _Modifiers);
bool IsMinimized() const { return m_IsMinimized; }
bool IsDragging() const { return m_MouseDrag; }
bool Show(CTwVar *_Var); // display the line associated to _Var
bool OpenHier(CTwVarGroup *_Root, CTwVar *_Var); // open a hierarchy if it contains _Var
int LineInHier(CTwVarGroup *_Root, CTwVar *_Var); // returns the number of the line associated to _Var
void UnHighlightLine() { m_HighlightedLine = -1; NotUpToDate(); } // used by PopupCallback
void HaveFocus(bool _Focus) { m_DrawHandles = _Focus; } // used by PopupCallback
void StopEditInPlace() { if( m_EditInPlace.m_Active ) EditInPlaceEnd(false); }
CTwBar(const char *_Name);
~CTwBar();
color32 m_ColBg, m_ColBg1, m_ColBg2;
color32 m_ColHighBg0;
color32 m_ColHighBg1;
color32 m_ColLabelText;
color32 m_ColStructText;
color32 m_ColValBg;
color32 m_ColValText;
color32 m_ColValTextRO;
color32 m_ColValTextNE;
color32 m_ColValMin;
color32 m_ColValMax;
color32 m_ColStructBg;
color32 m_ColTitleBg;
color32 m_ColTitleHighBg;
color32 m_ColTitleUnactiveBg;
color32 m_ColTitleText;
color32 m_ColTitleShadow;
color32 m_ColLine;
color32 m_ColLineShadow;
color32 m_ColUnderline;
color32 m_ColBtn;
color32 m_ColHighBtn;
color32 m_ColFold;
color32 m_ColHighFold;
color32 m_ColGrpBg;
color32 m_ColGrpText;
color32 m_ColHierBg;
color32 m_ColShortcutText;
color32 m_ColShortcutBg;
color32 m_ColInfoText;
color32 m_ColHelpBg;
color32 m_ColHelpText;
color32 m_ColRoto;
color32 m_ColRotoVal;
color32 m_ColRotoBound;
color32 m_ColEditBg;
color32 m_ColEditText;
color32 m_ColEditSelBg;
color32 m_ColEditSelText;
color32 m_ColSeparator;
color32 m_ColStaticText;
void UpdateColors();
protected:
int m_TitleWidth;
int m_VarX0;
int m_VarX1;
int m_VarX2;
int m_VarY0;
int m_VarY1;
int m_VarY2;
int m_ScrollYW;
int m_ScrollYH;
int m_ScrollY0;
int m_ScrollY1;
int m_NbHierLines;
int m_NbDisplayedLines;
bool m_UpToDate;
float m_LastUpdateTime;
void Update();
bool m_MouseDrag;
bool m_MouseDragVar;
bool m_MouseDragTitle;
bool m_MouseDragScroll;
bool m_MouseDragResizeUR;
bool m_MouseDragResizeUL;
bool m_MouseDragResizeLR;
bool m_MouseDragResizeLL;
bool m_MouseDragValWidth;
int m_MouseOriginX;
int m_MouseOriginY;
double m_ValuesWidthRatio;
bool m_VarHasBeenIncr;
int m_FirstLine0;
int m_HighlightedLine;
int m_HighlightedLinePrev;
int m_HighlightedLineLastValid;
bool m_HighlightIncrBtn;
bool m_HighlightDecrBtn;
bool m_HighlightRotoBtn;
bool m_HighlightListBtn;
bool m_HighlightBoolBtn;
bool m_HighlightClickBtn;
double m_HighlightClickBtnAuto;
bool m_HighlightTitle;
bool m_HighlightScroll;
bool m_HighlightUpScroll;
bool m_HighlightDnScroll;
bool m_HighlightMinimize;
bool m_HighlightFont;
bool m_HighlightValWidth;
bool m_HighlightLabelsHeader;
bool m_HighlightValuesHeader;
bool m_DrawHandles;
bool m_IsMinimized;
int m_MinPosX;
int m_MinPosY;
bool m_HighlightMaximize;
bool m_DrawIncrDecrBtn;
bool m_DrawRotoBtn;
bool m_DrawClickBtn;
bool m_DrawListBtn;
bool m_DrawBoolBtn;
EButtonAlign m_ButtonAlign;
struct CHierTag
{
CTwVar * m_Var;
int m_Level;
bool m_Closing;
};
std::vector<CHierTag> m_HierTags;
void BrowseHierarchy(int *_LineNum, int _CurrLevel, const CTwVar *_Var, int _First, int _Last);
void * m_TitleTextObj;
void * m_LabelsTextObj;
void * m_ValuesTextObj;
void * m_ShortcutTextObj;
int m_ShortcutLine;
void * m_HeadersTextObj;
void ListLabels(std::vector<std::string>& _Labels, std::vector<color32>& _Colors, std::vector<color32>& _BgColors, bool *_HasBgColors, const CTexFont *_Font, int _AtomWidthMax, int _GroupWidthMax);
void ListValues(std::vector<std::string>& _Values, std::vector<color32>& _Colors, std::vector<color32>& _BgColors, const CTexFont *_Font, int _WidthMax);
int ComputeLabelsWidth(const CTexFont *_Font);
int ComputeValuesWidth(const CTexFont *_Font);
void DrawHierHandle();
enum EValuesWidthFit { VALUES_WIDTH_FIT = -5555 };
// RotoSlider
struct CPoint
{
int x, y;
CPoint() {}
CPoint(int _X, int _Y):x(_X), y(_Y) {}
const CPoint operator+ (const CPoint& p) const { return CPoint(x+p.x, y+p.y); }
const CPoint operator- (const CPoint& p) const { return CPoint(x-p.x, y-p.y); }
};
struct CRotoSlider
{
CRotoSlider();
CTwVarAtom * m_Var;
double m_PreciseValue;
double m_CurrentValue;
double m_Value0;
double m_ValueAngle0;
bool m_Active;
bool m_ActiveMiddle;
CPoint m_Origin;
CPoint m_Current;
bool m_HasPrevious;
CPoint m_Previous;
double m_Angle0;
double m_AngleDT;
int m_Subdiv;
};
CRotoSlider m_Roto;
int m_RotoMinRadius;
int m_RotoNbSubdiv; // number of steps for one turn
void RotoDraw();
void RotoOnMouseMove(int _X, int _Y);
void RotoOnLButtonDown(int _X, int _Y);
void RotoOnLButtonUp(int _X, int _Y);
void RotoOnMButtonDown(int _X, int _Y);
void RotoOnMButtonUp(int _X, int _Y);
double RotoGetValue() const;
void RotoSetValue(double _Val);
double RotoGetMin() const;
double RotoGetMax() const;
double RotoGetStep() const;
double RotoGetSteppedValue() const;
// Edit-in-place
struct CEditInPlace
{
CEditInPlace();
~CEditInPlace();
CTwVarAtom * m_Var;
bool m_Active;
std::string m_String;
void * m_EditTextObj;
void * m_EditSelTextObj;
int m_CaretPos;
int m_SelectionStart;
int m_X, m_Y;
int m_Width;
int m_FirstChar;
std::string m_Clipboard;
};
CEditInPlace m_EditInPlace;
void EditInPlaceDraw();
bool EditInPlaceAcceptVar(const CTwVarAtom* _Var);
bool EditInPlaceIsReadOnly();
void EditInPlaceStart(CTwVarAtom* _Var, int _X, int _Y, int _Width);
void EditInPlaceEnd(bool _Commit);
bool EditInPlaceKeyPressed(int _Key, int _Modifiers);
bool EditInPlaceEraseSelect();
bool EditInPlaceMouseMove(int _X, int _Y, bool _Select);
bool EditInPlaceSetClipboard(const std::string& _String);
bool EditInPlaceGetClipboard(std::string *_OutString);
struct CCustomRecord
{
int m_IndexMin;
int m_IndexMax;
int m_XMin, m_XMax;
int m_YMin, m_YMax; // Y visible range
int m_Y0, m_Y1; // Y widget range
CTwVarGroup * m_Var;
};
typedef std::map<CTwMgr::CStructProxy*, CCustomRecord> CustomMap;
CustomMap m_CustomRecords;
CTwMgr::CStructProxy * m_CustomActiveStructProxy;
friend struct CTwMgr;
};
void DrawArc(int _X, int _Y, int _Radius, float _StartAngleDeg, float _EndAngleDeg, color32 _Color);
// ---------------------------------------------------------------------------
#endif // !defined ANT_TW_BAR_INCLUDED

View File

@@ -0,0 +1,153 @@
// ---------------------------------------------------------------------------
//
// @file TwColors.cpp
// @author Philippe Decaudin
// @license This file is part of the AntTweakBar library.
// For conditions of distribution and use, see License.txt
//
// ---------------------------------------------------------------------------
#include "TwPrecomp.h"
#include "TwColors.h"
void ColorRGBToHLSf(float _R, float _G, float _B, float *_Hue, float *_Light, float *_Saturation)
{
// Compute HLS from RGB. The r,g,b triplet is between [0,1],
// hue is between [0,360], light and saturation are [0,1].
float rnorm, gnorm, bnorm, minval, maxval, msum, mdiff, r, g, b;
r = g = b = 0;
if(_R>0) r = _R; if(r>1) r = 1;
if(_G>0) g = _G; if(g>1) g = 1;
if(_B>0) b = _B; if(b>1) b = 1;
minval = r;
if(g<minval) minval = g;
if(b<minval) minval = b;
maxval = r;
if(g>maxval) maxval = g;
if(b>maxval) maxval = b;
rnorm = gnorm = bnorm = 0;
mdiff = maxval - minval;
msum = maxval + minval;
float l = 0.5f * msum;
if(_Light)
*_Light = l;
if(maxval!=minval)
{
rnorm = (maxval - r)/mdiff;
gnorm = (maxval - g)/mdiff;
bnorm = (maxval - b)/mdiff;
}
else
{
if(_Saturation)
*_Saturation = 0;
if(_Hue)
*_Hue = 0;
return;
}
if(_Saturation)
{
if(l<0.5f)
*_Saturation = mdiff/msum;
else
*_Saturation = mdiff/(2.0f - msum);
}
if(_Hue)
{
if(r==maxval)
*_Hue = 60.0f * (6.0f + bnorm - gnorm);
else if(g==maxval)
*_Hue = 60.0f * (2.0f + rnorm - bnorm);
else
*_Hue = 60.0f * (4.0f + gnorm - rnorm);
if(*_Hue>360.0f)
*_Hue -= 360.0f;
}
}
void ColorRGBToHLSi(int _R, int _G, int _B, int *_Hue, int *_Light, int *_Saturation)
{
float h, l, s;
ColorRGBToHLSf((1.0f/255.0f)*float(_R), (1.0f/255.0f)*float(_G), (1.0f/255.0f)*float(_B), &h, &l, &s);
if(_Hue) *_Hue = (int)TClamp(h*(256.0f/360.0f), 0.0f, 255.0f);
if(_Light) *_Light = (int)TClamp(l*256.0f, 0.0f, 255.0f);
if(_Saturation) *_Saturation= (int)TClamp(s*256.0f, 0.0f, 255.0f);
}
void ColorHLSToRGBf(float _Hue, float _Light, float _Saturation, float *_R, float *_G, float *_B)
{
// Compute RGB from HLS. The light and saturation are between [0,1]
// and hue is between [0,360]. The returned r,g,b triplet is between [0,1].
// a local auxiliary function
struct CLocal
{
static float HLSToRGB(float _Rn1, float _Rn2, float _Huei)
{
float hue = _Huei;
if(hue>360) hue = hue - 360;
if(hue<0) hue = hue + 360;
if(hue<60 ) return _Rn1 + (_Rn2-_Rn1)*hue/60;
if(hue<180) return _Rn2;
if(hue<240) return _Rn1 + (_Rn2-_Rn1)*(240-hue)/60;
return _Rn1;
}
};
float rh, rl, rs, rm1, rm2;
rh = rl = rs = 0;
if(_Hue>0) rh = _Hue; if(rh>360) rh = 360;
if(_Light>0) rl = _Light; if(rl>1) rl = 1;
if(_Saturation>0) rs = _Saturation; if(rs>1) rs = 1;
if(rl<=0.5f)
rm2 = rl*(1.0f + rs);
else
rm2 = rl + rs - rl*rs;
rm1 = 2.0f*rl - rm2;
if(!rs)
{
if(_R) *_R = rl;
if(_G) *_G = rl;
if(_B) *_B = rl;
}
else
{
if(_R) *_R = CLocal::HLSToRGB(rm1, rm2, rh+120);
if(_G) *_G = CLocal::HLSToRGB(rm1, rm2, rh);
if(_B) *_B = CLocal::HLSToRGB(rm1, rm2, rh-120);
}
}
void ColorHLSToRGBi(int _Hue, int _Light, int _Saturation, int *_R, int *_G, int *_B)
{
float r, g, b;
ColorHLSToRGBf((360.0f/255.0f)*float(_Hue), (1.0f/255.0f)*float(_Light), (1.0f/255.0f)*float(_Saturation), &r, &g, &b);
if(_R) *_R = (int)TClamp(r*256.0f, 0.0f, 255.0f);
if(_G) *_G = (int)TClamp(g*256.0f, 0.0f, 255.0f);
if(_B) *_B = (int)TClamp(b*256.0f, 0.0f, 255.0f);
}
color32 ColorBlend(color32 _Color1, color32 _Color2, float _S)
{
float a1, r1, g1, b1, a2, r2, g2, b2;
Color32ToARGBf(_Color1, &a1, &r1, &g1, &b1);
Color32ToARGBf(_Color2, &a2, &r2, &g2, &b2);
float t = 1.0f-_S;
return Color32FromARGBf(t*a1+_S*a2, t*r1+_S*r2, t*g1+_S*g2, t*b1+_S*b2);
}

View File

@@ -0,0 +1,80 @@
// ---------------------------------------------------------------------------
//
// @file TwColors.h
// @brief Color conversions
// @author Philippe Decaudin
// @license This file is part of the AntTweakBar library.
// For conditions of distribution and use, see License.txt
//
// note: Private header
//
// ---------------------------------------------------------------------------
#if !defined ANT_TW_COLORS_INCLUDED
#define ANT_TW_COLORS_INCLUDED
// ---------------------------------------------------------------------------
typedef unsigned int color32;
const color32 COLOR32_BLACK = 0xff000000; // Black
const color32 COLOR32_WHITE = 0xffffffff; // White
const color32 COLOR32_ZERO = 0x00000000; // Zero
const color32 COLOR32_RED = 0xffff0000; // Red
const color32 COLOR32_GREEN = 0xff00ff00; // Green
const color32 COLOR32_BLUE = 0xff0000ff; // Blue
template <typename _T> inline const _T& TClamp(const _T& _X, const _T& _Limit1, const _T& _Limit2)
{
if( _Limit1<_Limit2 )
return (_X<=_Limit1) ? _Limit1 : ( (_X>=_Limit2) ? _Limit2 : _X );
else
return (_X<=_Limit2) ? _Limit2 : ( (_X>=_Limit1) ? _Limit1 : _X );
}
inline color32 Color32FromARGBi(int _A, int _R, int _G, int _B)
{
return (((color32)TClamp(_A, 0, 255))<<24) | (((color32)TClamp(_R, 0, 255))<<16) | (((color32)TClamp(_G, 0, 255))<<8) | ((color32)TClamp(_B, 0, 255));
}
inline color32 Color32FromARGBf(float _A, float _R, float _G, float _B)
{
return (((color32)TClamp(_A*256.0f, 0.0f, 255.0f))<<24) | (((color32)TClamp(_R*256.0f, 0.0f, 255.0f))<<16) | (((color32)TClamp(_G*256.0f, 0.0f, 255.0f))<<8) | ((color32)TClamp(_B*256.0f, 0.0f, 255.0f));
}
inline void Color32ToARGBi(color32 _Color, int *_A, int *_R, int *_G, int *_B)
{
if(_A) *_A = (_Color>>24)&0xff;
if(_R) *_R = (_Color>>16)&0xff;
if(_G) *_G = (_Color>>8)&0xff;
if(_B) *_B = _Color&0xff;
}
inline void Color32ToARGBf(color32 _Color, float *_A, float *_R, float *_G, float *_B)
{
if(_A) *_A = (1.0f/255.0f)*float((_Color>>24)&0xff);
if(_R) *_R = (1.0f/255.0f)*float((_Color>>16)&0xff);
if(_G) *_G = (1.0f/255.0f)*float((_Color>>8)&0xff);
if(_B) *_B = (1.0f/255.0f)*float(_Color&0xff);
}
void ColorRGBToHLSf(float _R, float _G, float _B, float *_Hue, float *_Light, float *_Saturation);
void ColorRGBToHLSi(int _R, int _G, int _B, int *_Hue, int *_Light, int *_Saturation);
void ColorHLSToRGBf(float _Hue, float _Light, float _Saturation, float *_R, float *_G, float *_B);
void ColorHLSToRGBi(int _Hue, int _Light, int _Saturation, int *_R, int *_G, int *_B);
color32 ColorBlend(color32 _Color1, color32 _Color2, float _S);
// ---------------------------------------------------------------------------
#endif // !defined ANT_TW_COLORS_INCLUDED

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,108 @@
// ---------------------------------------------------------------------------
//
// @file TwDirect3D10.h
// @brief Direct3D10 graph functions
// @author Philippe Decaudin
// @license This file is part of the AntTweakBar library.
// For conditions of distribution and use, see License.txt
//
// note: Private header
//
// ---------------------------------------------------------------------------
#if !defined ANT_TW_DIRECT3D10_INCLUDED
#define ANT_TW_DIRECT3D10_INCLUDED
#include "TwGraph.h"
// ---------------------------------------------------------------------------
class CTwGraphDirect3D10 : public ITwGraph
{
public:
virtual int Init();
virtual int Shut();
virtual void BeginDraw(int _WndWidth, int _WndHeight);
virtual void EndDraw();
virtual bool IsDrawing();
virtual void Restore();
virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color0, color32 _Color1, bool _AntiAliased=false);
virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color, bool _AntiAliased=false) { DrawLine(_X0, _Y0, _X1, _Y1, _Color, _Color, _AntiAliased); }
virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11);
virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color) { DrawRect(_X0, _Y0, _X1, _Y1, _Color, _Color, _Color, _Color); }
virtual void DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode);
virtual void * NewTextObj();
virtual void DeleteTextObj(void *_TextObj);
virtual void BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth);
virtual void DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor);
virtual void ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY);
virtual void RestoreViewport();
virtual void SetScissor(int _X0, int _Y0, int _Width, int _Height);
protected:
struct ID3D10Device * m_D3DDev;
unsigned int m_D3DDevInitialRefCount;
bool m_Drawing;
const CTexFont * m_FontTex;
struct ID3D10ShaderResourceView *m_FontD3DTexRV;
int m_WndWidth;
int m_WndHeight;
int m_OffsetX;
int m_OffsetY;
void * m_ViewportInit;
RECT m_ViewportAndScissorRects[2];
struct CLineRectVtx
{
float m_Pos[3];
color32 m_Color;
};
struct CTextVtx
{
float m_Pos[3];
color32 m_Color;
float m_UV[2];
};
struct CTextObj
{
struct ID3D10Buffer * m_TextVertexBuffer;
struct ID3D10Buffer * m_BgVertexBuffer;
int m_NbTextVerts;
int m_NbBgVerts;
int m_TextVertexBufferSize;
int m_BgVertexBufferSize;
bool m_LineColors;
bool m_LineBgColors;
};
struct CState10 * m_State;
struct ID3D10DepthStencilState *m_DepthStencilState;
struct ID3D10BlendState * m_BlendState;
struct ID3D10RasterizerState * m_RasterState;
struct ID3D10RasterizerState * m_RasterStateAntialiased;
struct ID3D10RasterizerState * m_RasterStateCullCW;
struct ID3D10RasterizerState * m_RasterStateCullCCW;
struct ID3D10Effect * m_Effect;
struct ID3D10EffectTechnique* m_LineRectTech;
struct ID3D10EffectTechnique* m_LineRectCstColorTech;
struct ID3D10InputLayout * m_LineRectVertexLayout;
struct ID3D10Buffer * m_LineVertexBuffer;
struct ID3D10Buffer * m_RectVertexBuffer;
struct ID3D10Buffer * m_TrianglesVertexBuffer;
int m_TrianglesVertexBufferCount;
struct ID3D10EffectTechnique* m_TextTech;
struct ID3D10EffectTechnique* m_TextCstColorTech;
struct ID3D10InputLayout * m_TextVertexLayout;
struct ID3D10EffectShaderResourceVariable *m_FontD3DResVar;
struct ID3D10EffectVectorVariable *m_OffsetVar;
struct ID3D10EffectVectorVariable *m_CstColorVar;
};
// ---------------------------------------------------------------------------
#endif // !defined ANT_TW_DIRECT3D10_INCLUDED

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,117 @@
// ---------------------------------------------------------------------------
//
// @file TwDirect3D11.h
// @brief Direct3D11 graphic functions
// @author Philippe Decaudin
// @license This file is part of the AntTweakBar library.
// For conditions of distribution and use, see License.txt
//
// note: Private header
//
// ---------------------------------------------------------------------------
#if !defined ANT_TW_DIRECT3D11_INCLUDED
#define ANT_TW_DIRECT3D11_INCLUDED
#include "TwGraph.h"
// ---------------------------------------------------------------------------
class CTwGraphDirect3D11 : public ITwGraph
{
public:
virtual int Init();
virtual int Shut();
virtual void BeginDraw(int _WndWidth, int _WndHeight);
virtual void EndDraw();
virtual bool IsDrawing();
virtual void Restore();
virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color0, color32 _Color1, bool _AntiAliased=false);
virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color, bool _AntiAliased=false) { DrawLine(_X0, _Y0, _X1, _Y1, _Color, _Color, _AntiAliased); }
virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11);
virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color) { DrawRect(_X0, _Y0, _X1, _Y1, _Color, _Color, _Color, _Color); }
virtual void DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode);
virtual void * NewTextObj();
virtual void DeleteTextObj(void *_TextObj);
virtual void BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth);
virtual void DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor);
virtual void ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY);
virtual void RestoreViewport();
virtual void SetScissor(int _X0, int _Y0, int _Width, int _Height);
protected:
struct ID3D11Device * m_D3DDev;
struct ID3D11DeviceContext *m_D3DDevImmContext;
unsigned int m_D3DDevInitialRefCount;
bool m_Drawing;
const CTexFont * m_FontTex;
struct ID3D11Texture2D * m_FontD3DTex;
struct ID3D11ShaderResourceView *m_FontD3DTexRV;
int m_WndWidth;
int m_WndHeight;
int m_OffsetX;
int m_OffsetY;
void * m_ViewportInit;
RECT m_ViewportAndScissorRects[2];
struct CLineRectVtx
{
float m_Pos[3];
color32 m_Color;
};
struct CTextVtx
{
float m_Pos[3];
color32 m_Color;
float m_UV[2];
};
struct CConstants
{
float m_Offset[4];
float m_CstColor[4];
};
struct CTextObj
{
struct ID3D11Buffer * m_TextVertexBuffer;
struct ID3D11Buffer * m_BgVertexBuffer;
int m_NbTextVerts;
int m_NbBgVerts;
int m_TextVertexBufferSize;
int m_BgVertexBufferSize;
bool m_LineColors;
bool m_LineBgColors;
};
struct CState11 * m_State;
struct ID3D11DepthStencilState *m_DepthStencilState;
struct ID3D11BlendState * m_BlendState;
struct ID3D11RasterizerState * m_RasterState;
struct ID3D11RasterizerState * m_RasterStateAntialiased;
struct ID3D11RasterizerState * m_RasterStateMultisample;
struct ID3D11RasterizerState * m_RasterStateCullCW;
struct ID3D11RasterizerState * m_RasterStateCullCCW;
struct ID3D11VertexShader * m_LineRectVS;
struct ID3D11VertexShader * m_LineRectCstColorVS;
struct ID3D11PixelShader * m_LineRectPS;
struct ID3D11InputLayout * m_LineRectVertexLayout;
struct ID3D11VertexShader * m_TextVS;
struct ID3D11VertexShader * m_TextCstColorVS;
struct ID3D11PixelShader * m_TextPS;
struct ID3D11InputLayout * m_TextVertexLayout;
struct ID3D11Buffer * m_LineVertexBuffer;
struct ID3D11Buffer * m_RectVertexBuffer;
struct ID3D11Buffer * m_TrianglesVertexBuffer;
int m_TrianglesVertexBufferCount;
struct ID3D11Buffer * m_ConstantBuffer;
struct ID3D11SamplerState * m_SamplerState;
};
// ---------------------------------------------------------------------------
#endif // !defined ANT_TW_DIRECT3D11_INCLUDED

View File

@@ -0,0 +1,83 @@
// ---------------------------------------------------------------------------
//
// @file TwDirect3D11.hlsl
// @author Philippe Decaudin
// @brief AntTweakBar shaders and techniques for Direct3D11 support
// @license This file is part of the AntTweakBar library.
// For conditions of distribution and use, see License.txt
//
// ---------------------------------------------------------------------------
float4 g_Offset : register(c0) = 0;
float4 g_CstColor : register(c1) = 1;
// Shaders for lines and rectangles
struct LineRectPSInput
{
float4 Pos : SV_POSITION;
float4 Color : COLOR0;
};
LineRectPSInput LineRectVS(float4 pos : POSITION, float4 color : COLOR)
{
LineRectPSInput ps;
ps.Pos = pos + g_Offset;
ps.Color = color;
return ps;
}
LineRectPSInput LineRectCstColorVS(float4 pos : POSITION, float4 color : COLOR)
{
LineRectPSInput ps;
ps.Pos = pos + g_Offset;
ps.Color = g_CstColor;
return ps;
}
float4 LineRectPS(LineRectPSInput input) : SV_TARGET
{
return input.Color;
}
// Shaders for text
Texture2D g_Font : register(t0);
SamplerState g_FontSampler : register(s0)
{
Filter = MIN_MAG_MIP_POINT;
AddressU = BORDER;
AddressV = BORDER;
BorderColor = float4(0, 0, 0, 0);
};
struct TextPSInput
{
float4 Pos : SV_POSITION;
float4 Color : COLOR0;
float2 Tex : TEXCOORD0;
};
TextPSInput TextVS(float4 pos : POSITION, float4 color : COLOR, float2 tex : TEXCOORD0)
{
TextPSInput ps;
ps.Pos = pos + g_Offset;
ps.Color = color;
ps.Tex = tex;
return ps;
}
TextPSInput TextCstColorVS(float4 pos : POSITION, float4 color : COLOR, float2 tex : TEXCOORD0)
{
TextPSInput ps;
ps.Pos = pos + g_Offset;
ps.Color = g_CstColor;
ps.Tex = tex;
return ps;
}
float4 TextPS(TextPSInput input) : SV_TARGET
{
return g_Font.Sample(g_FontSampler, input.Tex) * input.Color;
}

View File

@@ -0,0 +1,640 @@
// ---------------------------------------------------------------------------
//
// @file TwDirect3D9.cpp
// @author Philippe Decaudin
// @license This file is part of the AntTweakBar library.
// For conditions of distribution and use, see License.txt
//
// ---------------------------------------------------------------------------
#include "TwPrecomp.h"
#include "TwDirect3D9.h"
#include "TwMgr.h"
#include <d3d9.h>
#ifdef _DEBUG
// #include <dxerr9.h>
// #pragma comment(lib, "dxerr9")
#endif // _DEBUG
using namespace std;
const char *g_ErrCantLoadD3D9 = "Cannot load Direct3D9 library dynamically";
const char *g_ErrCantUnloadD3D9 = "Cannot unload Direct3D9 library";
// ---------------------------------------------------------------------------
static IDirect3DTexture9 *BindFont(IDirect3DDevice9 *_Dev, const CTexFont *_Font)
{
assert(_Font!=NULL);
IDirect3DTexture9 *Tex = NULL;
IDirect3DDevice9Ex *D3DDev9Ex = NULL;
bool IsD3DDev9Ex = SUCCEEDED(_Dev->QueryInterface(__uuidof(IDirect3DDevice9Ex), (void **)&D3DDev9Ex)) && D3DDev9Ex != NULL;
HRESULT hr;
if (IsD3DDev9Ex)
{
hr = _Dev->CreateTexture(_Font->m_TexWidth, _Font->m_TexHeight, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &Tex, NULL);
D3DDev9Ex->Release();
}
else
hr = _Dev->CreateTexture(_Font->m_TexWidth, _Font->m_TexHeight, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &Tex, NULL);
if( FAILED(hr) )
return NULL;
D3DLOCKED_RECT r;
hr = Tex->LockRect(0, &r, NULL, 0);
if( SUCCEEDED(hr) )
{
color32 *p = static_cast<color32 *>(r.pBits);
for( int i=0; i<_Font->m_TexWidth*_Font->m_TexHeight; ++i, ++p )
*p = 0x00ffffff | (((color32)(_Font->m_TexBytes[i]))<<24);
Tex->UnlockRect(0);
}
return Tex;
}
// ---------------------------------------------------------------------------
static void UnbindFont(IDirect3DDevice9 *_Dev, IDirect3DTexture9 *_Tex)
{
(void)_Dev;
if( _Tex )
_Tex->Release();
}
// ---------------------------------------------------------------------------
struct CState
{
IDirect3DStateBlock9 *m_StateBlock;
// DeviceCaps (filled by constructor)
D3DCAPS9 m_Caps;
void Save();
void Restore();
CState(IDirect3DDevice9 *_Dev);
~CState();
private:
IDirect3DDevice9 *m_D3DDev;
};
CState::CState(IDirect3DDevice9 *_Dev)
{
ZeroMemory(this, sizeof(CState));
m_D3DDev = _Dev;
m_D3DDev->GetDeviceCaps(&m_Caps);
}
CState::~CState()
{
if( m_StateBlock )
{
UINT rc = m_StateBlock->Release();
assert( rc==0 ); (void)rc;
m_StateBlock = NULL;
}
}
void CState::Save()
{
if( !m_StateBlock && m_D3DDev )
m_D3DDev->CreateStateBlock(D3DSBT_ALL, &m_StateBlock);
if( m_StateBlock )
m_StateBlock->Capture();
}
void CState::Restore()
{
if( m_StateBlock )
m_StateBlock->Apply();
}
// ---------------------------------------------------------------------------
int CTwGraphDirect3D9::Init()
{
assert(g_TwMgr->m_Device!=NULL);
m_D3DDev = static_cast<IDirect3DDevice9 *>(g_TwMgr->m_Device);
m_Drawing = false;
m_FontTex = NULL;
m_FontD3DTex = NULL;
D3DDEVICE_CREATION_PARAMETERS cp;
m_D3DDev->GetCreationParameters(&cp);
m_PureDevice = ( cp.BehaviorFlags & D3DCREATE_PUREDEVICE ) ? true : false;
m_WndWidth = 0;
m_WndHeight = 0;
m_State = new CState(m_D3DDev);
m_ViewportInit = new D3DVIEWPORT9;
ZeroMemory(m_ViewportInit, sizeof(D3DVIEWPORT9));
m_OffsetX = 0;
m_OffsetY = 0;
return 1;
}
// ---------------------------------------------------------------------------
int CTwGraphDirect3D9::Shut()
{
assert(m_Drawing==false);
UnbindFont(m_D3DDev, m_FontD3DTex);
m_FontD3DTex = NULL;
delete m_State;
m_State = NULL;
m_D3DDev = NULL;
delete m_ViewportInit;
m_ViewportInit = NULL;
return 1;
}
// ---------------------------------------------------------------------------
void CTwGraphDirect3D9::BeginDraw(int _WndWidth, int _WndHeight)
{
assert(m_Drawing==false && _WndWidth>0 && _WndHeight>0);
m_Drawing = true;
m_WndWidth = _WndWidth;
m_WndHeight = _WndHeight;
m_OffsetX = 0;
m_OffsetY = 0;
// save context
if( !m_PureDevice )
m_State->Save();
if( m_WndWidth>0 && m_WndHeight>0 )
{
D3DVIEWPORT9 Vp;
Vp.X = 0;
Vp.Y = 0;
Vp.Width = m_WndWidth;
Vp.Height = m_WndHeight;
Vp.MinZ = 0;
Vp.MaxZ = 1;
m_D3DDev->SetViewport(&Vp);
//D3DMATRIX Transfo = { 2.0f/_WndWidth,0,0,0, 0,2.0f/_WndHeight,0,0, 0,0,-1,0, 0,0,0,1 };
//m_D3DDev->SetTransform(D3DTS_PROJECTION, &Transfo);
}
m_D3DDev->GetViewport(static_cast<D3DVIEWPORT9 *>(m_ViewportInit));
// const D3DMATRIX id = { 1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 };
// m_D3DDev->SetTransform(D3DTS_VIEW, &id);
// m_D3DDev->SetTransform(D3DTS_WORLD, &id);
// m_D3DDev->SetTransform(D3DTS_TEXTURE0, &id);
m_D3DDev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
m_D3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
m_D3DDev->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
m_D3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
m_D3DDev->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);
m_D3DDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
m_D3DDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
m_D3DDev->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
m_D3DDev->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
m_D3DDev->SetRenderState(D3DRS_LASTPIXEL, FALSE);
m_D3DDev->SetRenderState(D3DRS_FOGENABLE, FALSE);
m_D3DDev->SetRenderState(D3DRS_STENCILENABLE, FALSE);
m_D3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, 0x0000000F);
m_D3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
if( m_State->m_Caps.PrimitiveMiscCaps & D3DPMISCCAPS_SEPARATEALPHABLEND )
m_D3DDev->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, FALSE);
//if( m_State->m_Caps.LineCaps & D3DLINECAPS_ANTIALIAS )
m_D3DDev->SetRenderState(D3DRS_ANTIALIASEDLINEENABLE, FALSE);
m_D3DDev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
m_D3DDev->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
m_D3DDev->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
m_D3DDev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
m_D3DDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
m_D3DDev->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_PASSTHRU);
m_D3DDev->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE);
m_D3DDev->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
m_D3DDev->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
m_D3DDev->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
m_D3DDev->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
m_D3DDev->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
m_D3DDev->SetVertexShader(NULL);
m_D3DDev->SetPixelShader(NULL);
}
// ---------------------------------------------------------------------------
void CTwGraphDirect3D9::EndDraw()
{
assert(m_Drawing==true);
m_Drawing = false;
// restore context
if( !m_PureDevice )
m_State->Restore();
}
// ---------------------------------------------------------------------------
bool CTwGraphDirect3D9::IsDrawing()
{
return m_Drawing;
}
// ---------------------------------------------------------------------------
void CTwGraphDirect3D9::Restore()
{
if( m_State )
if( m_State->m_StateBlock )
{
UINT rc = m_State->m_StateBlock->Release();
assert( rc==0 ); (void)rc;
m_State->m_StateBlock = NULL;
}
UnbindFont(m_D3DDev, m_FontD3DTex);
m_FontD3DTex = NULL;
m_FontTex = NULL;
}
// ---------------------------------------------------------------------------
void CTwGraphDirect3D9::DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color0, color32 _Color1, bool _AntiAliased)
{
assert(m_Drawing==true);
struct CVtx
{
float m_Pos[4];
DWORD m_Color;
};
CVtx p[2];
p[0].m_Pos[0] = (float)(_X0 + m_OffsetX);
p[0].m_Pos[1] = (float)(_Y0 + m_OffsetY);
p[0].m_Pos[2] = 0;
p[0].m_Pos[3] = 0;
p[0].m_Color = _Color0;
p[1].m_Pos[0] = (float)(_X1 + m_OffsetX);
p[1].m_Pos[1] = (float)(_Y1 + m_OffsetY);
p[1].m_Pos[2] = 0;
p[1].m_Pos[3] = 0;
p[1].m_Color = _Color1;
//if( m_State->m_Caps.LineCaps & D3DLINECAPS_ANTIALIAS )
m_D3DDev->SetRenderState(D3DRS_ANTIALIASEDLINEENABLE, (_AntiAliased ? TRUE : FALSE));
m_D3DDev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DISABLE);
m_D3DDev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
m_D3DDev->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE);
m_D3DDev->DrawPrimitiveUP(D3DPT_LINELIST, 1, p, sizeof(CVtx));
//if( m_State->m_Caps.LineCaps & D3DLINECAPS_ANTIALIAS )
m_D3DDev->SetRenderState(D3DRS_ANTIALIASEDLINEENABLE, FALSE);
}
// ---------------------------------------------------------------------------
void CTwGraphDirect3D9::DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11)
{
assert(m_Drawing==true);
// border adjustment
if(_X0<_X1)
++_X1;
else if(_X0>_X1)
++_X0;
if(_Y0<_Y1)
++_Y1;
else if(_Y0>_Y1)
++_Y0;
struct CVtx
{
float m_Pos[4];
DWORD m_Color;
};
CVtx p[4];
p[0].m_Pos[0] = (float)(_X1 + m_OffsetX);
p[0].m_Pos[1] = (float)(_Y0 + m_OffsetY);
p[0].m_Pos[2] = 0;
p[0].m_Pos[3] = 1;
p[0].m_Color = _Color10;
p[1].m_Pos[0] = (float)(_X0 + m_OffsetX);
p[1].m_Pos[1] = (float)(_Y0 + m_OffsetY);
p[1].m_Pos[2] = 0;
p[1].m_Pos[3] = 1;
p[1].m_Color = _Color00;
p[2].m_Pos[0] = (float)(_X1 + m_OffsetX);
p[2].m_Pos[1] = (float)(_Y1 + m_OffsetY);
p[2].m_Pos[2] = 0;
p[2].m_Pos[3] = 1;
p[2].m_Color = _Color11;
p[3].m_Pos[0] = (float)(_X0 + m_OffsetX);
p[3].m_Pos[1] = (float)(_Y1 + m_OffsetY);
p[3].m_Pos[2] = 0;
p[3].m_Pos[3] = 1;
p[3].m_Color = _Color01;
m_D3DDev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DISABLE);
m_D3DDev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
m_D3DDev->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE);
m_D3DDev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, p, sizeof(CVtx));
}
// ---------------------------------------------------------------------------
void *CTwGraphDirect3D9::NewTextObj()
{
return new CTextObj;
}
// ---------------------------------------------------------------------------
void CTwGraphDirect3D9::DeleteTextObj(void *_TextObj)
{
assert(_TextObj!=NULL);
delete static_cast<CTextObj *>(_TextObj);
}
// ---------------------------------------------------------------------------
void CTwGraphDirect3D9::BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth)
{
assert(m_Drawing==true);
assert(_TextObj!=NULL);
assert(_Font!=NULL);
if( _Font != m_FontTex )
{
UnbindFont(m_D3DDev, m_FontD3DTex);
m_FontD3DTex = BindFont(m_D3DDev, _Font);
m_FontTex = _Font;
}
CTextObj *TextObj = static_cast<CTextObj *>(_TextObj);
TextObj->m_TextVerts.resize(0);
TextObj->m_BgVerts.resize(0);
TextObj->m_LineColors = (_LineColors!=NULL);
TextObj->m_LineBgColors = (_LineBgColors!=NULL);
int x, x1, y, y1, i, Len;
unsigned char ch;
const unsigned char *Text;
color32 LineColor = COLOR32_RED;
CTextVtx Vtx;
Vtx.m_Pos[2] = 0;
Vtx.m_Pos[3] = 1;
CBgVtx BgVtx;
BgVtx.m_Pos[2] = 0;
BgVtx.m_Pos[3] = 1;
for( int Line=0; Line<_NbLines; ++Line )
{
x = 0;
y = Line * (_Font->m_CharHeight+_Sep);
y1 = y+_Font->m_CharHeight;
Len = (int)_TextLines[Line].length();
Text = (const unsigned char *)(_TextLines[Line].c_str());
if( _LineColors!=NULL )
LineColor = _LineColors[Line];
for( i=0; i<Len; ++i )
{
ch = Text[i];
x1 = x + _Font->m_CharWidth[ch];
Vtx.m_Color = LineColor;
Vtx.m_Pos[0] = (float)x;
Vtx.m_Pos[1] = (float)y;
Vtx.m_UV [0] = _Font->m_CharU0[ch];
Vtx.m_UV [1] = _Font->m_CharV0[ch];
TextObj->m_TextVerts.push_back(Vtx);
Vtx.m_Pos[0] = (float)x1;
Vtx.m_Pos[1] = (float)y;
Vtx.m_UV [0] = _Font->m_CharU1[ch];
Vtx.m_UV [1] = _Font->m_CharV0[ch];
TextObj->m_TextVerts.push_back(Vtx);
Vtx.m_Pos[0] = (float)x;
Vtx.m_Pos[1] = (float)y1;
Vtx.m_UV [0] = _Font->m_CharU0[ch];
Vtx.m_UV [1] = _Font->m_CharV1[ch];
TextObj->m_TextVerts.push_back(Vtx);
Vtx.m_Pos[0] = (float)x1;
Vtx.m_Pos[1] = (float)y;
Vtx.m_UV [0] = _Font->m_CharU1[ch];
Vtx.m_UV [1] = _Font->m_CharV0[ch];
TextObj->m_TextVerts.push_back(Vtx);
Vtx.m_Pos[0] = (float)x1;
Vtx.m_Pos[1] = (float)y1;
Vtx.m_UV [0] = _Font->m_CharU1[ch];
Vtx.m_UV [1] = _Font->m_CharV1[ch];
TextObj->m_TextVerts.push_back(Vtx);
Vtx.m_Pos[0] = (float)x;
Vtx.m_Pos[1] = (float)y1;
Vtx.m_UV [0] = _Font->m_CharU0[ch];
Vtx.m_UV [1] = _Font->m_CharV1[ch];
TextObj->m_TextVerts.push_back(Vtx);
x = x1;
}
if( _BgWidth>0 )
{
if( _LineBgColors!=NULL )
BgVtx.m_Color = _LineBgColors[Line];
else
BgVtx.m_Color = COLOR32_BLACK;
BgVtx.m_Pos[0] = -1;
BgVtx.m_Pos[1] = (float)y;
TextObj->m_BgVerts.push_back(BgVtx);
BgVtx.m_Pos[0] = (float)(_BgWidth+1);
BgVtx.m_Pos[1] = (float)y;
TextObj->m_BgVerts.push_back(BgVtx);
BgVtx.m_Pos[0] = -1;
BgVtx.m_Pos[1] = (float)y1;
TextObj->m_BgVerts.push_back(BgVtx);
BgVtx.m_Pos[0] = (float)(_BgWidth+1);
BgVtx.m_Pos[1] = (float)y;
TextObj->m_BgVerts.push_back(BgVtx);
BgVtx.m_Pos[0] = (float)(_BgWidth+1);
BgVtx.m_Pos[1] = (float)y1;
TextObj->m_BgVerts.push_back(BgVtx);
BgVtx.m_Pos[0] = -1;
BgVtx.m_Pos[1] = (float)y1;
TextObj->m_BgVerts.push_back(BgVtx);
}
}
}
// ---------------------------------------------------------------------------
void CTwGraphDirect3D9::DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor)
{
assert(m_Drawing==true);
assert(_TextObj!=NULL);
CTextObj *TextObj = static_cast<CTextObj *>(_TextObj);
float x = (float)_X;
float y = (float)_Y;
int i;
int nv = (int)TextObj->m_TextVerts.size();
int nb = (int)TextObj->m_BgVerts.size();
if( nb>=4 )
{
for( i=0; i<nb; ++i )
{
TextObj->m_BgVerts[i].m_Pos[0] += x + m_OffsetX;
TextObj->m_BgVerts[i].m_Pos[1] += y + m_OffsetY;
if( _BgColor!=0 || !TextObj->m_LineBgColors )
TextObj->m_BgVerts[i].m_Color = _BgColor;
}
m_D3DDev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DISABLE);
m_D3DDev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
m_D3DDev->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE);
m_D3DDev->DrawPrimitiveUP(D3DPT_TRIANGLELIST, nb/3, &(TextObj->m_BgVerts[0]), sizeof(CBgVtx));
for( i=0; i<nb; ++i )
{
TextObj->m_BgVerts[i].m_Pos[0] -= x + m_OffsetX;
TextObj->m_BgVerts[i].m_Pos[1] -= y + m_OffsetY;
}
}
if( nv>=4 )
{
for( i=0; i<nv; ++i )
{
TextObj->m_TextVerts[i].m_Pos[0] += x + m_OffsetX;
TextObj->m_TextVerts[i].m_Pos[1] += y + m_OffsetY;
}
if( _Color!=0 || !TextObj->m_LineColors )
for( i=0; i<nv; ++i )
TextObj->m_TextVerts[i].m_Color = _Color;
m_D3DDev->SetTexture(0, m_FontD3DTex);
m_D3DDev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
m_D3DDev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
m_D3DDev->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1|D3DFVF_TEXCOORDSIZE2(0));
m_D3DDev->DrawPrimitiveUP(D3DPT_TRIANGLELIST, nv/3, &(TextObj->m_TextVerts[0]), sizeof(CTextVtx));
for( i=0; i<nv; ++i )
{
TextObj->m_TextVerts[i].m_Pos[0] -= x + m_OffsetX;
TextObj->m_TextVerts[i].m_Pos[1] -= y + m_OffsetY;
}
}
}
// ---------------------------------------------------------------------------
void CTwGraphDirect3D9::ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY)
{
if( _Width>0 && _Height>0 )
{
D3DVIEWPORT9 Vp;
Vp.X = _X0;
Vp.Y = _Y0;
Vp.Width = _Width;
Vp.Height = _Height;
Vp.MinZ = 0;
Vp.MaxZ = 1;
m_D3DDev->SetViewport(&Vp);
m_OffsetX = _X0 + _OffsetX;
m_OffsetY = _Y0 + _OffsetY - 1;
}
}
// ---------------------------------------------------------------------------
void CTwGraphDirect3D9::RestoreViewport()
{
m_D3DDev->SetViewport(static_cast<D3DVIEWPORT9 *>(m_ViewportInit));
m_OffsetX = m_OffsetY = 0;
}
// ---------------------------------------------------------------------------
void CTwGraphDirect3D9::SetScissor(int _X0, int _Y0, int _Width, int _Height)
{
if( _Width>0 && _Height>0 )
{
RECT Rect;
Rect.left = _X0 - 1;
Rect.right = Rect.left + _Width - 1;
Rect.top = _Y0;
Rect.bottom = Rect.top + _Height;
m_D3DDev->SetScissorRect(&Rect);
m_D3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
}
else
m_D3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
}
// ---------------------------------------------------------------------------
void CTwGraphDirect3D9::DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode)
{
assert(m_Drawing==true);
if( _NumTriangles<0 )
return;
DWORD prevCullMode = D3DCULL_NONE;
m_D3DDev->GetRenderState(D3DRS_CULLMODE, &prevCullMode);
if( _CullMode==CULL_CW )
m_D3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);
else if( _CullMode==CULL_CCW )
m_D3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
else
m_D3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
if( (int)m_TriVertices.size()<3*_NumTriangles )
m_TriVertices.resize(3*_NumTriangles);
for( int i=0; i<3*_NumTriangles; ++i )
{
m_TriVertices[i].m_Pos[0] = (float)(_Vertices[2*i+0] + m_OffsetX);
m_TriVertices[i].m_Pos[1] = (float)(_Vertices[2*i+1] + m_OffsetY);
m_TriVertices[i].m_Pos[2] = 0;
m_TriVertices[i].m_Pos[3] = 1;
m_TriVertices[i].m_Color = _Colors[i];
}
m_D3DDev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DISABLE);
m_D3DDev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
m_D3DDev->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE);
m_D3DDev->DrawPrimitiveUP(D3DPT_TRIANGLELIST, _NumTriangles, &(m_TriVertices[0]), sizeof(CTriVtx));
m_D3DDev->SetRenderState(D3DRS_CULLMODE, prevCullMode);
}
// ---------------------------------------------------------------------------

View File

@@ -0,0 +1,90 @@
// ---------------------------------------------------------------------------
//
// @file TwDirect3D9.h
// @brief Direct3D9 graph functions
// @author Philippe Decaudin
// @license This file is part of the AntTweakBar library.
// For conditions of distribution and use, see License.txt
//
// note: Private header
//
// ---------------------------------------------------------------------------
#if !defined ANT_TW_DIRECT3D9_INCLUDED
#define ANT_TW_DIRECT3D9_INCLUDED
#include "TwGraph.h"
// ---------------------------------------------------------------------------
class CTwGraphDirect3D9 : public ITwGraph
{
public:
virtual int Init();
virtual int Shut();
virtual void BeginDraw(int _WndWidth, int _WndHeight);
virtual void EndDraw();
virtual bool IsDrawing();
virtual void Restore();
virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color0, color32 _Color1, bool _AntiAliased=false);
virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color, bool _AntiAliased=false) { DrawLine(_X0, _Y0, _X1, _Y1, _Color, _Color, _AntiAliased); }
virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11);
virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color) { DrawRect(_X0, _Y0, _X1, _Y1, _Color, _Color, _Color, _Color); }
virtual void DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode);
virtual void * NewTextObj();
virtual void DeleteTextObj(void *_TextObj);
virtual void BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth);
virtual void DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor);
virtual void ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY);
virtual void RestoreViewport();
virtual void SetScissor(int _X0, int _Y0, int _Width, int _Height);
protected:
struct IDirect3DDevice9 * m_D3DDev;
bool m_Drawing;
const CTexFont * m_FontTex;
struct IDirect3DTexture9 * m_FontD3DTex;
bool m_PureDevice;
int m_WndWidth;
int m_WndHeight;
void * m_ViewportInit;
int m_OffsetX;
int m_OffsetY;
struct CTextVtx
{
float m_Pos[4];
color32 m_Color;
float m_UV[2];
};
struct CBgVtx
{
float m_Pos[4];
color32 m_Color;
};
struct CTextObj
{
std::vector<CTextVtx> m_TextVerts;
std::vector<CBgVtx> m_BgVerts;
bool m_LineColors;
bool m_LineBgColors;
};
struct CTriVtx
{
float m_Pos[4];
DWORD m_Color;
};
std::vector<CTriVtx> m_TriVertices;
struct CState * m_State;
};
// ---------------------------------------------------------------------------
#endif // !defined ANT_TW_DIRECT3D9_INCLUDED

View File

@@ -0,0 +1,212 @@
// ---------------------------------------------------------------------------
//
// @file TwEventGLFW.c
// @brief Helper:
// translate and re-send mouse and keyboard events
// from GLFW event callbacks to AntTweakBar
//
// @author Philippe Decaudin
// @license This file is part of the AntTweakBar library.
// For conditions of distribution and use, see License.txt
//
// ---------------------------------------------------------------------------
// #include <GL/glfw.h>
#include "MiniGLFW.h" // a subset of GLFW.h needed to compile TwEventGLFW.c
// note: AntTweakBar.dll does not need to link with GLFW,
// it just needs some definitions for its helper functions.
#include <AntTweakBar.h>
int TW_CALL TwEventMouseButtonGLFW(int glfwButton, int glfwAction)
{
int handled = 0;
TwMouseAction action = (glfwAction==GLFW_PRESS) ? TW_MOUSE_PRESSED : TW_MOUSE_RELEASED;
if( glfwButton==GLFW_MOUSE_BUTTON_LEFT )
handled = TwMouseButton(action, TW_MOUSE_LEFT);
else if( glfwButton==GLFW_MOUSE_BUTTON_RIGHT )
handled = TwMouseButton(action, TW_MOUSE_RIGHT);
else if( glfwButton==GLFW_MOUSE_BUTTON_MIDDLE )
handled = TwMouseButton(action, TW_MOUSE_MIDDLE);
return handled;
}
int g_KMod = 0;
int TW_CALL TwEventKeyGLFW(int glfwKey, int glfwAction)
{
int handled = 0;
// Register of modifiers state
if( glfwAction==GLFW_PRESS )
{
switch( glfwKey )
{
case GLFW_KEY_LSHIFT:
case GLFW_KEY_RSHIFT:
g_KMod |= TW_KMOD_SHIFT;
break;
case GLFW_KEY_LCTRL:
case GLFW_KEY_RCTRL:
g_KMod |= TW_KMOD_CTRL;
break;
case GLFW_KEY_LALT:
case GLFW_KEY_RALT:
g_KMod |= TW_KMOD_ALT;
break;
}
}
else
{
switch( glfwKey )
{
case GLFW_KEY_LSHIFT:
case GLFW_KEY_RSHIFT:
g_KMod &= ~TW_KMOD_SHIFT;
break;
case GLFW_KEY_LCTRL:
case GLFW_KEY_RCTRL:
g_KMod &= ~TW_KMOD_CTRL;
break;
case GLFW_KEY_LALT:
case GLFW_KEY_RALT:
g_KMod &= ~TW_KMOD_ALT;
break;
}
}
// Process key pressed
if( glfwAction==GLFW_PRESS )
{
int mod = g_KMod;
int testkp = ((mod&TW_KMOD_CTRL) || (mod&TW_KMOD_ALT)) ? 1 : 0;
if( (mod&TW_KMOD_CTRL) && glfwKey>0 && glfwKey<GLFW_KEY_SPECIAL ) // CTRL cases
handled = TwKeyPressed(glfwKey, mod);
else if( glfwKey>=GLFW_KEY_SPECIAL )
{
int k = 0;
if( glfwKey>=GLFW_KEY_F1 && glfwKey<=GLFW_KEY_F15 )
k = TW_KEY_F1 + (glfwKey-GLFW_KEY_F1);
else if( testkp && glfwKey>=GLFW_KEY_KP_0 && glfwKey<=GLFW_KEY_KP_9 )
k = '0' + (glfwKey-GLFW_KEY_KP_0);
else
{
switch( glfwKey )
{
case GLFW_KEY_ESC:
k = TW_KEY_ESCAPE;
break;
case GLFW_KEY_UP:
k = TW_KEY_UP;
break;
case GLFW_KEY_DOWN:
k = TW_KEY_DOWN;
break;
case GLFW_KEY_LEFT:
k = TW_KEY_LEFT;
break;
case GLFW_KEY_RIGHT:
k = TW_KEY_RIGHT;
break;
case GLFW_KEY_TAB:
k = TW_KEY_TAB;
break;
case GLFW_KEY_ENTER:
k = TW_KEY_RETURN;
break;
case GLFW_KEY_BACKSPACE:
k = TW_KEY_BACKSPACE;
break;
case GLFW_KEY_INSERT:
k = TW_KEY_INSERT;
break;
case GLFW_KEY_DEL:
k = TW_KEY_DELETE;
break;
case GLFW_KEY_PAGEUP:
k = TW_KEY_PAGE_UP;
break;
case GLFW_KEY_PAGEDOWN:
k = TW_KEY_PAGE_DOWN;
break;
case GLFW_KEY_HOME:
k = TW_KEY_HOME;
break;
case GLFW_KEY_END:
k = TW_KEY_END;
break;
case GLFW_KEY_KP_ENTER:
k = TW_KEY_RETURN;
break;
case GLFW_KEY_KP_DIVIDE:
if( testkp )
k = '/';
break;
case GLFW_KEY_KP_MULTIPLY:
if( testkp )
k = '*';
break;
case GLFW_KEY_KP_SUBTRACT:
if( testkp )
k = '-';
break;
case GLFW_KEY_KP_ADD:
if( testkp )
k = '+';
break;
case GLFW_KEY_KP_DECIMAL:
if( testkp )
k = '.';
break;
case GLFW_KEY_KP_EQUAL:
if( testkp )
k = '=';
break;
}
}
if( k>0 )
handled = TwKeyPressed(k, mod);
}
}
return handled;
}
int TW_CALL TwEventCharGLFW(int glfwChar, int glfwAction)
{
if( glfwAction==GLFW_PRESS && (glfwChar & 0xff00)==0 )
return TwKeyPressed(glfwChar, g_KMod);
return 0;
}
// functions with __cdecl calling convension
TW_API int TW_CDECL_CALL TwEventMouseButtonGLFWcdecl(int glfwButton, int glfwAction)
{
return TwEventMouseButtonGLFW(glfwButton, glfwAction);
}
TW_API int TW_CDECL_CALL TwEventKeyGLFWcdecl(int glfwKey, int glfwAction)
{
return TwEventKeyGLFW(glfwKey, glfwAction);
}
TW_API int TW_CDECL_CALL TwEventCharGLFWcdecl(int glfwChar, int glfwAction)
{
return TwEventCharGLFW(glfwChar, glfwAction);
}
TW_API int TW_CDECL_CALL TwEventMousePosGLFWcdecl(int mouseX, int mouseY)
{
return TwMouseMotion(mouseX, mouseY);
}
TW_API int TW_CDECL_CALL TwEventMouseWheelGLFWcdecl(int wheelPos)
{
return TwMouseWheel(wheelPos);
}

View File

@@ -0,0 +1,150 @@
// ---------------------------------------------------------------------------
//
// @file TwEventGLUT.c
// @brief Helper:
// translate and re-send mouse and keyboard events
// from GLUT event callbacks to AntTweakBar
//
// @author Philippe Decaudin
// @date 2006/05/10
// @license This file is part of the AntTweakBar library.
// For conditions of distribution and use, see License.txt
//
// ---------------------------------------------------------------------------
#define GLUT_NO_LIB_PRAGMA // we do not want to force linkage with glut
#ifdef _MSC_VER
# pragma warning(disable: 4505) // glut generates 'unreferenced function' warnings
# pragma warning(disable: 4100) // unreferenced parameter
#endif // _MSC_VER
// #include <GL/glut.h>
#include "MiniGLUT.h" // a subset of glut.h needed to compile TwEventGLUT.c
// note: AntTweakBar.dll does not need to link with GLUT,
// it just needs some definitions for its helper functions.
#include <AntTweakBar.h>
int TW_GLUT_CALL TwEventMouseButtonGLUT(int glutButton, int glutState, int mouseX, int mouseY)
{
TwMouseAction action = (glutState==GLUT_DOWN) ? TW_MOUSE_PRESSED : TW_MOUSE_RELEASED;
TwMouseMotion(mouseX, mouseY);
switch( glutButton )
{
case GLUT_LEFT_BUTTON:
return TwMouseButton(action, TW_MOUSE_LEFT);
case GLUT_RIGHT_BUTTON:
return TwMouseButton(action, TW_MOUSE_RIGHT);
case GLUT_MIDDLE_BUTTON:
return TwMouseButton(action, TW_MOUSE_MIDDLE);
default:
return 0;
}
}
int TW_GLUT_CALL TwEventMouseMotionGLUT(int mouseX, int mouseY)
{
return TwMouseMotion(mouseX, mouseY);
}
// GLUT does not send modifiers state to 'Key' and 'Special' callbacks,
// and we cannot call glutGetModifiers here because we do not want to link
// AntTweakBar with glut, so the following function is used to store
// a pointer to the glutGetModifiers function of the calling application.
// It must be called at initialisation of the application.
int (TW_CALL *g_GLUTGetModifiers)(void) = NULL;
int TW_CALL TwGLUTModifiersFunc(int (TW_CALL *glutGetModifiersFunc)(void))
{
g_GLUTGetModifiers = glutGetModifiersFunc;
return (g_GLUTGetModifiers==NULL) ? 0 : 1;
}
int TW_GLUT_CALL TwEventKeyboardGLUT(unsigned char glutKey, int mouseX, int mouseY)
{
int kmod = 0;
if( g_GLUTGetModifiers!=NULL )
{
int glutMod = g_GLUTGetModifiers();
if( glutMod&GLUT_ACTIVE_SHIFT )
kmod |= TW_KMOD_SHIFT;
if( glutMod&GLUT_ACTIVE_CTRL )
kmod |= TW_KMOD_CTRL;
if( glutMod&GLUT_ACTIVE_ALT )
kmod |= TW_KMOD_ALT;
}
if( (kmod&TW_KMOD_CTRL) && (glutKey>0 && glutKey<27) ) // CTRL special case
glutKey += 'a'-1;
return TwKeyPressed((int)glutKey, kmod);
}
int TW_GLUT_CALL TwEventSpecialGLUT(int glutKey, int mouseX, int mouseY)
{
int k = 0, kmod = 0;
if( g_GLUTGetModifiers!=NULL )
{
int glutMod = g_GLUTGetModifiers();
if( glutMod&GLUT_ACTIVE_SHIFT )
kmod |= TW_KMOD_SHIFT;
if( glutMod&GLUT_ACTIVE_CTRL )
kmod |= TW_KMOD_CTRL;
if( glutMod&GLUT_ACTIVE_ALT )
kmod |= TW_KMOD_ALT;
}
if( glutKey>=GLUT_KEY_F1 && glutKey<=GLUT_KEY_F12 )
k = TW_KEY_F1 + (glutKey-GLUT_KEY_F1);
else
{
switch( glutKey )
{
case GLUT_KEY_LEFT:
k = TW_KEY_LEFT;
break;
case GLUT_KEY_UP:
k = TW_KEY_UP;
break;
case GLUT_KEY_RIGHT:
k = TW_KEY_RIGHT;
break;
case GLUT_KEY_DOWN:
k = TW_KEY_DOWN;
break;
case GLUT_KEY_PAGE_UP:
k = TW_KEY_PAGE_UP;
break;
case GLUT_KEY_PAGE_DOWN:
k = TW_KEY_PAGE_DOWN;
break;
case GLUT_KEY_HOME:
k = TW_KEY_HOME;
break;
case GLUT_KEY_END:
k = TW_KEY_END;
break;
case GLUT_KEY_INSERT:
k = TW_KEY_INSERT;
break;
}
}
if( k>0 && k<TW_KEY_LAST )
return TwKeyPressed(k, kmod);
else
return 0;
}

Some files were not shown because too many files have changed in this diff Show More