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

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.