Merge branch 'next' of git://gitorious.org/fg/simgear into next
This commit is contained in:
5
projects/VC100/.gitignore
vendored
Normal file
5
projects/VC100/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
Win32
|
||||
x64
|
||||
*.user
|
||||
*.sdf
|
||||
*.suo
|
||||
37
projects/VC100/SimGear-alone.sln
Normal file
37
projects/VC100/SimGear-alone.sln
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimGear-install", "SimGear-install.vcxproj", "{1781C058-4D52-43AB-9028-EA0A7730057D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{22540CD3-D3CA-4C86-A773-80AEEE3ACDED} = {22540CD3-D3CA-4C86-A773-80AEEE3ACDED}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimGear", "SimGear.vcxproj", "{22540CD3-D3CA-4C86-A773-80AEEE3ACDED}"
|
||||
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
|
||||
{1781C058-4D52-43AB-9028-EA0A7730057D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{1781C058-4D52-43AB-9028-EA0A7730057D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{1781C058-4D52-43AB-9028-EA0A7730057D}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{1781C058-4D52-43AB-9028-EA0A7730057D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{1781C058-4D52-43AB-9028-EA0A7730057D}.Release|Win32.Build.0 = Release|Win32
|
||||
{1781C058-4D52-43AB-9028-EA0A7730057D}.Release|x64.ActiveCfg = Release|Win32
|
||||
{22540CD3-D3CA-4C86-A773-80AEEE3ACDED}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{22540CD3-D3CA-4C86-A773-80AEEE3ACDED}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{22540CD3-D3CA-4C86-A773-80AEEE3ACDED}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{22540CD3-D3CA-4C86-A773-80AEEE3ACDED}.Debug|x64.Build.0 = Debug|x64
|
||||
{22540CD3-D3CA-4C86-A773-80AEEE3ACDED}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{22540CD3-D3CA-4C86-A773-80AEEE3ACDED}.Release|Win32.Build.0 = Release|Win32
|
||||
{22540CD3-D3CA-4C86-A773-80AEEE3ACDED}.Release|x64.ActiveCfg = Release|x64
|
||||
{22540CD3-D3CA-4C86-A773-80AEEE3ACDED}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
67
projects/VC100/SimGear-install.vcxproj
Normal file
67
projects/VC100/SimGear-install.vcxproj
Normal file
@@ -0,0 +1,67 @@
|
||||
<?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="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{1781C058-4D52-43AB-9028-EA0A7730057D}</ProjectGuid>
|
||||
<RootNamespace>SimGearinstall</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
17
projects/VC100/SimGear-install.vcxproj.filters
Normal file
17
projects/VC100/SimGear-install.vcxproj.filters
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Fichiers sources">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Fichiers d%27en-tête">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Fichiers de ressources">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
597
projects/VC100/SimGear.vcxproj
Normal file
597
projects/VC100/SimGear.vcxproj
Normal file
@@ -0,0 +1,597 @@
|
||||
<?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>{22540CD3-D3CA-4C86-A773-80AEEE3ACDED}</ProjectGuid>
|
||||
<RootNamespace>SimGear</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</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.UpgradeFromVC71.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.UpgradeFromVC71.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.UpgradeFromVC71.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.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..;..\..\simgear;..\..\..;..\..\..\install\msvc100\OpenSceneGraph\include;..\..\..\3rdparty\include;..\..\..\boost_1_43_0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>HAVE_CONFIG_H;NDEBUG;WIN32;_USE_MATH_DEFINES;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
<ProjectReference />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..;..\..\simgear;..\..\..;..\..\..\install\msvc100-64\OpenSceneGraph\include;..\..\..\3rdparty.x64\include;..\..\..\boost_1_43_0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>HAVE_CONFIG_H;NDEBUG;WIN32;_USE_MATH_DEFINES;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..;..\..\simgear;..\..\..;..\..\..\install\msvc100\OpenSceneGraph\include;..\..\..\3rdparty\include;..\..\..\boost_1_43_0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>HAVE_CONFIG_H;_DEBUG;WIN32;_USE_MATH_DEFINES;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<BrowseInformation>true</BrowseInformation>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..;..\..\simgear;..\..\..;..\..\..\install\msvc100-64\OpenSceneGraph\include;..\..\..\3rdparty.x64\include;..\..\..\boost_1_43_0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>HAVE_CONFIG_H;_DEBUG;WIN32;_USE_MATH_DEFINES;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<BrowseInformation>true</BrowseInformation>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\simgear\bucket\newbucket.cxx" />
|
||||
<ClCompile Include="..\..\simgear\debug\logstream.cxx" />
|
||||
<ClCompile Include="..\..\simgear\ephemeris\celestialBody.cxx" />
|
||||
<ClCompile Include="..\..\simgear\ephemeris\ephemeris.cxx" />
|
||||
<ClCompile Include="..\..\simgear\ephemeris\jupiter.cxx" />
|
||||
<ClCompile Include="..\..\simgear\ephemeris\mars.cxx" />
|
||||
<ClCompile Include="..\..\simgear\ephemeris\mercury.cxx" />
|
||||
<ClCompile Include="..\..\simgear\ephemeris\moonpos.cxx" />
|
||||
<ClCompile Include="..\..\simgear\ephemeris\neptune.cxx" />
|
||||
<ClCompile Include="..\..\simgear\ephemeris\saturn.cxx" />
|
||||
<ClCompile Include="..\..\simgear\ephemeris\star.cxx" />
|
||||
<ClCompile Include="..\..\simgear\ephemeris\stardata.cxx" />
|
||||
<ClCompile Include="..\..\simgear\ephemeris\uranus.cxx" />
|
||||
<ClCompile Include="..\..\simgear\ephemeris\venus.cxx" />
|
||||
<ClCompile Include="..\..\simgear\io\iochannel.cxx" />
|
||||
<ClCompile Include="..\..\simgear\io\lowlevel.cxx" />
|
||||
<ClCompile Include="..\..\simgear\io\raw_socket.cxx" />
|
||||
<ClCompile Include="..\..\simgear\io\sg_binobj.cxx" />
|
||||
<ClCompile Include="..\..\simgear\io\sg_file.cxx" />
|
||||
<ClCompile Include="..\..\simgear\io\sg_serial.cxx" />
|
||||
<ClCompile Include="..\..\simgear\io\sg_socket.cxx" />
|
||||
<ClCompile Include="..\..\simgear\io\sg_socket_udp.cxx" />
|
||||
<ClCompile Include="..\..\simgear\magvar\coremag.cxx" />
|
||||
<ClCompile Include="..\..\simgear\magvar\magvar.cxx" />
|
||||
<ClCompile Include="..\..\simgear\math\interpolater.cxx" />
|
||||
<ClCompile Include="..\..\simgear\math\leastsqs.cxx" />
|
||||
<ClCompile Include="..\..\simgear\math\sg_random.c" />
|
||||
<ClCompile Include="..\..\simgear\math\SGGeod.cxx" />
|
||||
<ClCompile Include="..\..\simgear\math\SGGeodesy.cxx" />
|
||||
<ClCompile Include="..\..\simgear\misc\interpolator.cxx" />
|
||||
<ClCompile Include="..\..\simgear\misc\PathOptions.cxx" />
|
||||
<ClCompile Include="..\..\simgear\misc\sg_dir.cxx" />
|
||||
<ClCompile Include="..\..\simgear\misc\sg_path.cxx" />
|
||||
<ClCompile Include="..\..\simgear\misc\sgstream.cxx" />
|
||||
<ClCompile Include="..\..\simgear\misc\strutils.cxx" />
|
||||
<ClCompile Include="..\..\simgear\misc\tabbed_values.cxx" />
|
||||
<ClCompile Include="..\..\simgear\misc\texcoord.cxx" />
|
||||
<ClCompile Include="..\..\simgear\misc\zfstream.cxx" />
|
||||
<ClCompile Include="..\..\simgear\route\route.cxx" />
|
||||
<ClCompile Include="..\..\simgear\route\waypoint.cxx" />
|
||||
<ClCompile Include="..\..\simgear\screen\extensions.cxx" />
|
||||
<ClCompile Include="..\..\simgear\screen\GLBitmaps.cxx" />
|
||||
<ClCompile Include="..\..\simgear\screen\jpgfactory.cxx" />
|
||||
<ClCompile Include="..\..\simgear\screen\RenderTexture.cpp" />
|
||||
<ClCompile Include="..\..\simgear\screen\screen-dump.cxx" />
|
||||
<ClCompile Include="..\..\simgear\screen\shader.cpp" />
|
||||
<ClCompile Include="..\..\simgear\screen\tr.cxx" />
|
||||
<ClCompile Include="..\..\simgear\serial\serial.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\sky\bbcache.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\sky\cloud.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\sky\cloudfield.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\sky\CloudShaderGeometry.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\sky\dome.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\sky\moon.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\sky\newcloud.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\sky\oursun.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\sky\sky.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\sky\sphere.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\sky\stars.cxx" />
|
||||
<ClCompile Include="..\..\simgear\timing\lowleveltime.cxx" />
|
||||
<ClCompile Include="..\..\simgear\timing\sg_time.cxx" />
|
||||
<ClCompile Include="..\..\simgear\timing\timestamp.cxx" />
|
||||
<ClCompile Include="..\..\simgear\timing\timezone.cxx" />
|
||||
<ClCompile Include="..\..\simgear\xml\easyxml.cxx" />
|
||||
<ClCompile Include="..\..\simgear\xml\hashtable.c" />
|
||||
<ClCompile Include="..\..\simgear\xml\xmlparse.c" />
|
||||
<ClCompile Include="..\..\simgear\xml\xmlrole.c" />
|
||||
<ClCompile Include="..\..\simgear\xml\xmltok.c" />
|
||||
<ClCompile Include="..\..\simgear\props\AtomicChangeListener.cxx" />
|
||||
<ClCompile Include="..\..\simgear\props\condition.cxx" />
|
||||
<ClCompile Include="..\..\simgear\props\props.cxx" />
|
||||
<ClCompile Include="..\..\simgear\props\props_io.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\animation.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\CheckSceneryVisitor.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\model.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\modellib.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\ModelRegistry.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\particles.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\persparam.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\placement.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\SGClipGroup.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\SGInteractionAnimation.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\SGMaterialAnimation.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\SGOffsetTransform.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\SGPagedLOD.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\SGReaderWriterXML.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\SGRotateTransform.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\SGScaleTransform.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\SGText.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\SGTranslateTransform.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\model\shadanim.cxx" />
|
||||
<ClCompile Include="..\..\simgear\sound\sample_group.cxx" />
|
||||
<ClCompile Include="..\..\simgear\sound\sample_openal.cxx" />
|
||||
<ClCompile Include="..\..\simgear\sound\soundmgr_openal.cxx" />
|
||||
<ClCompile Include="..\..\simgear\sound\xmlsound.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\material\Effect.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\material\EffectBuilder.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\material\EffectCullVisitor.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\material\EffectGeode.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\material\GLPredicate.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\material\makeEffect.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\material\mat.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\material\matlib.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\material\matmodel.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\material\Noise.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\material\Pass.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\material\Technique.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\material\TextureBuilder.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\tgdb\apt_signs.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\tgdb\GroundLightManager.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\tgdb\obj.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\tgdb\pt_lights.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\tgdb\ReaderWriterSTG.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\tgdb\SGOceanTile.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\tgdb\SGReaderWriterBTG.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\tgdb\SGVasiDrawable.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\tgdb\ShaderGeometry.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\tgdb\TileCache.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\tgdb\TileEntry.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\tgdb\TreeBin.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\tgdb\userdata.cxx" />
|
||||
<ClCompile Include="..\..\simgear\structure\commands.cxx" />
|
||||
<ClCompile Include="..\..\simgear\structure\event_mgr.cxx" />
|
||||
<ClCompile Include="..\..\simgear\structure\exception.cxx">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\simgear\structure\SGBinding.cxx" />
|
||||
<ClCompile Include="..\..\simgear\structure\SGExpression.cxx" />
|
||||
<ClCompile Include="..\..\simgear\structure\SGSmplhist.cxx" />
|
||||
<ClCompile Include="..\..\simgear\structure\SGSmplstat.cxx" />
|
||||
<ClCompile Include="..\..\simgear\structure\subsystem_mgr.cxx" />
|
||||
<ClCompile Include="..\..\simgear\nasal\bitslib.c" />
|
||||
<ClCompile Include="..\..\simgear\nasal\code.c" />
|
||||
<ClCompile Include="..\..\simgear\nasal\codegen.c" />
|
||||
<ClCompile Include="..\..\simgear\nasal\gc.c" />
|
||||
<ClCompile Include="..\..\simgear\nasal\hash.c" />
|
||||
<ClCompile Include="..\..\simgear\nasal\iolib.c" />
|
||||
<ClCompile Include="..\..\simgear\nasal\lex.c" />
|
||||
<ClCompile Include="..\..\simgear\nasal\lib.c" />
|
||||
<ClCompile Include="..\..\simgear\nasal\mathlib.c" />
|
||||
<ClCompile Include="..\..\simgear\nasal\misc.c" />
|
||||
<ClCompile Include="..\..\simgear\nasal\parse.c" />
|
||||
<ClCompile Include="..\..\simgear\nasal\string.c">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MinSpace</Optimization>
|
||||
<InlineFunctionExpansion Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MinSpace</Optimization>
|
||||
<InlineFunctionExpansion Condition="'$(Configuration)|$(Platform)'=='Release|x64'">OnlyExplicitInline</InlineFunctionExpansion>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\simgear\nasal\thread-win32.c" />
|
||||
<ClCompile Include="..\..\simgear\nasal\threadlib.c" />
|
||||
<ClCompile Include="..\..\simgear\nasal\utf8lib.c" />
|
||||
<ClCompile Include="..\..\simgear\nasal\vector.c">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\simgear\environment\metar.cxx" />
|
||||
<ClCompile Include="..\..\simgear\environment\precipitation.cxx" />
|
||||
<ClCompile Include="..\..\simgear\environment\visual_enviro.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\util\CopyOp.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\util\NodeAndDrawableVisitor.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\util\PrimitiveUtils.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\util\QuadTreeBuilder.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\util\SGEnlargeBoundingBox.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\util\SGSceneFeatures.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\util\SGSceneUserData.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\util\SGStateAttributeVisitor.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\util\SGTextureStateAttributeVisitor.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\util\SplicingVisitor.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\util\StateAttributeFactory.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\util\UpdateOnceCallback.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\bvh\BVHGroup.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\bvh\BVHLineGeometry.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\bvh\BVHLineSegmentVisitor.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\bvh\BVHMotionTransform.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\bvh\BVHNode.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\bvh\BVHStaticBinary.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\bvh\BVHStaticGeometry.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\bvh\BVHStaticLeaf.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\bvh\BVHStaticNode.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\bvh\BVHStaticTriangle.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\bvh\BVHSubTreeCollector.cxx" />
|
||||
<ClCompile Include="..\..\simgear\scene\bvh\BVHTransform.cxx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\simgear\bucket\newbucket.hxx" />
|
||||
<ClInclude Include="..\..\simgear\debug\debug_types.h" />
|
||||
<ClInclude Include="..\..\simgear\debug\logstream.hxx" />
|
||||
<ClInclude Include="..\..\simgear\ephemeris\celestialBody.hxx" />
|
||||
<ClInclude Include="..\..\simgear\ephemeris\ephemeris.hxx" />
|
||||
<ClInclude Include="..\..\simgear\ephemeris\jupiter.hxx" />
|
||||
<ClInclude Include="..\..\simgear\ephemeris\mars.hxx" />
|
||||
<ClInclude Include="..\..\simgear\ephemeris\mercury.hxx" />
|
||||
<ClInclude Include="..\..\simgear\ephemeris\moonpos.hxx" />
|
||||
<ClInclude Include="..\..\simgear\ephemeris\neptune.hxx" />
|
||||
<ClInclude Include="..\..\simgear\ephemeris\pluto.hxx" />
|
||||
<ClInclude Include="..\..\simgear\ephemeris\saturn.hxx" />
|
||||
<ClInclude Include="..\..\simgear\ephemeris\star.hxx" />
|
||||
<ClInclude Include="..\..\simgear\ephemeris\stardata.hxx" />
|
||||
<ClInclude Include="..\..\simgear\ephemeris\uranus.hxx" />
|
||||
<ClInclude Include="..\..\simgear\ephemeris\venus.hxx" />
|
||||
<ClInclude Include="..\..\simgear\io\iochannel.hxx" />
|
||||
<ClInclude Include="..\..\simgear\io\lowlevel.hxx" />
|
||||
<ClInclude Include="..\..\simgear\io\raw_socket.hxx" />
|
||||
<ClInclude Include="..\..\simgear\io\sg_binobj.hxx" />
|
||||
<ClInclude Include="..\..\simgear\io\sg_file.hxx" />
|
||||
<ClInclude Include="..\..\simgear\io\sg_serial.hxx" />
|
||||
<ClInclude Include="..\..\simgear\io\sg_socket.hxx" />
|
||||
<ClInclude Include="..\..\simgear\io\sg_socket_udp.hxx" />
|
||||
<ClInclude Include="..\..\simgear\magvar\coremag.hxx" />
|
||||
<ClInclude Include="..\..\simgear\magvar\magvar.hxx" />
|
||||
<ClInclude Include="..\..\simgear\math\beziercurve.hxx" />
|
||||
<ClInclude Include="..\..\simgear\math\interpolater.hxx" />
|
||||
<ClInclude Include="..\..\simgear\math\leastsqs.hxx" />
|
||||
<ClInclude Include="..\..\simgear\math\linintp2.h" />
|
||||
<ClInclude Include="..\..\simgear\math\localconsts.hxx" />
|
||||
<ClInclude Include="..\..\simgear\math\point3d.hxx" />
|
||||
<ClInclude Include="..\..\simgear\math\polar3d.hxx" />
|
||||
<ClInclude Include="..\..\simgear\math\sg_geodesy.hxx" />
|
||||
<ClInclude Include="..\..\simgear\math\sg_random.h" />
|
||||
<ClInclude Include="..\..\simgear\math\sg_types.hxx" />
|
||||
<ClInclude Include="..\..\simgear\math\SGGeodesy.hxx" />
|
||||
<ClInclude Include="..\..\simgear\math\sphrintp.h" />
|
||||
<ClInclude Include="..\..\simgear\misc\interpolator.hxx" />
|
||||
<ClInclude Include="..\..\simgear\misc\PathOptions.hxx" />
|
||||
<ClInclude Include="..\..\simgear\misc\sg_dir.hxx" />
|
||||
<ClInclude Include="..\..\simgear\misc\sg_path.hxx" />
|
||||
<ClInclude Include="..\..\simgear\misc\sgstream.hxx" />
|
||||
<ClInclude Include="..\..\simgear\misc\stopwatch.hxx" />
|
||||
<ClInclude Include="..\..\simgear\misc\strutils.hxx" />
|
||||
<ClInclude Include="..\..\simgear\misc\tabbed_values.hxx" />
|
||||
<ClInclude Include="..\..\simgear\misc\texcoord.hxx" />
|
||||
<ClInclude Include="..\..\simgear\misc\zfstream.hxx" />
|
||||
<ClInclude Include="..\..\simgear\route\route.hxx" />
|
||||
<ClInclude Include="..\..\simgear\route\waypoint.hxx" />
|
||||
<ClInclude Include="..\..\simgear\screen\colors.hxx" />
|
||||
<ClInclude Include="..\..\simgear\screen\extensions.hxx" />
|
||||
<ClInclude Include="..\..\simgear\screen\GLBitmaps.h" />
|
||||
<ClInclude Include="..\..\simgear\screen\jpgfactory.hxx" />
|
||||
<ClInclude Include="..\..\simgear\screen\RenderTexture.h" />
|
||||
<ClInclude Include="..\..\simgear\screen\screen-dump.hxx" />
|
||||
<ClInclude Include="..\..\simgear\screen\shader.h" />
|
||||
<ClInclude Include="..\..\simgear\screen\tr.h" />
|
||||
<ClInclude Include="..\..\simgear\screen\win32-printer.h" />
|
||||
<ClInclude Include="..\..\simgear\serial\serial.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\sky\bbcache.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\sky\cloud.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\sky\cloudfield.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\sky\CloudShaderGeometry.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\sky\dome.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\sky\moon.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\sky\newcloud.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\sky\oursun.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\sky\sky.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\sky\sphere.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\sky\stars.hxx" />
|
||||
<ClInclude Include="..\..\simgear\timing\lowleveltime.h" />
|
||||
<ClInclude Include="..\..\simgear\timing\sg_time.hxx" />
|
||||
<ClInclude Include="..\..\simgear\timing\timestamp.hxx" />
|
||||
<ClInclude Include="..\..\simgear\timing\timezone.h" />
|
||||
<ClInclude Include="..\..\simgear\xml\asciitab.h" />
|
||||
<ClInclude Include="..\..\simgear\xml\easyxml.hxx" />
|
||||
<ClInclude Include="..\..\simgear\xml\hashtable.h" />
|
||||
<ClInclude Include="..\..\simgear\xml\iasciitab.h" />
|
||||
<ClInclude Include="..\..\simgear\xml\latin1tab.h" />
|
||||
<ClInclude Include="..\..\simgear\xml\nametab.h" />
|
||||
<ClInclude Include="..\..\simgear\xml\utf8tab.h" />
|
||||
<ClInclude Include="..\..\simgear\xml\xmldef.h" />
|
||||
<ClInclude Include="..\..\simgear\xml\xmlparse.h" />
|
||||
<ClInclude Include="..\..\simgear\xml\xmlrole.h" />
|
||||
<ClInclude Include="..\..\simgear\xml\xmltok.h" />
|
||||
<ClInclude Include="..\..\simgear\xml\xmltok_impl.h" />
|
||||
<ClInclude Include="..\..\simgear\props\AtomicChangeListener.hxx" />
|
||||
<ClInclude Include="..\..\simgear\props\condition.hxx" />
|
||||
<ClInclude Include="..\..\simgear\props\ExtendedPropertyAdapter.hxx" />
|
||||
<ClInclude Include="..\..\simgear\props\props.hxx" />
|
||||
<ClInclude Include="..\..\simgear\props\props_io.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\animation.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\CheckSceneryVisitor.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\model.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\modellib.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\ModelRegistry.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\particles.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\persparam.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\placement.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\SGClipGroup.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\SGInteractionAnimation.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\SGMaterialAnimation.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\SGOffsetTransform.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\SGPagedLOD.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\SGReaderWriterXML.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\SGReaderWriterXMLOptions.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\SGRotateTransform.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\SGScaleTransform.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\SGText.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\model\SGTranslateTransform.hxx" />
|
||||
<ClInclude Include="..\..\simgear\sound\sample_group.hxx" />
|
||||
<ClInclude Include="..\..\simgear\sound\sample_openal.hxx" />
|
||||
<ClInclude Include="..\..\simgear\sound\soundmgr_openal.hxx" />
|
||||
<ClInclude Include="..\..\simgear\sound\xmlsound.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\material\Effect.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\material\EffectBuilder.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\material\EffectCullVisitor.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\material\EffectGeode.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\material\GLPredicate.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\material\mat.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\material\matlib.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\material\matmodel.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\material\Noise.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\material\Pass.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\material\Technique.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\material\TextureBuilder.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\tgdb\apt_signs.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\tgdb\GroundLightManager.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\tgdb\obj.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\tgdb\pt_lights.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\tgdb\SGModelBin.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\tgdb\SGOceanTile.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\tgdb\SGReaderWriterBTG.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\tgdb\SGReaderWriterBTGOptions.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\tgdb\SGVasiDrawable.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\tgdb\ShaderGeometry.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\tgdb\TileCache.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\tgdb\TileEntry.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\tgdb\TreeBin.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\tgdb\userdata.hxx" />
|
||||
<ClInclude Include="..\..\simgear\threads\SGGuard.hxx" />
|
||||
<ClInclude Include="..\..\simgear\threads\SGQueue.hxx" />
|
||||
<ClInclude Include="..\..\simgear\structure\callback.hxx" />
|
||||
<ClInclude Include="..\..\simgear\structure\commands.hxx" />
|
||||
<ClInclude Include="..\..\simgear\structure\event_mgr.hxx" />
|
||||
<ClInclude Include="..\..\simgear\structure\exception.hxx" />
|
||||
<ClInclude Include="..\..\simgear\structure\OSGVersion.hxx" />
|
||||
<ClInclude Include="..\..\simgear\structure\SGBinding.hxx" />
|
||||
<ClInclude Include="..\..\simgear\structure\SGExpression.hxx" />
|
||||
<ClInclude Include="..\..\simgear\structure\SGReferenced.hxx" />
|
||||
<ClInclude Include="..\..\simgear\structure\SGSharedPtr.hxx" />
|
||||
<ClInclude Include="..\..\simgear\structure\SGSmplhist.hxx" />
|
||||
<ClInclude Include="..\..\simgear\structure\SGSmplstat.hxx" />
|
||||
<ClInclude Include="..\..\simgear\structure\subsystem_mgr.hxx" />
|
||||
<ClInclude Include="..\..\simgear\nasal\code.h" />
|
||||
<ClInclude Include="..\..\simgear\nasal\data.h" />
|
||||
<ClInclude Include="..\..\simgear\nasal\iolib.h" />
|
||||
<ClInclude Include="..\..\simgear\nasal\nasal.h" />
|
||||
<ClInclude Include="..\..\simgear\nasal\parse.h" />
|
||||
<ClInclude Include="..\..\simgear\environment\metar.hxx" />
|
||||
<ClInclude Include="..\..\simgear\environment\precipitation.hxx" />
|
||||
<ClInclude Include="..\..\simgear\environment\visual_enviro.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\util\CopyOp.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\util\NodeAndDrawableVisitor.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\util\PrimitiveUtils.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\util\QuadTreeBuilder.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\util\RenderConstants.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\util\SGDebugDrawCallback.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\util\SGEnlargeBoundingBox.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\util\SGNodeMasks.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\util\SGSceneFeatures.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\util\SGSceneUserData.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\util\SGStateAttributeVisitor.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\util\SGTextureStateAttributeVisitor.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\util\SGUpdateVisitor.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\util\SplicingVisitor.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\util\StateAttributeFactory.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\util\UpdateOnceCallback.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHBoundingBoxVisitor.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHDebugCollectVisitor.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHGroup.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHLineGeometry.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHLineSegmentVisitor.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHMotionTransform.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHNode.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHStaticBinary.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHStaticData.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHStaticGeometry.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHStaticGeometryBuilder.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHStaticLeaf.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHStaticNode.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHStaticTriangle.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHSubTreeCollector.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHTransform.hxx" />
|
||||
<ClInclude Include="..\..\simgear\scene\bvh\BVHVisitor.hxx" />
|
||||
<ClInclude Include="..\..\simgear\compiler.h" />
|
||||
<ClInclude Include="..\..\simgear\version.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\simgear\math\linintp2.inl" />
|
||||
<CustomBuild Include="..\..\simgear\simgear_config.h-msvc90">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generation of simgear_config.h</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) %(RootDir)%(Directory)\%(Filename).h
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\simgear\simgear_config.h;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generation of simgear_config.h</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) %(RootDir)%(Directory)\%(Filename).h
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\simgear\simgear_config.h;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Generation of simgear_config.h</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) %(RootDir)%(Directory)\%(Filename).h
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\simgear\simgear_config.h;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generation of simgear_config.h</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) %(RootDir)%(Directory)\%(Filename).h
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\simgear\simgear_config.h;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
1195
projects/VC100/SimGear.vcxproj.filters
Normal file
1195
projects/VC100/SimGear.vcxproj.filters
Normal file
File diff suppressed because it is too large
Load Diff
@@ -707,14 +707,6 @@
|
||||
RelativePath="..\..\simgear\screen\extensions.hxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\simgear\screen\GLBitmaps.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\simgear\screen\GLBitmaps.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\simgear\screen\jpgfactory.cxx"
|
||||
>
|
||||
@@ -723,14 +715,6 @@
|
||||
RelativePath="..\..\simgear\screen\jpgfactory.hxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\simgear\screen\RenderTexture.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\simgear\screen\RenderTexture.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\simgear\screen\screen-dump.cxx"
|
||||
>
|
||||
@@ -739,14 +723,6 @@
|
||||
RelativePath="..\..\simgear\screen\screen-dump.hxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\simgear\screen\shader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\simgear\screen\shader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\simgear\screen\tr.cxx"
|
||||
>
|
||||
@@ -755,10 +731,6 @@
|
||||
RelativePath="..\..\simgear\screen\tr.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\simgear\screen\win32-printer.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Lib_sgserial"
|
||||
@@ -775,14 +747,6 @@
|
||||
<Filter
|
||||
Name="Lib_sgsky"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\simgear\scene\sky\bbcache.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\simgear\scene\sky\bbcache.hxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\simgear\scene\sky\cloud.cxx"
|
||||
>
|
||||
|
||||
@@ -775,11 +775,11 @@ void ShaderProgramBuilder::buildAttribute(Effect* effect, Pass* pass,
|
||||
ProgramKey prgKey;
|
||||
std::back_insert_iterator<vector<ShaderKey> > inserter(prgKey.shaders);
|
||||
transform(pVertShaders.begin(), pVertShaders.end(), inserter,
|
||||
bind(makeShaderKey, _1, Shader::VERTEX));
|
||||
boost::bind(makeShaderKey, _1, Shader::VERTEX));
|
||||
transform(pGeomShaders.begin(), pGeomShaders.end(), inserter,
|
||||
bind(makeShaderKey, _1, Shader::GEOMETRY));
|
||||
boost::bind(makeShaderKey, _1, Shader::GEOMETRY));
|
||||
transform(pFragShaders.begin(), pFragShaders.end(), inserter,
|
||||
bind(makeShaderKey, _1, Shader::FRAGMENT));
|
||||
boost::bind(makeShaderKey, _1, Shader::FRAGMENT));
|
||||
for (PropertyList::iterator itr = pAttributes.begin(),
|
||||
e = pAttributes.end();
|
||||
itr != e;
|
||||
|
||||
@@ -121,13 +121,20 @@ struct EffectNameValue
|
||||
template<typename FromType,typename ToType>
|
||||
struct bidirectional_map
|
||||
{
|
||||
#if _MSC_VER >= 1600
|
||||
struct value_type {
|
||||
FromType first;
|
||||
ToType second;
|
||||
value_type(FromType f, ToType s) : first(f),second(s){}
|
||||
};
|
||||
#else
|
||||
typedef std::pair<FromType,ToType> value_type;
|
||||
#endif
|
||||
|
||||
/* A bidirectional map can be simulated as a multi_index_container
|
||||
* of pairs of (FromType,ToType) with two unique indices, one
|
||||
* for each member of the pair.
|
||||
*/
|
||||
|
||||
typedef multi_index_container<
|
||||
value_type,
|
||||
indexed_by<
|
||||
|
||||
@@ -10,7 +10,6 @@ include_HEADERS = \
|
||||
sky.hxx \
|
||||
sphere.hxx \
|
||||
stars.hxx \
|
||||
bbcache.hxx \
|
||||
cloudfield.hxx \
|
||||
newcloud.hxx \
|
||||
CloudShaderGeometry.hxx
|
||||
@@ -23,7 +22,6 @@ libsgsky_a_SOURCES = \
|
||||
sky.cxx \
|
||||
sphere.cxx \
|
||||
stars.cxx \
|
||||
bbcache.cxx \
|
||||
cloudfield.cxx \
|
||||
newcloud.cxx \
|
||||
CloudShaderGeometry.cxx
|
||||
|
||||
@@ -1,374 +0,0 @@
|
||||
// Billboard helper class
|
||||
//
|
||||
// Written by Harald JOHNSEN, started April 2005.
|
||||
//
|
||||
// Copyright (C) 2005 Harald JOHNSEN - hjohnsen@evc.net
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
//
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <simgear_config.h>
|
||||
#endif
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
|
||||
#include <plib/sg.h>
|
||||
#include <simgear/screen/extensions.hxx>
|
||||
#include <simgear/screen/RenderTexture.h>
|
||||
#include <osg/GLU>
|
||||
|
||||
#include "bbcache.hxx"
|
||||
|
||||
|
||||
/*
|
||||
memory usage :
|
||||
size 1 tex 8 tex 32 tex 64 tex
|
||||
64x64x4 16k 128k 512k 1Mo
|
||||
128x128x4 64k 512k 2Mo 4Mo
|
||||
256x256x4 256k 2Mo 8Mo 16Mo
|
||||
*/
|
||||
|
||||
void SGBbCache::freeTextureMemory(void) {
|
||||
|
||||
if( bbListCount ) {
|
||||
for(int i = 0 ; i < bbListCount ; i++) {
|
||||
bbList[i].cldID = 0;
|
||||
if(bbList[i].texID)
|
||||
glDeleteTextures(1, & bbList[i].texID);
|
||||
}
|
||||
delete [] bbList;
|
||||
}
|
||||
bbListCount = 0;
|
||||
cacheSizeKb = 0;
|
||||
textureWH = 0;
|
||||
}
|
||||
|
||||
bool SGBbCache::allocTextureMemory(int cacheCount, int textureDimension) {
|
||||
textureWH = textureDimension;
|
||||
bbListCount = cacheCount;
|
||||
bbList = new bbInfo[bbListCount];
|
||||
for(int i = 0 ; i < bbListCount ; i++) {
|
||||
bbList[i].cldID = 0;
|
||||
bbList[i].texID = 0;
|
||||
glGenTextures(1, &bbList[i].texID);
|
||||
glBindTexture(GL_TEXTURE_2D, bbList[i].texID);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8,
|
||||
textureDimension, textureDimension, 0, GL_RGB, GL_FLOAT, NULL);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
cacheSizeKb = (textureDimension * textureDimension * 4);
|
||||
cacheSizeKb *= cacheCount;
|
||||
cacheSizeKb /= 1024;
|
||||
if(rtAvailable) {
|
||||
if( rt->BeginCapture() ) {
|
||||
glViewport(0, 0, textureDimension, textureDimension);
|
||||
rt->EndCapture();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
SGBbCache::SGBbCache(void) :
|
||||
bbListCount(0),
|
||||
textureWH(0),
|
||||
cacheSizeKb(0),
|
||||
builtBBCount(0),
|
||||
frameNumber(0),
|
||||
rt(0),
|
||||
rtAvailable(false),
|
||||
maxImpostorRegenFrame(20)
|
||||
{
|
||||
}
|
||||
|
||||
SGBbCache::~SGBbCache(void) {
|
||||
delete rt;
|
||||
freeTextureMemory();
|
||||
}
|
||||
|
||||
|
||||
void SGBbCache::init(int cacheCount) {
|
||||
GLint colorBits = 0;
|
||||
glGetIntegerv( GL_BLUE_BITS, &colorBits );
|
||||
|
||||
rt = new RenderTexture();
|
||||
// don't use default rtt on nvidia/win because of poor performance of glCopyTexSubImage2D
|
||||
// wihtout default pattrib params - see opengl forum
|
||||
if( colorBits < 8 )
|
||||
rt->Reset("rgba=5,5,5,1 ctt");
|
||||
else
|
||||
rt->Reset("rgba ctt");
|
||||
|
||||
// rt->Reset("rgba tex2D ctt");
|
||||
// rt->Reset("rgba tex2D");
|
||||
if( rt->Initialize(256, 256, true) ) {
|
||||
SG_LOG(SG_ALL, SG_INFO, "bbcache:Initialize sucessfull");
|
||||
if (rt->BeginCapture())
|
||||
{
|
||||
SG_LOG(SG_ALL, SG_INFO, "bbcache:BeginCapture sucessfull, RTT available");
|
||||
rtAvailable = true;
|
||||
glViewport(0, 0, 256, 256);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(60.0, 1, 1, 5.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glDisable(GL_LIGHTING);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_FOG);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glAlphaFunc(GL_GREATER, 0.0f);
|
||||
glEnable(GL_SMOOTH);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
|
||||
|
||||
rt->EndCapture();
|
||||
} else
|
||||
SG_LOG(SG_ALL, SG_WARN, "bbcache:BeginCapture failed, RTT not available for 3D clouds");
|
||||
} else
|
||||
SG_LOG(SG_ALL, SG_WARN, "bbcache:Initialize failed, RTT not available for 3D clouds");
|
||||
if( cacheCount )
|
||||
allocTextureMemory( cacheCount, 64 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool SGBbCache::setCacheSize(int count, int textureDimension) {
|
||||
if( count < 0 || count > 500)
|
||||
return false;
|
||||
freeTextureMemory();
|
||||
if( count == 0)
|
||||
return true;
|
||||
|
||||
// only allow some reasonable dimensions
|
||||
switch(textureDimension) {
|
||||
case 0:
|
||||
// default size
|
||||
textureDimension = 256;
|
||||
break;
|
||||
case 64:
|
||||
case 128:
|
||||
case 256:
|
||||
break;
|
||||
case 512:
|
||||
// rt is 256 so higher texture size has no meaning
|
||||
textureDimension = 256;
|
||||
break;
|
||||
default:
|
||||
textureDimension = 128;
|
||||
break;
|
||||
}
|
||||
return allocTextureMemory( count, textureDimension);
|
||||
}
|
||||
|
||||
|
||||
bool SGBbCache::setCacheSize(int sizeKb) {
|
||||
if( sizeKb < 0 || sizeKb > 256*1024)
|
||||
return false;
|
||||
freeTextureMemory();
|
||||
if( sizeKb == 0)
|
||||
return true;
|
||||
int count = 1;
|
||||
int textureDimension = 256;
|
||||
if( sizeKb >= 8*1024 ) {
|
||||
// more than 32 256x256 textures
|
||||
textureDimension = 256;
|
||||
} else if( sizeKb >= 2*1024 ) {
|
||||
// more than 32 128x128 textures
|
||||
textureDimension = 128;
|
||||
} else {
|
||||
// don't go under 64x64 textures
|
||||
textureDimension = 64;
|
||||
}
|
||||
count = (sizeKb * 1024) / (textureDimension * textureDimension * 4);
|
||||
if(count == 0)
|
||||
count = 1;
|
||||
return allocTextureMemory( count, textureDimension);
|
||||
}
|
||||
|
||||
int SGBbCache::queryCacheSize(void) {
|
||||
return cacheSizeKb;
|
||||
}
|
||||
|
||||
void SGBbCache::free(int bbId, int cldId) {
|
||||
if( bbId < 0 || bbId >= bbListCount )
|
||||
return;
|
||||
if( bbList[bbId].cldID != cldId )
|
||||
return;
|
||||
bbList[bbId].cldID = 0;
|
||||
}
|
||||
|
||||
int SGBbCache::alloc(int cldId) {
|
||||
// pretend we have no more texture if render to texture is not available
|
||||
if( ! rtAvailable )
|
||||
return -1;
|
||||
for(int i = 0 ; i < bbListCount ; i++) {
|
||||
if( (bbList[i].cldID == 0) && (bbList[i].texID != 0) ) {
|
||||
bbList[i].cldID = cldId;
|
||||
bbList[i].angleX = -999;
|
||||
bbList[i].angleY = -999;
|
||||
bbList[i].frameUsed = 0;
|
||||
bbList[i].needRedraw = true;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
GLuint SGBbCache::QueryTexID(int cldId, int bbId) {
|
||||
if( bbId < 0 || bbId >= bbListCount )
|
||||
return 0;
|
||||
if( bbList[bbId].cldID != cldId )
|
||||
return 0;
|
||||
return bbList[bbId].texID;
|
||||
}
|
||||
|
||||
int SGBbCache::queryImpostorAge(int bbId) {
|
||||
if( bbId < 0 || bbId >= bbListCount )
|
||||
return 0;
|
||||
return frameNumber - bbList[bbId].frame;
|
||||
}
|
||||
|
||||
void SGBbCache::beginCapture(void) {
|
||||
|
||||
rt->BeginCapture();
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SGBbCache::setRadius(float radius, float dist_center) {
|
||||
float border;
|
||||
//set viewport to texture resolution
|
||||
//glViewport(0, 0, 256, 256);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
|
||||
float near_ = dist_center - radius;
|
||||
float far_ = dist_center + radius;
|
||||
if( near_ <= 0 ) {
|
||||
// we are in trouble
|
||||
glFrustum(-1, 1, -1, 1, 1, 1 + radius * 2);
|
||||
} else {
|
||||
border = (near_ * radius) / sqrt(dist_center * dist_center - radius * radius);
|
||||
glFrustum(-border, border, -border, border, near_, far_);
|
||||
}
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
}
|
||||
void SGBbCache::setTextureData(int bbId) {
|
||||
if( bbId < 0 || bbId >= bbListCount )
|
||||
return;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, bbList[bbId].texID);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureWH, textureWH);
|
||||
|
||||
// bbList[bbId].angleX = angleX;
|
||||
// bbList[bbId].angleY = angleY;
|
||||
bbList[bbId].frame = frameNumber;
|
||||
bbList[bbId].frameUsed = frameNumber;
|
||||
bbList[bbId].needRedraw = false;
|
||||
builtBBCount ++;
|
||||
builtBBframe ++;
|
||||
}
|
||||
|
||||
void SGBbCache::endCapture(void) {
|
||||
|
||||
rt->EndCapture();
|
||||
// glBindTexture(GL_TEXTURE_2D, rt->GetTextureID() );
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool SGBbCache::isBbValid( int cldId, int bbId, float angleY, float angleX) {
|
||||
if( bbId < 0 || bbId >= bbListCount )
|
||||
return false;
|
||||
if( bbList[bbId].cldID != cldId )
|
||||
return false;
|
||||
|
||||
// it was just allocated
|
||||
if( bbList[bbId].frameUsed == 0)
|
||||
return false;
|
||||
|
||||
// we reuse old impostor to speed up things
|
||||
if( builtBBframe >= maxImpostorRegenFrame )
|
||||
return true;
|
||||
|
||||
if( bbList[bbId].needRedraw )
|
||||
return false;
|
||||
|
||||
// if( fabs(angleY - bbList[bbId].angleY) >= 4.0 )
|
||||
// return false;
|
||||
|
||||
// if( fabs(angleX - bbList[bbId].angleX) >= 4.0 )
|
||||
// return false;
|
||||
|
||||
bbList[bbId].frameUsed = frameNumber;
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO:this is not the right way to handle that
|
||||
void SGBbCache::setReference( int cldId, int bbId, float angleY, float angleX) {
|
||||
if( bbId < 0 || bbId >= bbListCount )
|
||||
return;
|
||||
if( bbList[bbId].cldID != cldId )
|
||||
return;
|
||||
bbList[bbId].angleX = angleX;
|
||||
bbList[bbId].angleY = angleY;
|
||||
}
|
||||
|
||||
void SGBbCache::startNewFrame(void) {
|
||||
builtBBframe = 0;
|
||||
// TOTO:find reasonable value
|
||||
int minFrameNumber = frameNumber - 100;
|
||||
frameNumber++;
|
||||
// cleanup of unused enties
|
||||
for( int bbId = 0 ; bbId < bbListCount ; bbId++)
|
||||
if( (bbList[bbId].cldID != 0) && (bbList[bbId].frameUsed < minFrameNumber) ) {
|
||||
// entry is now free
|
||||
bbList[bbId].cldID = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// force all impostors to be rebuilt, this will enventually be done over several frames
|
||||
void SGBbCache::invalidateCache(void) {
|
||||
|
||||
for( int bbId = 0 ; bbId < bbListCount ; bbId++)
|
||||
// bbList[bbId].cldID = 0;
|
||||
bbList[bbId].needRedraw = true;
|
||||
}
|
||||
|
||||
// flag the impostor for a lazy update
|
||||
void SGBbCache::invalidate(int cldId, int bbId) {
|
||||
if( bbId < 0 || bbId >= bbListCount )
|
||||
return;
|
||||
if( bbList[bbId].cldID != cldId )
|
||||
return;
|
||||
bbList[bbId].needRedraw = true;
|
||||
}
|
||||
|
||||
@@ -1,205 +0,0 @@
|
||||
// Billboard helper class
|
||||
//
|
||||
// Written by Harald JOHNSEN, started April 2005.
|
||||
//
|
||||
// Copyright (C) 2005 Harald JOHNSEN - hjohnsen@evc.net
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef _BBCACHE_HXX
|
||||
#define _BBCACHE_HXX
|
||||
|
||||
|
||||
#include <plib/sg.h>
|
||||
#include <simgear/screen/extensions.hxx>
|
||||
#include <simgear/screen/RenderTexture.h>
|
||||
|
||||
/**
|
||||
* Billboard helper class.
|
||||
*/
|
||||
class SGBbCache {
|
||||
private:
|
||||
|
||||
/**
|
||||
* storage class for impostors state.
|
||||
*/
|
||||
class bbInfo {
|
||||
public:
|
||||
/// the texture used by this impostor
|
||||
GLuint texID;
|
||||
/// the cloud owning this impostor
|
||||
int cldID;
|
||||
float angleX, angleY;
|
||||
// creation frame number for debug only
|
||||
int frame;
|
||||
/// last time this entry was used
|
||||
int frameUsed;
|
||||
/// dirty flag for lazy rebuild of impostor
|
||||
bool needRedraw;
|
||||
};
|
||||
|
||||
void freeTextureMemory(void);
|
||||
/**
|
||||
* Allocate and initialize the texture pool.
|
||||
* @param count the number of texture to build
|
||||
* @param textureDimension size in pixel of each texture
|
||||
*/
|
||||
bool allocTextureMemory(int count, int textureDimension);
|
||||
|
||||
// a list of impostors
|
||||
bbInfo *bbList;
|
||||
int bbListCount;
|
||||
int textureWH;
|
||||
int cacheSizeKb;
|
||||
|
||||
// for debug only, stats
|
||||
int builtBBCount;
|
||||
// count of generated BB during the current frame
|
||||
int builtBBframe;
|
||||
|
||||
long frameNumber;
|
||||
RenderTexture *rt;
|
||||
bool rtAvailable;
|
||||
|
||||
public:
|
||||
SGBbCache(void);
|
||||
~SGBbCache(void);
|
||||
|
||||
/**
|
||||
* Call this first to initialize the cache.
|
||||
* @param cacheCount the number of texture to allocate
|
||||
*/
|
||||
void init(int cacheCount);
|
||||
|
||||
/**
|
||||
* Free one cache slot, usualy when the cached object is destroyed.
|
||||
* @param bbId the impostor slot
|
||||
* @param cldId the cloud identifier
|
||||
*/
|
||||
void free(int bbId, int cldId);
|
||||
|
||||
/**
|
||||
* Allocate a new impostor.
|
||||
* @param cldId the cloud identifier
|
||||
* @return an impostor slot
|
||||
*/
|
||||
int alloc(int cldId);
|
||||
|
||||
/**
|
||||
* Query the texture name associated with this cloud.
|
||||
* @param bbId the impostor slot
|
||||
* @param cldId the cloud identifier
|
||||
* @return a texture name
|
||||
*/
|
||||
GLuint QueryTexID(int cldId, int bbId);
|
||||
|
||||
/**
|
||||
* Save the rendered texture from the current context to a new texture.
|
||||
* @param bbId the impostor slot
|
||||
*/
|
||||
void setTextureData(int bbId);
|
||||
|
||||
/**
|
||||
* Start the rendering of a billboard in the RTT context.
|
||||
*/
|
||||
void beginCapture(void);
|
||||
|
||||
/**
|
||||
* Adjust the projection matrix of the RTT context to the size of the object.
|
||||
* @param radius radius in meters of the object to draw
|
||||
* @param dist_center distance between viewer and object
|
||||
*/
|
||||
void setRadius(float radius, float dist_center);
|
||||
|
||||
/**
|
||||
* Forget the RTT and go back to the previous rendering context.
|
||||
*/
|
||||
void endCapture(void);
|
||||
|
||||
/**
|
||||
* For debugging only, give the number of frames since the impostor was built.
|
||||
* @param bbId the impostor slot
|
||||
*/
|
||||
int queryImpostorAge(int bbId);
|
||||
|
||||
/**
|
||||
* Can we still use this impostor ? Check versus view angles and load.
|
||||
* @param bbId the impostor slot
|
||||
* @param cloudId the cloud identifier
|
||||
* @param angleY rotation needed to face the impostor
|
||||
* @param angleX rotation needed to face the impostor
|
||||
*/
|
||||
bool isBbValid( int cloudId, int bbId, float angleY, float angleX);
|
||||
|
||||
/**
|
||||
* Save view angles of this billboard.
|
||||
* @param bbId the impostor slot
|
||||
* @param cloudId the cloud identifier
|
||||
* @param angleY rotation needed to face the impostor
|
||||
* @param angleX rotation needed to face the impostor
|
||||
*/
|
||||
void setReference( int cloudId, int bbId, float angleY, float angleX);
|
||||
|
||||
/**
|
||||
* Prepare the cache for the rendering of a new frame.
|
||||
* Do some garbage collect of unused impostors
|
||||
*/
|
||||
void startNewFrame(void);
|
||||
|
||||
/**
|
||||
* Alloc the impostors texture memory given the size of the memory pool.
|
||||
* If sizeKb == 0 then the memory pool is freed and impostors are disabled
|
||||
* @param sizeKb size of the texture pool in K
|
||||
*/
|
||||
bool setCacheSize(int sizeKb);
|
||||
|
||||
/**
|
||||
* Alloc the impostors texture memory given the count and size of texture.
|
||||
* If count == 0 then the memory pool is freed and impostors are disabled
|
||||
* @param count number of texture to allocate
|
||||
* @param textureDimension size of each texture in pixels
|
||||
*/
|
||||
bool setCacheSize(int count, int textureDimension);
|
||||
|
||||
bool isRttAvailable(void) { return rtAvailable; }
|
||||
|
||||
/**
|
||||
* Force all impostors to be rebuilt.
|
||||
*/
|
||||
void invalidateCache(void);
|
||||
|
||||
/**
|
||||
* Flag the impostor for a lazy update.
|
||||
* @param bbId the impostor slot
|
||||
* @param cldId the cloud identifier
|
||||
*/
|
||||
void invalidate(int cldId, int bbId);
|
||||
|
||||
/**
|
||||
* Return the size of the memory pool used by texture impostors.
|
||||
* @return size of the memory pool in Kb
|
||||
*/
|
||||
int queryCacheSize(void);
|
||||
|
||||
/**
|
||||
* Maximum number of impostor to regen each frame.
|
||||
* If we can't update all of them we will do that in the next frame
|
||||
*/
|
||||
int maxImpostorRegenFrame;
|
||||
};
|
||||
|
||||
#endif // _BBCACHE_HXX
|
||||
@@ -54,6 +54,7 @@
|
||||
#include <simgear/scene/model/model.hxx>
|
||||
#include <simgear/scene/util/RenderConstants.hxx>
|
||||
#include <simgear/scene/util/StateAttributeFactory.hxx>
|
||||
#include <simgear/screen/extensions.hxx>
|
||||
|
||||
#include "newcloud.hxx"
|
||||
#include "cloudfield.hxx"
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <iterator>
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
#include <vector>
|
||||
#include <osg/Fog>
|
||||
|
||||
#include "bbcache.hxx"
|
||||
|
||||
#include <simgear/scene/material/Effect.hxx>
|
||||
#include <simgear/scene/material/EffectGeode.hxx>
|
||||
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <simgear_config.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <string.h> // memcpy()
|
||||
|
||||
#include "GLBitmaps.h"
|
||||
|
||||
GlBitmap::GlBitmap( GLenum mode, GLint width, GLint height, GLubyte *bitmap )
|
||||
: m_bytesPerPixel(mode==GL_RGB?3:4), m_width(width), m_height(height), m_bitmap(NULL)
|
||||
{
|
||||
m_bitmapSize = m_bytesPerPixel*m_width*m_height;
|
||||
if ( !m_bitmapSize )
|
||||
{
|
||||
GLint vp[4];
|
||||
glGetIntegerv( GL_VIEWPORT, vp );
|
||||
m_width = vp[2];
|
||||
m_height = vp[3];
|
||||
m_bitmapSize = m_bytesPerPixel*m_width*m_height;
|
||||
}
|
||||
m_bitmap = (GLubyte *)malloc( m_bitmapSize );
|
||||
if ( bitmap ) memcpy( m_bitmap, bitmap, m_bitmapSize );
|
||||
else glReadPixels( 0,0, m_width,m_height, mode, GL_UNSIGNED_BYTE, m_bitmap );
|
||||
}
|
||||
|
||||
GlBitmap::~GlBitmap( )
|
||||
{
|
||||
if ( m_bitmap ) free( m_bitmap );
|
||||
}
|
||||
|
||||
GLubyte *GlBitmap::getBitmap()
|
||||
{
|
||||
return m_bitmap;
|
||||
}
|
||||
|
||||
void GlBitmap::copyBitmap( GlBitmap *from, GLint at_x, GLint at_y )
|
||||
{
|
||||
GLint newWidth = at_x + from->m_width;
|
||||
GLint newHeight = at_y + from->m_height;
|
||||
if ( newWidth < m_width ) newWidth = m_width;
|
||||
if ( newHeight < m_height ) newHeight = m_height;
|
||||
m_bitmapSize = m_bytesPerPixel*newWidth*newHeight;
|
||||
GLubyte *newBitmap = (GLubyte *)malloc( m_bitmapSize );
|
||||
GLint x,y;
|
||||
for ( y=0; y<m_height; y++ )
|
||||
{
|
||||
GLubyte *s = m_bitmap + m_bytesPerPixel * (y * m_width);
|
||||
GLubyte *d = newBitmap + m_bytesPerPixel * (y * newWidth);
|
||||
memcpy( d, s, m_bytesPerPixel * m_width );
|
||||
}
|
||||
m_width = newWidth;
|
||||
m_height = newHeight;
|
||||
free( m_bitmap );
|
||||
m_bitmap = newBitmap;
|
||||
for ( y=0; y<from->m_height; y++ )
|
||||
{
|
||||
GLubyte *s = from->m_bitmap + from->m_bytesPerPixel * (y * from->m_width);
|
||||
GLubyte *d = m_bitmap + m_bytesPerPixel * ((at_y+y) * m_width + at_x);
|
||||
for ( x=0; x<from->m_width; x++ )
|
||||
{
|
||||
d[0] = s[0];
|
||||
d[1] = s[1];
|
||||
d[2] = s[2];
|
||||
if ( m_bytesPerPixel == 4 )
|
||||
{
|
||||
d[3] = (from->m_bytesPerPixel == 4) ? s[3] : 0;
|
||||
}
|
||||
s += from->m_bytesPerPixel;
|
||||
d += m_bytesPerPixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include <osg/GL>
|
||||
|
||||
class GlBitmap
|
||||
{
|
||||
public:
|
||||
GlBitmap( GLenum mode=GL_RGB, GLint width=0, GLint height=0, GLubyte *bitmap=0 );
|
||||
~GlBitmap();
|
||||
GLubyte *getBitmap();
|
||||
void copyBitmap( GlBitmap *from, GLint at_x, GLint at_y );
|
||||
private:
|
||||
GLint m_bytesPerPixel;
|
||||
GLint m_width;
|
||||
GLint m_height;
|
||||
GLint m_bitmapSize;
|
||||
GLubyte *m_bitmap;
|
||||
};
|
||||
@@ -12,37 +12,19 @@ IMAGE_SERVER_INCL =
|
||||
IMAGE_SERVER_SRCS =
|
||||
endif
|
||||
|
||||
noinst_HEADERS = GLBitmaps.h
|
||||
|
||||
include_HEADERS = \
|
||||
colors.hxx \
|
||||
$(IMAGE_SERVER_INCL) \
|
||||
screen-dump.hxx \
|
||||
extensions.hxx \
|
||||
RenderTexture.h \
|
||||
shader.h \
|
||||
tr.h
|
||||
colors.hxx \
|
||||
tr.h \
|
||||
extensions.hxx
|
||||
|
||||
libsgscreen_a_SOURCES = \
|
||||
GLBitmaps.cxx \
|
||||
$(IMAGE_SERVER_SRCS) \
|
||||
screen-dump.cxx \
|
||||
tr.cxx \
|
||||
extensions.cxx \
|
||||
RenderTexture.cpp \
|
||||
shader.cpp \
|
||||
win32-printer.h
|
||||
extensions.cxx
|
||||
|
||||
|
||||
if HAVE_GLUT
|
||||
noinst_PROGRAMS = TestRenderTexture
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_builddir)
|
||||
|
||||
TestRenderTexture_SOURCES = TestRenderTexture.cpp
|
||||
|
||||
TestRenderTexture_LDADD = \
|
||||
libsgscreen.a \
|
||||
$(top_builddir)/simgear/debug/libsgdebug.a \
|
||||
$(opengl_LIBS) \
|
||||
-ldl
|
||||
endif
|
||||
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_builddir) -DGLX_GLXEXT_PROTOTYPES
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,375 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File : RenderTexture.h
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2004 Mark J. Harris
|
||||
//---------------------------------------------------------------------------
|
||||
// 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.
|
||||
//
|
||||
// -----------------------------------------------------------------------------
|
||||
// Credits:
|
||||
// Original RenderTexture code: Mark J. Harris
|
||||
// Original Render-to-depth-texture support: Thorsten Scheuermann
|
||||
// Linux Copy-to-texture: Eric Werness
|
||||
// OS X: Alexander Powell (someone please help)
|
||||
// Various Bug Fixes: Daniel (Redge) Sperl
|
||||
// Bill Baxter
|
||||
//
|
||||
// -----------------------------------------------------------------------------
|
||||
/**
|
||||
* @file RenderTexture.h
|
||||
*
|
||||
* Interface definition for class RenderTexture. A multi-format render to
|
||||
* texture wrapper.
|
||||
*/
|
||||
#ifndef __RENDERTEXTURE2_HPP__
|
||||
#define __RENDERTEXTURE2_HPP__
|
||||
|
||||
|
||||
/*
|
||||
* Changelog:
|
||||
*
|
||||
* Jan. 2005, Removed GLEW dependencies, Erik Hofman
|
||||
* Mar. 2006, Added MAC OS X support, Alexander Powell
|
||||
*/
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include <osg/GL>
|
||||
|
||||
#if defined( __APPLE__)
|
||||
# include <OpenGL/OpenGL.h>
|
||||
#endif
|
||||
|
||||
#if !defined( _WIN32 ) && !defined( __APPLE__ )
|
||||
# include <X11/Xlib.h>
|
||||
# include <GL/glx.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/* The pixel format for the pbuffer is controlled by the mode string passed
|
||||
* into the PBuffer constructor. This string can have the following attributes:
|
||||
*
|
||||
* To specify the pixel format, use the following syntax.
|
||||
* <channels>=<bits>
|
||||
* <channels> must match one of the following.
|
||||
*
|
||||
* r - r pixel format (for float buffer).
|
||||
* rg - rg pixel format (for float buffer).
|
||||
* rgb - rgb pixel format. 8 bit or 16/32 bit in float buffer mode
|
||||
* rgba - same as "rgb alpha" string
|
||||
*
|
||||
* <bits> can either be a scalar--meaning the same bit depth for each
|
||||
* channel-- or a 2-, 3-, 4-component vector matching the specified number of
|
||||
* channels. Vector components should be comma separated. An optional 'f'
|
||||
* suffix on the bit depth specifies float components. In this case <bits>
|
||||
* must be either "32f" or "16f". If <bits> is empty, the default 8 bits per
|
||||
* channel will be used.
|
||||
* r=32f
|
||||
* rg=16f
|
||||
* rgb=8
|
||||
* rgb=5,6,5
|
||||
*
|
||||
* The following other attributes are supported.
|
||||
*
|
||||
* depth=n - must have n-bit depth buffer, omit n for default (24 bits)
|
||||
* stencil=n - must have n-bit stencil buffer, omit n for default (8 bits)
|
||||
* samples=n - must support n-sample antialiasing (n can be 2 or 4)
|
||||
* aux=n - must have n AUX buffers
|
||||
* doublebuffer - must support double buffered rendering
|
||||
*
|
||||
* tex2D
|
||||
* texRECT
|
||||
* texCUBE - must support binding pbuffer as texture to specified target
|
||||
* - binding the depth buffer is also supported by specifying
|
||||
* depthTex2D
|
||||
* depthTexRECT
|
||||
* depthTexCUBE
|
||||
* - Both depth and color texture binding, may be specified, but
|
||||
* the targets must match!
|
||||
* For example: "tex2D depthTex2D" or "texRECT depthTexRECT"
|
||||
*
|
||||
* rtt
|
||||
* ctt - These mutually exclusive options specify the update method used
|
||||
* for render textures that support texture binding. "rtt"
|
||||
* indicates that render to texture will be used to update the
|
||||
* texture. "ctt" indicates that copy to texture will be used
|
||||
* (i.e. glCopyTexSubImage2D()). "rtt" is the default if neither is
|
||||
* specified, and one of the "tex*" options above is.
|
||||
*
|
||||
*
|
||||
*---------------------------------------------------------------------------
|
||||
*
|
||||
* USAGE NOTES:
|
||||
*
|
||||
* * Texture Parameters:
|
||||
* The default texture wrap mode is GL_CLAMP_TO_EDGE for all textures, and
|
||||
* the default texture filtering modes (min and mag) are GL_NEAREST.
|
||||
* To change these parameters, simply bind the RenderTexture (using the
|
||||
* Bind() method), and set them the way you would for any GL texture object.
|
||||
* The same goes for depth textures.
|
||||
*
|
||||
* * Enabling Mipmapping:
|
||||
* This is similar to the texture parameters above. When "rtt" is specified
|
||||
* in the mode string, "mipmap" must also be specified in order to enable
|
||||
* a mipmapped pbuffer. Then, the mipmaps must be created by enabling the
|
||||
* GL_SGIS_GENERATE_MIPMAP texture parameter in the same way as above, and
|
||||
* the min filter mode must be set to a mipmap filter mode, as with any
|
||||
* mipmapped texture object.
|
||||
*
|
||||
* * Enabling Anisotropic Filtering
|
||||
* As with the texture parameters above, except as in the following code:
|
||||
* glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, max);
|
||||
* glTexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, <value < max>);
|
||||
*/
|
||||
class RenderTexture
|
||||
{
|
||||
public: // enums
|
||||
enum UpdateMode
|
||||
{
|
||||
RT_RENDER_TO_TEXTURE,
|
||||
RT_COPY_TO_TEXTURE
|
||||
};
|
||||
|
||||
public: // interface
|
||||
// ctor / dtor
|
||||
RenderTexture(const char *strMode="rgb tex2D");
|
||||
~RenderTexture();
|
||||
|
||||
//! Call this once before use. Set bShare to true to share lists, textures,
|
||||
//! and program objects between the render texture context and the
|
||||
//! current active GL context.
|
||||
bool Initialize(int width, int height,
|
||||
bool shareObjects=true,
|
||||
bool copyContext=false);
|
||||
|
||||
// !Change the render texture format.
|
||||
bool Reset(const char* strMode,...);
|
||||
// !Change the size of the render texture.
|
||||
bool Resize(int width, int height);
|
||||
|
||||
// !Begin drawing to the texture. (i.e. use as "output" texture)
|
||||
bool BeginCapture();
|
||||
// !Ends drawing to 'current', begins drawing to this RenderTexture
|
||||
bool BeginCapture(RenderTexture* current);
|
||||
// !End drawing to the texture.
|
||||
bool EndCapture();
|
||||
|
||||
// !Bind the texture to the active texture unit for use as an "input" texture
|
||||
void Bind() const;
|
||||
|
||||
// !Bind the depth texture to the active texture unit for use as an "input" texture
|
||||
void BindDepth() const;
|
||||
|
||||
// !Associate the RTT texture with 'iBuffer' (default is WGL_FRONT_LEFT_ARB)
|
||||
bool BindBuffer( int iBuffer );
|
||||
|
||||
//! Enables the texture target appropriate for this render texture.
|
||||
void EnableTextureTarget() const
|
||||
{ if (_bInitialized) glEnable(_iTextureTarget); }
|
||||
//! Disables the texture target appropriate for this render texture.
|
||||
void DisableTextureTarget() const
|
||||
{ if (_bInitialized) glDisable(_iTextureTarget); }
|
||||
|
||||
//! Returns the texture ID. Useful in Cg applications.
|
||||
unsigned int GetTextureID() const { return _iTextureID; }
|
||||
//! Returns the depth texture ID. Useful in Cg applications.
|
||||
unsigned int GetDepthTextureID() const { return _iDepthTextureID; }
|
||||
//! Returns the texture target this texture is bound to.
|
||||
unsigned int GetTextureTarget() const { return _iTextureTarget; }
|
||||
//! Conversion operator allows RenderTexture to be passed to GL calls
|
||||
operator unsigned int()const{return _iTextureID;}
|
||||
|
||||
//! Returns the width of the offscreen buffer.
|
||||
int GetWidth() const { return _iWidth; }
|
||||
//! Returns the width of the offscreen buffer.
|
||||
int GetHeight() const { return _iHeight; }
|
||||
//! Returns the maximum S texture coordinate.
|
||||
int GetMaxS() const { return IsRectangleTexture() ? _iWidth : 1; }
|
||||
//! Returns the maximum T texture coordinate.
|
||||
int GetMaxT() const { return IsRectangleTexture() ? _iHeight : 1; }
|
||||
|
||||
//! Returns the number of red bits allocated.
|
||||
int GetRedBits() const { return _iNumColorBits[0]; }
|
||||
//! Returns the number of green bits allocated.
|
||||
int GetGreenBits() const { return _iNumColorBits[1]; }
|
||||
//! Returns the number of blue bits allocated.
|
||||
int GetBlueBits() const { return _iNumColorBits[2]; }
|
||||
//! Returns the number of alpha bits allocated.
|
||||
int GetAlphaBits() const { return _iNumColorBits[3]; }
|
||||
|
||||
//! Returns the number of depth bits allocated.
|
||||
int GetDepthBits() const { return _iNumDepthBits; }
|
||||
//! Returns the number of stencil bits allocated.
|
||||
int GetStencilBits() const { return _iNumStencilBits; }
|
||||
|
||||
//! True if this RenderTexture has been properly initialized.
|
||||
bool IsInitialized() const { return _bInitialized; }
|
||||
//! True if this is a texture and not just an offscreen buffer.
|
||||
bool IsTexture() const { return _bIsTexture; }
|
||||
//! True if this is a depth texture and not just an offscreen buffer.
|
||||
bool IsDepthTexture() const { return _bIsDepthTexture; }
|
||||
//! True if this is a floating point buffer / texture.
|
||||
bool IsFloatTexture() const { return _bFloat; }
|
||||
//! True if this is a double-buffered pbuffer
|
||||
bool IsDoubleBuffered() const { return _bDoubleBuffered; }
|
||||
//! True if this texture has non-power-of-two dimensions.
|
||||
bool IsRectangleTexture() const { return _bRectangle; }
|
||||
//! True if this texture has non-power-of-two dimensions.
|
||||
//! True if this pbuffer has a depth buffer.
|
||||
bool HasDepth() const { return (_iNumDepthBits > 0); }
|
||||
//! True if this pbuffer has a stencil buffer.
|
||||
bool HasStencil() const { return (_iNumStencilBits > 0); }
|
||||
//! True if this texture has mipmaps.
|
||||
bool IsMipmapped() const { return _bMipmap; }
|
||||
|
||||
/**
|
||||
* @fn IsPowerOfTwo(int n)
|
||||
* @brief Returns true if /param n is an integer power of 2.
|
||||
*
|
||||
* Taken from Steve Baker's Cute Code Collection.
|
||||
* http://www.sjbaker.org/steve/software/cute_code.html
|
||||
*/
|
||||
static bool IsPowerOfTwo(int n) { return ((n&(n-1))==0); }
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// This is the deprecated (old) interface. It will likely be removed
|
||||
// in a future version, so it is recommended that you transition to the
|
||||
// new mode-string-based interface.
|
||||
RenderTexture(int width, int height,
|
||||
bool bIsTexture = true,
|
||||
bool bIsDepthTexture = false);
|
||||
//
|
||||
// Call this once before use. Set bShare to true to share lists,
|
||||
// textures, and program objects between the render texture context
|
||||
// and the current active GL context. [deprecated]
|
||||
bool Initialize(bool bShare = true,
|
||||
bool bDepth = false,
|
||||
bool bStencil = false,
|
||||
bool bMipmap = false,
|
||||
bool bAnisoFilter = false,
|
||||
unsigned int iRBits = 8,
|
||||
unsigned int iGBits = 8,
|
||||
unsigned int iBBits = 8,
|
||||
unsigned int iABits = 8,
|
||||
// Only Win32 has RT now, so only make it default there
|
||||
#ifdef _WIN32
|
||||
UpdateMode updateMode = RT_RENDER_TO_TEXTURE
|
||||
#else
|
||||
UpdateMode updateMode = RT_COPY_TO_TEXTURE
|
||||
#endif
|
||||
);
|
||||
// !Change the render texture resolution. [deprecated]
|
||||
bool Reset(int iWidth, int iHeight);
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
protected: // methods
|
||||
bool _Invalidate();
|
||||
|
||||
typedef std::pair<std::string, std::string> KeyVal;
|
||||
|
||||
void _ParseModeString(const char *modeString,
|
||||
std::vector<int> &pixelFormatAttribs,
|
||||
std::vector<int> &pbufferAttribs);
|
||||
|
||||
std::vector<int> _ParseBitVector(std::string bitVector);
|
||||
KeyVal _GetKeyValuePair(std::string token);
|
||||
|
||||
|
||||
bool _VerifyExtensions();
|
||||
bool _InitializeTextures();
|
||||
|
||||
void _MaybeCopyBuffer();
|
||||
bool _ReleaseBoundBuffers();
|
||||
bool _MakeCurrent();
|
||||
bool _BindDepthBuffer( ) const;
|
||||
|
||||
protected: // data
|
||||
int _iWidth; // width of the pbuffer
|
||||
int _iHeight; // height of the pbuffer
|
||||
|
||||
bool _bIsTexture;
|
||||
bool _bIsDepthTexture;
|
||||
bool _bHasARBDepthTexture; // [Redge]
|
||||
|
||||
UpdateMode _eUpdateMode;
|
||||
|
||||
bool _bInitialized;
|
||||
|
||||
unsigned int _iNumAuxBuffers;
|
||||
bool _bIsBufferBound;
|
||||
int _iCurrentBoundBuffer;
|
||||
|
||||
unsigned int _iNumComponents;
|
||||
unsigned int _iNumColorBits[4];
|
||||
unsigned int _iNumDepthBits;
|
||||
unsigned int _iNumStencilBits;
|
||||
|
||||
|
||||
bool _bFloat;
|
||||
bool _bDoubleBuffered;
|
||||
bool _bPowerOf2;
|
||||
bool _bRectangle;
|
||||
bool _bMipmap;
|
||||
|
||||
bool _bShareObjects;
|
||||
bool _bCopyContext;
|
||||
|
||||
#ifdef _WIN32
|
||||
HDC _hDC; // Handle to a device context.
|
||||
HGLRC _hGLContext; // Handle to a GL context.
|
||||
HPBUFFERARB _hPBuffer; // Handle to a pbuffer.
|
||||
|
||||
HDC _hPreviousDC;
|
||||
HGLRC _hPreviousContext;
|
||||
#elif defined( __MACH__ )
|
||||
CGLContextObj _hGLContext;
|
||||
CGLPBufferObj _hPBuffer;
|
||||
|
||||
CGLContextObj _hPreviousContext;
|
||||
#else
|
||||
Display *_pDisplay;
|
||||
GLXContext _hGLContext;
|
||||
GLXPbuffer _hPBuffer;
|
||||
|
||||
GLXDrawable _hPreviousDrawable;
|
||||
GLXContext _hPreviousContext;
|
||||
#endif
|
||||
|
||||
// Texture stuff
|
||||
GLenum _iTextureTarget;
|
||||
GLuint _iTextureID;
|
||||
GLuint _iDepthTextureID;
|
||||
|
||||
unsigned short* _pPoorDepthTexture; // [Redge]
|
||||
|
||||
std::vector<int> _pixelFormatAttribs;
|
||||
std::vector<int> _pbufferAttribs;
|
||||
|
||||
private:
|
||||
// Using these could lead to some odd behavior
|
||||
RenderTexture(const RenderTexture&);
|
||||
RenderTexture& operator=(const RenderTexture&);
|
||||
};
|
||||
|
||||
#endif //__RENDERTEXTURE2_HPP__
|
||||
@@ -1,378 +0,0 @@
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <simgear/simgear_config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include <osg/GL>
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include <GLUT/glut.h>
|
||||
#else
|
||||
# include <GL/glut.h>
|
||||
#endif
|
||||
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/screen/extensions.hxx>
|
||||
#include <simgear/screen/RenderTexture.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// DEBUG - add a lot of noise
|
||||
//#ifndef _DEBUG
|
||||
//#define _DEBUG
|
||||
//#endif
|
||||
|
||||
#if defined (_DEBUG)
|
||||
const char * get_attr_name( int val, int * pdef );
|
||||
#define dbg_printf printf
|
||||
#else
|
||||
#if defined (__GNUC__)
|
||||
#define dbg_printf(format,args...) ((void)0)
|
||||
#else // defined (__GNUC__)
|
||||
#define dbg_printf
|
||||
#endif // defined (__GNUC__)
|
||||
#endif // defined (_DEBUG)
|
||||
|
||||
|
||||
void Reshape(int w, int h);
|
||||
|
||||
GLuint iTextureProgram = 0;
|
||||
GLuint iPassThroughProgram = 0;
|
||||
|
||||
RenderTexture *rt = NULL;
|
||||
|
||||
float rectAngle = 0;
|
||||
float torusAngle = 0;
|
||||
bool bTorusMotion = true;
|
||||
bool bRectMotion = true;
|
||||
bool bShowDepthTexture = false;
|
||||
|
||||
static const char *g_modeTestStrings[] =
|
||||
{
|
||||
"rgb tex2D",
|
||||
"rgba tex2D depthTex2D",
|
||||
"rgba=8 depthTexRECT ctt",
|
||||
"rgba samples=4 tex2D ctt",
|
||||
"rgba=8 tex2D mipmap",
|
||||
"rgb=5,6,5 tex2D",
|
||||
"rgba=16f texRECT",
|
||||
"rgba=32f texRECT depthTexRECT",
|
||||
"rgba=16f texRECT depthTexRECT ctt",
|
||||
"r=32f texRECT depth ctt",
|
||||
"rgb double tex2D",
|
||||
"r=32f texRECT ctt aux=4"
|
||||
};
|
||||
|
||||
static int g_numModeTestStrings = sizeof(g_modeTestStrings) / sizeof(char*);
|
||||
static int g_currentString = 0;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Function : PrintGLerror
|
||||
// Description :
|
||||
//---------------------------------------------------------------------------
|
||||
void PrintGLerror( const char *msg )
|
||||
{
|
||||
GLenum errCode;
|
||||
const GLubyte *errStr;
|
||||
|
||||
if ((errCode = glGetError()) != GL_NO_ERROR)
|
||||
{
|
||||
errStr = gluErrorString(errCode);
|
||||
fprintf(stderr,"OpenGL ERROR: %s: %s\n", errStr, msg);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Function : CreateRenderTexture
|
||||
// Description :
|
||||
//---------------------------------------------------------------------------
|
||||
RenderTexture* CreateRenderTexture(const char *initstr)
|
||||
{
|
||||
printf("\nCreating with init string: \"%s\"\n", initstr);
|
||||
|
||||
int texWidth = 256, texHeight = 256;
|
||||
|
||||
// Test deprecated interface
|
||||
//RenderTexture *rt2 = new RenderTexture(texWidth, texHeight);
|
||||
//if (!rt2->Initialize(true,false,false,false,false,8,8,8,0))
|
||||
|
||||
RenderTexture *rt2 = new RenderTexture();
|
||||
rt2->Reset(initstr);
|
||||
if (!rt2->Initialize(texWidth, texHeight))
|
||||
{
|
||||
fprintf(stderr, "RenderTexture Initialization failed!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("RenderTexture Initialization done.\n");
|
||||
}
|
||||
|
||||
// for shadow mapping we still have to bind it and set the correct
|
||||
// texture parameters using the SGI_shadow or ARB_shadow extension
|
||||
// setup the rendering context for the RenderTexture
|
||||
if (rt2->BeginCapture())
|
||||
{
|
||||
Reshape(texWidth, texHeight);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
gluLookAt(0, 0, 3, 0, 0, 0, 0, 1, 0);
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glClearColor(0.2, 0.2, 0.2, 1);
|
||||
rt2->EndCapture();
|
||||
}
|
||||
|
||||
// enable linear filtering if available
|
||||
if (rt2->IsTexture() || rt2->IsDepthTexture())
|
||||
{
|
||||
if (rt2->IsMipmapped())
|
||||
{
|
||||
// Enable trilinear filtering so we can see the mipmapping
|
||||
if (rt2->IsTexture())
|
||||
{
|
||||
rt2->Bind();
|
||||
glTexParameteri(rt2->GetTextureTarget(),
|
||||
GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
glTexParameteri(rt2->GetTextureTarget(),
|
||||
GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(rt2->GetTextureTarget(),
|
||||
GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
|
||||
}
|
||||
|
||||
if (rt2->IsDepthTexture())
|
||||
{
|
||||
rt2->BindDepth();
|
||||
glTexParameteri(rt2->GetTextureTarget(),
|
||||
GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
glTexParameteri(rt2->GetTextureTarget(),
|
||||
GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(rt2->GetTextureTarget(),
|
||||
GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
|
||||
}
|
||||
}
|
||||
else if (!(rt2->IsRectangleTexture() || rt2->IsFloatTexture()))
|
||||
{
|
||||
if (rt2->IsTexture())
|
||||
{
|
||||
rt2->Bind();
|
||||
glTexParameteri(rt2->GetTextureTarget(),
|
||||
GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(rt2->GetTextureTarget(),
|
||||
GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
}
|
||||
|
||||
if (rt2->IsDepthTexture())
|
||||
{
|
||||
rt2->BindDepth();
|
||||
glTexParameteri(rt2->GetTextureTarget(),
|
||||
GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(rt2->GetTextureTarget(),
|
||||
GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rt2->IsDepthTexture())
|
||||
{
|
||||
fprintf(stderr,
|
||||
"\nPress the spacebar to toggle color / depth textures.\n");
|
||||
if (!rt2->IsTexture())
|
||||
bShowDepthTexture = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rt2->IsTexture())
|
||||
bShowDepthTexture = false;
|
||||
}
|
||||
|
||||
PrintGLerror("Create");
|
||||
return rt2;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Function : DestroyRenderTexture
|
||||
// Description :
|
||||
//---------------------------------------------------------------------------
|
||||
void DestroyRenderTexture(RenderTexture *rt2)
|
||||
{
|
||||
delete rt2;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Function : Keyboard
|
||||
// Description :
|
||||
//---------------------------------------------------------------------------
|
||||
void Keyboard(unsigned char key, int x, int y)
|
||||
{
|
||||
switch(key)
|
||||
{
|
||||
case 27:
|
||||
case 'q':
|
||||
exit(0);
|
||||
break;
|
||||
case ' ':
|
||||
bShowDepthTexture = !bShowDepthTexture;
|
||||
break;
|
||||
case 13:
|
||||
++g_currentString %= g_numModeTestStrings;
|
||||
dbg_printf("Changed to #%d = [%s]\n", g_currentString, g_modeTestStrings[g_currentString]);
|
||||
DestroyRenderTexture(rt);
|
||||
rt = CreateRenderTexture(g_modeTestStrings[g_currentString]);
|
||||
break;
|
||||
case 't':
|
||||
bTorusMotion = !bTorusMotion;
|
||||
break;
|
||||
case 'r':
|
||||
bRectMotion = !bRectMotion;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Function : Idle
|
||||
// Description :
|
||||
//---------------------------------------------------------------------------
|
||||
void Idle()
|
||||
{
|
||||
// make sure we don't try to display nonexistent textures
|
||||
if (!rt->IsDepthTexture())
|
||||
bShowDepthTexture = false;
|
||||
|
||||
if (bRectMotion) rectAngle += 1;
|
||||
if (bTorusMotion) torusAngle += 1;
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Function : Reshape
|
||||
// Description :
|
||||
//---------------------------------------------------------------------------
|
||||
void Reshape(int w, int h)
|
||||
{
|
||||
if (h == 0) h = 1;
|
||||
|
||||
glViewport(0, 0, w, h);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
|
||||
gluPerspective(60.0, (GLfloat)w/(GLfloat)h, 1, 5.0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Function : Display
|
||||
// Description :
|
||||
//---------------------------------------------------------------------------
|
||||
void _Display()
|
||||
{
|
||||
if (rt->IsInitialized() && rt->BeginCapture())
|
||||
{
|
||||
if (rt->IsDoubleBuffered()) glDrawBuffer(GL_BACK);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
|
||||
glRotatef(torusAngle, 1, 0, 0);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glColor3f(1,1,0);
|
||||
|
||||
glutSolidTorus(0.25, 1, 32, 64);
|
||||
|
||||
glPopMatrix();
|
||||
PrintGLerror("RT Update");
|
||||
|
||||
rt->EndCapture();
|
||||
}
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glColor3f(1, 1, 1);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glRotatef(rectAngle / 10, 0, 1, 0);
|
||||
|
||||
if(bShowDepthTexture && rt->IsDepthTexture())
|
||||
rt->BindDepth();
|
||||
else if (rt->IsTexture()) {
|
||||
rt->Bind();
|
||||
}
|
||||
|
||||
rt->EnableTextureTarget();
|
||||
|
||||
int maxS = rt->GetMaxS();
|
||||
int maxT = rt->GetMaxT();
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0); glVertex2f(-1, -1);
|
||||
glTexCoord2f(maxS, 0); glVertex2f( 1, -1);
|
||||
glTexCoord2f(maxS, maxT); glVertex2f( 1, 1);
|
||||
glTexCoord2f(0, maxT); glVertex2f(-1, 1);
|
||||
glEnd();
|
||||
|
||||
rt->DisableTextureTarget();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
PrintGLerror("display");
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Function : main
|
||||
// Description :
|
||||
//---------------------------------------------------------------------------
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int argn = argc;
|
||||
glutInit(&argn, argv);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
|
||||
glutInitWindowPosition(50, 50);
|
||||
glutInitWindowSize(512, 512);
|
||||
glutCreateWindow("TestRenderTexture");
|
||||
|
||||
glutDisplayFunc(_Display);
|
||||
glutIdleFunc(Idle);
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Keyboard);
|
||||
|
||||
Reshape(512, 512);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
gluLookAt(0, 0, 2, 0, 0, 0, 0, 1, 0);
|
||||
glDisable(GL_LIGHTING);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glClearColor(0.4, 0.6, 0.8, 1);
|
||||
|
||||
|
||||
rt = CreateRenderTexture(g_modeTestStrings[g_currentString]);
|
||||
|
||||
if (rt->IsInitialized() && rt->BeginCapture()) {
|
||||
rt->EndCapture();
|
||||
dbg_printf("Torus should also be shown.\n");
|
||||
} else {
|
||||
dbg_printf("No Torus init = %s\n", (rt->IsInitialized() ? "ok" : "NOT INITIALISED"));
|
||||
}
|
||||
|
||||
printf("Press Enter to change RenderTexture parameters.\n"
|
||||
"Press 'r' to toggle the rectangle's motion.\n"
|
||||
"Press 't' to toggle the torus' motion.\n");
|
||||
|
||||
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -22,13 +22,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "extensions.hxx"
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#if !defined(WIN32)
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#include <cstring>
|
||||
#include <osg/GL> // for glGetString
|
||||
|
||||
bool SGSearchExtensionsString(const char *extString, const char *extName) {
|
||||
// Returns GL_TRUE if the *extName string appears in the *extString string,
|
||||
@@ -65,89 +63,3 @@ bool SGIsOpenGLExtensionSupported(const char *extName) {
|
||||
|
||||
return SGSearchExtensionsString((const char *)glGetString(GL_EXTENSIONS),extName);
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
void* macosxGetGLProcAddress(const char *func) {
|
||||
|
||||
/* We may want to cache the bundleRef at some point */
|
||||
static CFBundleRef bundle = 0;
|
||||
|
||||
if (!bundle) {
|
||||
|
||||
CFURLRef bundleURL = CFURLCreateWithFileSystemPath (kCFAllocatorDefault,
|
||||
CFSTR("/System/Library/Frameworks/OpenGL.framework"), kCFURLPOSIXPathStyle, true);
|
||||
|
||||
bundle = CFBundleCreate (kCFAllocatorDefault, bundleURL);
|
||||
CFRelease (bundleURL);
|
||||
}
|
||||
|
||||
if (!bundle)
|
||||
return 0;
|
||||
|
||||
CFStringRef functionName = CFStringCreateWithCString
|
||||
(kCFAllocatorDefault, func, kCFStringEncodingASCII);
|
||||
|
||||
void *function;
|
||||
|
||||
function = CFBundleGetFunctionPointerForName (bundle, functionName);
|
||||
|
||||
CFRelease (functionName);
|
||||
|
||||
return function;
|
||||
}
|
||||
|
||||
#elif !defined( WIN32 )
|
||||
|
||||
void *SGGetGLProcAddress(const char *func) {
|
||||
static void *libHandle = NULL;
|
||||
static void *(*glXGetProcAddressPtr)(const GLubyte*) = 0;
|
||||
void *fptr = NULL;
|
||||
|
||||
/*
|
||||
* Clear the error buffer
|
||||
*/
|
||||
dlerror();
|
||||
|
||||
/*
|
||||
* Since libGL must be linked to the binary we run on, this is the
|
||||
* right handle. That 'current binary' handle also avoids conflicts which
|
||||
* arise from linking with a different libGL at link time an than later
|
||||
* use the standard libGL at runtime ...
|
||||
*/
|
||||
if (libHandle == NULL) {
|
||||
libHandle = dlopen(NULL, RTLD_LAZY);
|
||||
|
||||
if (!libHandle) {
|
||||
const char *error = dlerror();
|
||||
if (error) {
|
||||
SG_LOG(SG_GENERAL, SG_INFO, error);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void* symbol = dlsym(libHandle, "glXGetProcAddress");
|
||||
if (!symbol)
|
||||
symbol = dlsym(libHandle, "glXGetProcAddressARB");
|
||||
glXGetProcAddressPtr = (void *(*)(const GLubyte*)) symbol;
|
||||
}
|
||||
|
||||
// First try the glx api function for that
|
||||
if (glXGetProcAddressPtr) {
|
||||
fptr = glXGetProcAddressPtr((const GLubyte*)func);
|
||||
|
||||
} else if (libHandle != NULL) {
|
||||
fptr = dlsym(libHandle, func);
|
||||
|
||||
const char *error = dlerror();
|
||||
if (error)
|
||||
SG_LOG(SG_GENERAL, SG_INFO, error);
|
||||
}
|
||||
|
||||
return fptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -24,945 +24,11 @@
|
||||
#ifndef __SG_EXTENSIONS_HXX
|
||||
#define __SG_EXTENSIONS_HXX 1
|
||||
|
||||
#ifdef WIN32
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include <osg/GL>
|
||||
|
||||
#if !defined(__APPLE__) && !defined(WIN32)
|
||||
# include <GL/glx.h>
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
|
||||
bool SGSearchExtensionsString(const char *extString, const char *extName);
|
||||
bool SGIsOpenGLExtensionSupported(const char *extName);
|
||||
|
||||
#ifdef __APPLE__
|
||||
// don't use an inline function for symbol lookup, since it is too big
|
||||
void* macosxGetGLProcAddress(const char *func);
|
||||
|
||||
#elif !defined( WIN32 )
|
||||
|
||||
void *SGGetGLProcAddress(const char *func);
|
||||
|
||||
#endif
|
||||
|
||||
inline void (*SGLookupFunction(const char *func))()
|
||||
{
|
||||
#if defined( WIN32 )
|
||||
return (void (*)()) wglGetProcAddress(func);
|
||||
|
||||
#elif defined( __APPLE__ )
|
||||
return (void (*)()) macosxGetGLProcAddress(func);
|
||||
|
||||
#else // UNIX, default
|
||||
return (void (*)()) SGGetGLProcAddress(func);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* OpenGL 1.2 and 1.3 enumerants
|
||||
*/
|
||||
|
||||
#ifndef GL_VERSION_1_2
|
||||
#define GL_CLAMP_TO_EDGE 0x812F
|
||||
#define GL_TEXTURE_WRAP_R 0x8072
|
||||
#define GL_BLEND_EQUATION 0x8009
|
||||
#define GL_MIN 0x8007
|
||||
#define GL_MAX 0x8008
|
||||
#define GL_FUNC_ADD 0x8006
|
||||
#define GL_FUNC_SUBTRACT 0x800A
|
||||
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
|
||||
#define GL_BLEND_COLOR 0x8005
|
||||
#define GL_CONSTANT_COLOR 0x8001
|
||||
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
|
||||
#define GL_CONSTANT_ALPHA 0x8003
|
||||
#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
|
||||
#endif
|
||||
|
||||
typedef void (APIENTRY * glBlendEquationProc) (GLenum mode );
|
||||
typedef void (APIENTRY * glBlendColorProc) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
|
||||
|
||||
|
||||
/* OpenGL extension declarations */
|
||||
|
||||
/*
|
||||
* glPointParameterf and glPointParameterfv
|
||||
*/
|
||||
#ifndef GL_EXT_point_parameters
|
||||
#define GL_EXT_point_parameters 1
|
||||
#define GL_POINT_SIZE_MIN_EXT 0x8126
|
||||
#define GL_DISTANCE_ATTENUATION_EXT 0x8129
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_point_parameters
|
||||
#define GL_ARB_point_parameters 1
|
||||
#define GL_POINT_SIZE_MIN_ARB 0x8126
|
||||
#define GL_DISTANCE_ATTENUATION_ARB 0x8129
|
||||
#endif
|
||||
|
||||
typedef void (APIENTRY * glPointParameterfProc)(GLenum pname, GLfloat param);
|
||||
typedef void (APIENTRY * glPointParameterfvProc)(GLenum pname, const GLfloat *params);
|
||||
|
||||
/*
|
||||
* glActiveTextureARB
|
||||
*/
|
||||
|
||||
#ifndef GL_ARB_multitexture
|
||||
#define GL_ARB_multitexture 1
|
||||
#define GL_TEXTURE0_ARB 0x84C0
|
||||
#define GL_TEXTURE1_ARB 0x84C1
|
||||
#define GL_TEXTURE2_ARB 0x84C2
|
||||
#define GL_TEXTURE3_ARB 0x84C3
|
||||
#define GL_TEXTURE4_ARB 0x84C4
|
||||
#define GL_TEXTURE5_ARB 0x84C5
|
||||
#define GL_TEXTURE6_ARB 0x84C6
|
||||
#define GL_TEXTURE7_ARB 0x84C7
|
||||
#define GL_TEXTURE8_ARB 0x84C8
|
||||
#define GL_TEXTURE9_ARB 0x84C9
|
||||
#define GL_TEXTURE10_ARB 0x84CA
|
||||
#define GL_TEXTURE11_ARB 0x84CB
|
||||
#define GL_TEXTURE12_ARB 0x84CC
|
||||
#define GL_TEXTURE13_ARB 0x84CD
|
||||
#define GL_TEXTURE14_ARB 0x84CE
|
||||
#define GL_TEXTURE15_ARB 0x84CF
|
||||
#define GL_TEXTURE16_ARB 0x84D0
|
||||
#define GL_TEXTURE17_ARB 0x84D1
|
||||
#define GL_TEXTURE18_ARB 0x84D2
|
||||
#define GL_TEXTURE19_ARB 0x84D3
|
||||
#define GL_TEXTURE20_ARB 0x84D4
|
||||
#define GL_TEXTURE21_ARB 0x84D5
|
||||
#define GL_TEXTURE22_ARB 0x84D6
|
||||
#define GL_TEXTURE23_ARB 0x84D7
|
||||
#define GL_TEXTURE24_ARB 0x84D8
|
||||
#define GL_TEXTURE25_ARB 0x84D9
|
||||
#define GL_TEXTURE26_ARB 0x84DA
|
||||
#define GL_TEXTURE27_ARB 0x84DB
|
||||
#define GL_TEXTURE28_ARB 0x84DC
|
||||
#define GL_TEXTURE29_ARB 0x84DD
|
||||
#define GL_TEXTURE30_ARB 0x84DE
|
||||
#define GL_TEXTURE31_ARB 0x84DF
|
||||
#define GL_ACTIVE_TEXTURE_ARB 0x84E0
|
||||
#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
|
||||
#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
|
||||
#endif
|
||||
|
||||
typedef void (APIENTRY * glActiveTextureProc)(GLenum texture);
|
||||
typedef void (APIENTRY * glClientActiveTextureProc)(GLenum texture);
|
||||
|
||||
/*
|
||||
* GL_EXT_separate_specular_color
|
||||
*/
|
||||
|
||||
#ifndef GL_LIGHT_MODEL_COLOR_CONTROL
|
||||
#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
|
||||
#define GL_SINGLE_COLOR 0x81F9
|
||||
#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GL_ARB_texture_cube_map
|
||||
*/
|
||||
|
||||
#ifndef GL_ARB_texture_cube_map
|
||||
#define GL_ARB_texture_cube_map 1
|
||||
#define GL_NORMAL_MAP_ARB 0x8511
|
||||
#define GL_REFLECTION_MAP_ARB 0x8512
|
||||
#define GL_TEXTURE_CUBE_MAP_ARB 0x8513
|
||||
#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A
|
||||
#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B
|
||||
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GL_ARB_texture_env_combine
|
||||
*/
|
||||
|
||||
#ifndef GL_ARB_texture_env_combine
|
||||
#define GL_ARB_texture_env_combine 1
|
||||
#define GL_COMBINE_ARB 0x8570
|
||||
#define GL_COMBINE_RGB_ARB 0x8571
|
||||
#define GL_COMBINE_ALPHA_ARB 0x8572
|
||||
#define GL_RGB_SCALE_ARB 0x8573
|
||||
#define GL_ADD_SIGNED_ARB 0x8574
|
||||
#define GL_INTERPOLATE_ARB 0x8575
|
||||
#define GL_SUBTRACT_ARB 0x84E7
|
||||
#define GL_CONSTANT_ARB 0x8576
|
||||
#define GL_PRIMARY_COLOR_ARB 0x8577
|
||||
#define GL_PREVIOUS_ARB 0x8578
|
||||
#define GL_SOURCE0_RGB_ARB 0x8580
|
||||
#define GL_SOURCE1_RGB_ARB 0x8581
|
||||
#define GL_SOURCE2_RGB_ARB 0x8582
|
||||
#define GL_SOURCE0_ALPHA_ARB 0x8588
|
||||
#define GL_SOURCE1_ALPHA_ARB 0x8589
|
||||
#define GL_SOURCE2_ALPHA_ARB 0x858A
|
||||
#define GL_OPERAND0_RGB_ARB 0x8590
|
||||
#define GL_OPERAND1_RGB_ARB 0x8591
|
||||
#define GL_OPERAND2_RGB_ARB 0x8592
|
||||
#define GL_OPERAND0_ALPHA_ARB 0x8598
|
||||
#define GL_OPERAND1_ALPHA_ARB 0x8599
|
||||
#define GL_OPERAND2_ALPHA_ARB 0x859A
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GL_ARB_texture_env_dot3
|
||||
*/
|
||||
|
||||
#ifndef GL_ARB_texture_env_dot3
|
||||
#define GL_ARB_texture_env_dot3 1
|
||||
#define GL_DOT3_RGB_ARB 0x86AE
|
||||
#define GL_DOT3_RGBA_ARB 0x86AF
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ARB_depth_texture
|
||||
*/
|
||||
#ifndef GL_ARB_depth_texture
|
||||
#define GL_ARB_depth_texture 1
|
||||
#define GL_DEPTH_COMPONENT16_ARB 0x81A5
|
||||
#define GL_DEPTH_COMPONENT24_ARB 0x81A6
|
||||
#define GL_DEPTH_COMPONENT32_ARB 0x81A7
|
||||
#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A
|
||||
#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ARB_multisample
|
||||
*/
|
||||
#ifndef GL_ARB_multisample
|
||||
#define GL_ARB_multisample 1
|
||||
#define GL_MULTISAMPLE_ARB 0x809D
|
||||
#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E
|
||||
#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F
|
||||
#define GL_SAMPLE_COVERAGE_ARB 0x80A0
|
||||
#define GL_SAMPLE_BUFFERS_ARB 0x80A8
|
||||
#define GL_SAMPLES_ARB 0x80A9
|
||||
#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA
|
||||
#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB
|
||||
#define GL_MULTISAMPLE_BIT_ARB 0x20000000
|
||||
#define GL_DOUBLEBUFFER 0x0C32
|
||||
#define GL_AUX_BUFFERS 0x0C00
|
||||
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
||||
#define WGL_SAMPLES_ARB 0x2042
|
||||
#endif
|
||||
|
||||
#ifndef GL_SGIS_generate_mipmap
|
||||
#define GL_SGIS_generate_mipmap 1
|
||||
#define GL_GENERATE_MIPMAP_SGIS 0x8191
|
||||
#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192
|
||||
#endif
|
||||
|
||||
/* WGL spcific OpenGL extenstions */
|
||||
#ifdef WIN32
|
||||
|
||||
/*
|
||||
* WGL_ARB_extensions_string
|
||||
*/
|
||||
#ifndef WGL_ARB_extensions_string
|
||||
#define WGL_ARB_extensions_string 1
|
||||
typedef const char * (APIENTRY * wglGetExtensionsStringARBProc) (HDC hDC);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* WGL_ARB_pbuffer
|
||||
*/
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
#define WGL_ARB_pbuffer 1
|
||||
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
|
||||
#define WGL_PBUFFER_LARGEST_ARB 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_ARB 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
|
||||
#define WGL_PBUFFER_LOST_ARB 0x2036
|
||||
DECLARE_HANDLE(HPBUFFERARB);
|
||||
typedef HPBUFFERARB (APIENTRY * wglCreatePbufferARBProc) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
typedef HDC (APIENTRY * wglGetPbufferDCARBProc) (HPBUFFERARB hPbuffer);
|
||||
typedef int (APIENTRY * wglReleasePbufferDCARBProc) (HPBUFFERARB hPbuffer, HDC hDC);
|
||||
typedef BOOL (APIENTRY * wglDestroyPbufferARBProc) (HPBUFFERARB hPbuffer);
|
||||
typedef BOOL (APIENTRY * wglQueryPbufferARBProc) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* ARB_pixel_format
|
||||
*/
|
||||
#ifndef WGL_ARB_pixel_format
|
||||
#define WGL_ARB_pixel_format 1
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
|
||||
#define WGL_ACCELERATION_ARB 0x2003
|
||||
#define WGL_NEED_PALETTE_ARB 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
|
||||
#define WGL_SWAP_METHOD_ARB 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
|
||||
#define WGL_TRANSPARENT_ARB 0x200A
|
||||
#define WGL_SHARE_DEPTH_ARB 0x200C
|
||||
#define WGL_SHARE_STENCIL_ARB 0x200D
|
||||
#define WGL_SHARE_ACCUM_ARB 0x200E
|
||||
#define WGL_SUPPORT_GDI_ARB 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_ARB 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_ARB 0x2011
|
||||
#define WGL_STEREO_ARB 0x2012
|
||||
#define WGL_PIXEL_TYPE_ARB 0x2013
|
||||
#define WGL_COLOR_BITS_ARB 0x2014
|
||||
#define WGL_RED_BITS_ARB 0x2015
|
||||
#define WGL_RED_SHIFT_ARB 0x2016
|
||||
#define WGL_GREEN_BITS_ARB 0x2017
|
||||
#define WGL_GREEN_SHIFT_ARB 0x2018
|
||||
#define WGL_BLUE_BITS_ARB 0x2019
|
||||
#define WGL_BLUE_SHIFT_ARB 0x201A
|
||||
#define WGL_ALPHA_BITS_ARB 0x201B
|
||||
#define WGL_ALPHA_SHIFT_ARB 0x201C
|
||||
#define WGL_ACCUM_BITS_ARB 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_ARB 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
|
||||
#define WGL_DEPTH_BITS_ARB 0x2022
|
||||
#define WGL_STENCIL_BITS_ARB 0x2023
|
||||
#define WGL_AUX_BUFFERS_ARB 0x2024
|
||||
#define WGL_NO_ACCELERATION_ARB 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
|
||||
#define WGL_FULL_ACCELERATION_ARB 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_ARB 0x2028
|
||||
#define WGL_SWAP_COPY_ARB 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_ARB 0x202A
|
||||
#define WGL_TYPE_RGBA_ARB 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_ARB 0x202C
|
||||
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
|
||||
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
|
||||
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
|
||||
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
|
||||
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
|
||||
typedef BOOL (APIENTRY * wglGetPixelFormatAttribivARBProc) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
||||
typedef BOOL (APIENTRY * wglGetPixelFormatAttribfvARBProc) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (APIENTRY * wglChoosePixelFormatARBProc) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ARB_render_texture
|
||||
*/
|
||||
#ifndef WGL_ARB_render_texture
|
||||
#define WGL_ARB_render_texture 1
|
||||
|
||||
#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
|
||||
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
|
||||
#define WGL_TEXTURE_FORMAT_ARB 0x2072
|
||||
#define WGL_TEXTURE_TARGET_ARB 0x2073
|
||||
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
|
||||
#define WGL_TEXTURE_RGB_ARB 0x2075
|
||||
#define WGL_TEXTURE_RGBA_ARB 0x2076
|
||||
#define WGL_NO_TEXTURE_ARB 0x2077
|
||||
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
|
||||
#define WGL_TEXTURE_1D_ARB 0x2079
|
||||
#define WGL_TEXTURE_2D_ARB 0x207A
|
||||
#define WGL_NO_TEXTURE_ARB 0x2077
|
||||
#define WGL_MIPMAP_LEVEL_ARB 0x207B
|
||||
#define WGL_CUBE_MAP_FACE_ARB 0x207C
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
|
||||
#define WGL_FRONT_LEFT_ARB 0x2083
|
||||
#define WGL_FRONT_RIGHT_ARB 0x2084
|
||||
#define WGL_BACK_LEFT_ARB 0x2085
|
||||
#define WGL_BACK_RIGHT_ARB 0x2086
|
||||
#define WGL_AUX0_ARB 0x2087
|
||||
#define WGL_AUX1_ARB 0x2088
|
||||
#define WGL_AUX2_ARB 0x2089
|
||||
#define WGL_AUX3_ARB 0x208A
|
||||
#define WGL_AUX4_ARB 0x208B
|
||||
#define WGL_AUX5_ARB 0x208C
|
||||
#define WGL_AUX6_ARB 0x208D
|
||||
#define WGL_AUX7_ARB 0x208E
|
||||
#define WGL_AUX8_ARB 0x208F
|
||||
#define WGL_AUX9_ARB 0x2090
|
||||
typedef BOOL (APIENTRY * wglBindTexImageARBProc) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (APIENTRY * wglReleaseTexImageARBProc) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (APIENTRY * wglSetPbufferAttribARBProc) (HPBUFFERARB hPbuffer, const int *piAttribList);
|
||||
#endif
|
||||
|
||||
#elif !defined(__APPLE__) /* !WIN32 */
|
||||
|
||||
/* GLX pcific OpenGL extenstions */
|
||||
#include <GL/glx.h>
|
||||
|
||||
#ifndef GLX_ARB_multisample
|
||||
#define GLX_ARB_multisample1
|
||||
#define GLX_SAMPLE_BUFFERS_ARB 100001
|
||||
#define GLX_SAMPLES_ARB 100000
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_pbuffer
|
||||
#define GLX_SGIX_pbuffer 1
|
||||
#define GLX_DOUBLEBUFFER 5
|
||||
#define GLX_AUX_BUFFERS 0x00000010
|
||||
#endif
|
||||
|
||||
#ifndef GLXPbuffer
|
||||
# ifdef GLXPbufferSGIX
|
||||
# define GLXPbuffer GLXPbufferSGIX
|
||||
# endif
|
||||
#endif
|
||||
#ifndef GLXFBConfig
|
||||
# ifdef GLXFBConfigSGIX
|
||||
# define GLXFBConfig GLXFBConfigSGIX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
typedef GLXFBConfig *(*glXChooseFBConfigProc) (Display *dpy, int screen, int *attribList, int *nitems);
|
||||
typedef GLXPbuffer (*glXCreateGLXPbufferProc) (Display *dpy, GLXFBConfig config, unsigned int width, unsigned int height, int *attrib_list);
|
||||
typedef GLXPbuffer (*glXCreatePbufferProc) (Display *dpy, GLXFBConfig config, int *attrib_list);
|
||||
typedef XVisualInfo *(*glXGetVisualFromFBConfigProc) (Display *dpy, GLXFBConfig config);
|
||||
typedef GLXContext (*glXCreateContextWithConfigProc) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
|
||||
typedef GLXContext (*glXCreateContextProc) (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);
|
||||
typedef void (*glXDestroyPbufferProc) (Display *dpy, GLXPbuffer pbuf);
|
||||
typedef int (*glXQueryGLXPbufferSGIXProc) (Display *, GLXPbuffer, int, unsigned int *);
|
||||
typedef void (*glXQueryDrawableProc) (Display *, GLXDrawable, int, unsigned int *);
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
/* NVIDIA specific extension */
|
||||
|
||||
/*
|
||||
* NV_texture_rectangle
|
||||
*/
|
||||
|
||||
#ifndef GL_NV_texture_rectangle
|
||||
#define GL_NV_texture_rectangle 1
|
||||
#define GL_TEXTURE_RECTANGLE_NV 0x84F5
|
||||
#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6
|
||||
#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7
|
||||
#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NV_texture_rectangle
|
||||
*/
|
||||
|
||||
#ifndef GL_EXT_texture_rectangle
|
||||
#define GL_EXT_texture_rectangle 1
|
||||
#define GL_TEXTURE_RECTANGLE_EXT 0x84F5
|
||||
#define GL_TEXTURE_BINDING_RECTANGLE_EXT 0x84F6
|
||||
#define GL_PROXY_TEXTURE_RECTANGLE_EXT 0x84F7
|
||||
#define GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT 0x84F8
|
||||
#endif
|
||||
|
||||
/*
|
||||
* WGL_NV_texture_rectangle
|
||||
*/
|
||||
|
||||
#ifndef WGL_NV_texture_rectangle
|
||||
#define WGL_NV_texture_rectangle 1
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
|
||||
#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NV_render_depth_texture
|
||||
*/
|
||||
|
||||
#ifndef WGL_NV_render_depth_texture
|
||||
#define WGL_NV_render_depth_texture 1
|
||||
#define WGL_NO_TEXTURE_ARB 0x2077
|
||||
#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
|
||||
#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
|
||||
#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
|
||||
#define WGL_DEPTH_COMPONENT_NV 0x20A7
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NV_float_buffer
|
||||
*/
|
||||
#ifndef GL_NV_float_buffer
|
||||
#define GL_NV_float_buffer 1
|
||||
#define GL_FLOAT_R_NV 0x8880
|
||||
#define GL_FLOAT_RG_NV 0x8881
|
||||
#define GL_FLOAT_RGB_NV 0x8882
|
||||
#define GL_FLOAT_RGBA_NV 0x8883
|
||||
#define GL_FLOAT_R16_NV 0x8884
|
||||
#define GL_FLOAT_R32_NV 0x8885
|
||||
#define GL_FLOAT_RG16_NV 0x8886
|
||||
#define GL_FLOAT_RG32_NV 0x8887
|
||||
#define GL_FLOAT_RGB16_NV 0x8888
|
||||
#define GL_FLOAT_RGB32_NV 0x8889
|
||||
#define GL_FLOAT_RGBA16_NV 0x888A
|
||||
#define GL_FLOAT_RGBA32_NV 0x888B
|
||||
#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C
|
||||
#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D
|
||||
#define GL_FLOAT_RGBA_MODE_NV 0x888E
|
||||
#endif
|
||||
#ifndef GLX_NV_float_buffer
|
||||
#define GLX_NV_float_buffer 1
|
||||
#define GLX_FLOAT_COMPONENTS_NV 0x20B0
|
||||
#define GLX_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
|
||||
#define GLX_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
|
||||
#define GLX_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
|
||||
#define GLX_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
|
||||
#define GLX_TEXTURE_FLOAT_R_NV 0x20B5
|
||||
#define GLX_TEXTURE_FLOAT_RG_NV 0x20B6
|
||||
#define GLX_TEXTURE_FLOAT_RGB_NV 0x20B7
|
||||
#define GLX_TEXTURE_FLOAT_RGBA_NV 0x20B8
|
||||
#endif
|
||||
#ifndef WGL_NV_float_buffer
|
||||
#define WGL_NV_float_buffer 1
|
||||
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
|
||||
#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
|
||||
#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
|
||||
#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
|
||||
#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
|
||||
#endif
|
||||
|
||||
|
||||
/* ATI specific extension */
|
||||
|
||||
/*
|
||||
* ATI_pixel_format_float
|
||||
*/
|
||||
#ifndef WGL_ATI_pixel_format_float
|
||||
#define WGL_ATI_pixel_format_float 1
|
||||
#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
|
||||
#define GL_RGBA_FLOAT_MODE_ATI 0x8820
|
||||
#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ATI_texture_float
|
||||
*/
|
||||
#ifndef GL_ATI_texture_float
|
||||
#define GL_ATI_texture_float 1
|
||||
#define GL_RGBA_FLOAT32_ATI 0x8814
|
||||
#define GL_RGB_FLOAT32_ATI 0x8815
|
||||
#define GL_ALPHA_FLOAT32_ATI 0x8816
|
||||
#define GL_INTENSITY_FLOAT32_ATI 0x8817
|
||||
#define GL_LUMINANCE_FLOAT32_ATI 0x8818
|
||||
#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819
|
||||
#define GL_RGBA_FLOAT16_ATI 0x881A
|
||||
#define GL_RGB_FLOAT16_ATI 0x881B
|
||||
#define GL_ALPHA_FLOAT16_ATI 0x881C
|
||||
#define GL_INTENSITY_FLOAT16_ATI 0x881D
|
||||
#define GL_LUMINANCE_FLOAT16_ATI 0x881E
|
||||
#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ARB point sprite
|
||||
*/
|
||||
#ifndef GL_ARB_point_sprite
|
||||
#define GL_ARB_point_sprite 1
|
||||
#define GL_POINT_SPRITE_ARB 0x8861
|
||||
#define GL_COORD_REPLACE_ARB 0x8862
|
||||
#endif
|
||||
|
||||
#ifndef GL_NV_point_sprite
|
||||
#define GL_NV_point_sprite 1
|
||||
#define GL_POINT_SPRITE_NV 0x8861
|
||||
#define GL_COORD_REPLACE_NV 0x8862
|
||||
#define GL_POINT_SPRITE_R_MODE_NV 0x8863
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_2_0
|
||||
#define GL_POINT_SPRITE 0x8861
|
||||
#define GL_COORD_REPLACE 0x8862
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ARB_vertex_program
|
||||
*/
|
||||
#ifndef GL_ARB_vertex_program
|
||||
#define GL_ARB_vertex_program 1
|
||||
#define GL_COLOR_SUM_ARB 0x8458
|
||||
#define GL_VERTEX_PROGRAM_ARB 0x8620
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625
|
||||
#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626
|
||||
#define GL_PROGRAM_LENGTH_ARB 0x8627
|
||||
#define GL_PROGRAM_STRING_ARB 0x8628
|
||||
#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E
|
||||
#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F
|
||||
#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640
|
||||
#define GL_CURRENT_MATRIX_ARB 0x8641
|
||||
#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642
|
||||
#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645
|
||||
#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B
|
||||
#define GL_PROGRAM_BINDING_ARB 0x8677
|
||||
#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A
|
||||
#define GL_PROGRAM_ERROR_STRING_ARB 0x8874
|
||||
#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875
|
||||
#define GL_PROGRAM_FORMAT_ARB 0x8876
|
||||
#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0
|
||||
#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1
|
||||
#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2
|
||||
#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3
|
||||
#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4
|
||||
#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5
|
||||
#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6
|
||||
#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7
|
||||
#define GL_PROGRAM_PARAMETERS_ARB 0x88A8
|
||||
#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9
|
||||
#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA
|
||||
#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB
|
||||
#define GL_PROGRAM_ATTRIBS_ARB 0x88AC
|
||||
#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD
|
||||
#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE
|
||||
#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF
|
||||
#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0
|
||||
#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1
|
||||
#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2
|
||||
#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3
|
||||
#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4
|
||||
#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5
|
||||
#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6
|
||||
#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7
|
||||
#define GL_MATRIX0_ARB 0x88C0
|
||||
#define GL_MATRIX1_ARB 0x88C1
|
||||
#define GL_MATRIX2_ARB 0x88C2
|
||||
#define GL_MATRIX3_ARB 0x88C3
|
||||
#define GL_MATRIX4_ARB 0x88C4
|
||||
#define GL_MATRIX5_ARB 0x88C5
|
||||
#define GL_MATRIX6_ARB 0x88C6
|
||||
#define GL_MATRIX7_ARB 0x88C7
|
||||
#define GL_MATRIX8_ARB 0x88C8
|
||||
#define GL_MATRIX9_ARB 0x88C9
|
||||
#define GL_MATRIX10_ARB 0x88CA
|
||||
#define GL_MATRIX11_ARB 0x88CB
|
||||
#define GL_MATRIX12_ARB 0x88CC
|
||||
#define GL_MATRIX13_ARB 0x88CD
|
||||
#define GL_MATRIX14_ARB 0x88CE
|
||||
#define GL_MATRIX15_ARB 0x88CF
|
||||
#define GL_MATRIX16_ARB 0x88D0
|
||||
#define GL_MATRIX17_ARB 0x88D1
|
||||
#define GL_MATRIX18_ARB 0x88D2
|
||||
#define GL_MATRIX19_ARB 0x88D3
|
||||
#define GL_MATRIX20_ARB 0x88D4
|
||||
#define GL_MATRIX21_ARB 0x88D5
|
||||
#define GL_MATRIX22_ARB 0x88D6
|
||||
#define GL_MATRIX23_ARB 0x88D7
|
||||
#define GL_MATRIX24_ARB 0x88D8
|
||||
#define GL_MATRIX25_ARB 0x88D9
|
||||
#define GL_MATRIX26_ARB 0x88DA
|
||||
#define GL_MATRIX27_ARB 0x88DB
|
||||
#define GL_MATRIX28_ARB 0x88DC
|
||||
#define GL_MATRIX29_ARB 0x88DD
|
||||
#define GL_MATRIX30_ARB 0x88DE
|
||||
#define GL_MATRIX31_ARB 0x88DF
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ARB_fragment_program
|
||||
*/
|
||||
#ifndef GL_ARB_fragment_program
|
||||
#define GL_ARB_fragment_program 1
|
||||
#define GL_FRAGMENT_PROGRAM_ARB 0x8804
|
||||
#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805
|
||||
#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806
|
||||
#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807
|
||||
#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808
|
||||
#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809
|
||||
#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A
|
||||
#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B
|
||||
#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C
|
||||
#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D
|
||||
#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E
|
||||
#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F
|
||||
#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810
|
||||
#define GL_MAX_TEXTURE_COORDS_ARB 0x8871
|
||||
#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872
|
||||
#endif
|
||||
|
||||
typedef void (APIENTRY * glVertexAttrib1dProc) (GLuint index, GLdouble x);
|
||||
typedef void (APIENTRY * glVertexAttrib1dvProc) (GLuint index, const GLdouble *v);
|
||||
typedef void (APIENTRY * glVertexAttrib1fProc) (GLuint index, GLfloat x);
|
||||
typedef void (APIENTRY * glVertexAttrib1fvProc) (GLuint index, const GLfloat *v);
|
||||
typedef void (APIENTRY * glVertexAttrib1sProc) (GLuint index, GLshort x);
|
||||
typedef void (APIENTRY * glVertexAttrib1svProc) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRY * glVertexAttrib2dProc) (GLuint index, GLdouble x, GLdouble y);
|
||||
typedef void (APIENTRY * glVertexAttrib2dvProc) (GLuint index, const GLdouble *v);
|
||||
typedef void (APIENTRY * glVertexAttrib2fProc) (GLuint index, GLfloat x, GLfloat y);
|
||||
typedef void (APIENTRY * glVertexAttrib2fvProc) (GLuint index, const GLfloat *v);
|
||||
typedef void (APIENTRY * glVertexAttrib2sProc) (GLuint index, GLshort x, GLshort y);
|
||||
typedef void (APIENTRY * glVertexAttrib2svProc) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRY * glVertexAttrib3dProc) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
|
||||
typedef void (APIENTRY * glVertexAttrib3dvProc) (GLuint index, const GLdouble *v);
|
||||
typedef void (APIENTRY * glVertexAttrib3fProc) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
|
||||
typedef void (APIENTRY * glVertexAttrib3fvProc) (GLuint index, const GLfloat *v);
|
||||
typedef void (APIENTRY * glVertexAttrib3sProc) (GLuint index, GLshort x, GLshort y, GLshort z);
|
||||
typedef void (APIENTRY * glVertexAttrib3svProc) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRY * glVertexAttrib4NbvProc) (GLuint index, const GLbyte *v);
|
||||
typedef void (APIENTRY * glVertexAttrib4NivProc) (GLuint index, const GLint *v);
|
||||
typedef void (APIENTRY * glVertexAttrib4NsvProc) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRY * glVertexAttrib4NubProc) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
|
||||
typedef void (APIENTRY * glVertexAttrib4NubvProc) (GLuint index, const GLubyte *v);
|
||||
typedef void (APIENTRY * glVertexAttrib4NuivProc) (GLuint index, const GLuint *v);
|
||||
typedef void (APIENTRY * glVertexAttrib4NusvProc) (GLuint index, const GLushort *v);
|
||||
typedef void (APIENTRY * glVertexAttrib4bvProc) (GLuint index, const GLbyte *v);
|
||||
typedef void (APIENTRY * glVertexAttrib4dProc) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef void (APIENTRY * glVertexAttrib4dvProc) (GLuint index, const GLdouble *v);
|
||||
typedef void (APIENTRY * glVertexAttrib4fProc) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (APIENTRY * glVertexAttrib4fvProc) (GLuint index, const GLfloat *v);
|
||||
typedef void (APIENTRY * glVertexAttrib4ivProc) (GLuint index, const GLint *v);
|
||||
typedef void (APIENTRY * glVertexAttrib4sProc) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
|
||||
typedef void (APIENTRY * glVertexAttrib4svProc) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRY * glVertexAttrib4ubvProc) (GLuint index, const GLubyte *v);
|
||||
typedef void (APIENTRY * glVertexAttrib4uivProc) (GLuint index, const GLuint *v);
|
||||
typedef void (APIENTRY * glVertexAttrib4usvProc) (GLuint index, const GLushort *v);
|
||||
typedef void (APIENTRY * glVertexAttribPointerProc) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
|
||||
typedef void (APIENTRY * glEnableVertexAttribArrayProc) (GLuint index);
|
||||
typedef void (APIENTRY * glDisableVertexAttribArrayProc) (GLuint index);
|
||||
typedef void (APIENTRY * glProgramStringProc) (GLenum target, GLenum format, GLsizei len, const GLvoid *string);
|
||||
typedef void (APIENTRY * glBindProgramProc) (GLenum target, GLuint program);
|
||||
typedef void (APIENTRY * glDeleteProgramsProc) (GLsizei n, const GLuint *programs);
|
||||
typedef void (APIENTRY * glGenProgramsProc) (GLsizei n, GLuint *programs);
|
||||
typedef void (APIENTRY * glProgramEnvParameter4dProc) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef void (APIENTRY * glProgramEnvParameter4dvProc) (GLenum target, GLuint index, const GLdouble *params);
|
||||
typedef void (APIENTRY * glProgramEnvParameter4fProc) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (APIENTRY * glProgramEnvParameter4fvProc) (GLenum target, GLuint index, const GLfloat *params);
|
||||
typedef void (APIENTRY * glProgramLocalParameter4dProc) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef void (APIENTRY * glProgramLocalParameter4dvProc) (GLenum target, GLuint index, const GLdouble *params);
|
||||
typedef void (APIENTRY * glProgramLocalParameter4fProc) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (APIENTRY * glProgramLocalParameter4fvProc) (GLenum target, GLuint index, const GLfloat *params);
|
||||
typedef void (APIENTRY * glGetProgramEnvParameterdvProc) (GLenum target, GLuint index, GLdouble *params);
|
||||
typedef void (APIENTRY * glGetProgramEnvParameterfvProc) (GLenum target, GLuint index, GLfloat *params);
|
||||
typedef void (APIENTRY * glGetProgramLocalParameterdvProc) (GLenum target, GLuint index, GLdouble *params);
|
||||
typedef void (APIENTRY * glGetProgramLocalParameterfvProc) (GLenum target, GLuint index, GLfloat *params);
|
||||
typedef void (APIENTRY * glGetProgramivProc) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRY * glGetProgramStringProc) (GLenum target, GLenum pname, GLvoid *string);
|
||||
typedef void (APIENTRY * glGetVertexAttribdvProc) (GLuint index, GLenum pname, GLdouble *params);
|
||||
typedef void (APIENTRY * glGetVertexAttribfvProc) (GLuint index, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRY * glGetVertexAttribivProc) (GLuint index, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRY * glGetVertexAttribPointervProc) (GLuint index, GLenum pname, GLvoid* *pointer);
|
||||
typedef GLboolean (APIENTRY * glIsProgramProc) (GLuint program);
|
||||
|
||||
/*
|
||||
* EXT_framebuffer_objects
|
||||
*/
|
||||
#ifndef GL_EXT_framebuffer_object
|
||||
#define GL_EXT_framebuffer_object 1
|
||||
#define GL_NONE_EXT 0
|
||||
#define GL_FRAMEBUFFER_EXT 0x8D40
|
||||
#define GL_RENDERBUFFER_EXT 0x8D41
|
||||
#define GL_RGBA4_EXT 0x8056
|
||||
#define GL_RGB5_A1_EXT 0x8057
|
||||
#define GL_RGB565_EXT 0x8D62
|
||||
#define GL_DEPTH_COMPONENT16_EXT 0x81A5
|
||||
#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42
|
||||
#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43
|
||||
#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
|
||||
#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50
|
||||
#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51
|
||||
#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52
|
||||
#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53
|
||||
#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
|
||||
#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
|
||||
#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
|
||||
#define GL_DEPTH_ATTACHMENT_EXT 0x8D00
|
||||
#define GL_STENCIL_ATTACHMENT_EXT 0x8D20
|
||||
#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
|
||||
#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
|
||||
#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
|
||||
#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7
|
||||
#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
|
||||
#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
|
||||
#endif
|
||||
|
||||
typedef GLboolean (APIENTRY * glIsRenderbufferProc) (GLuint renderbuffer);
|
||||
typedef void (APIENTRY * glBindRenderbufferProc) (GLenum target, GLuint renderbuffer);
|
||||
typedef void (APIENTRY * glDeleteRenderbuffersProc) (GLsizei n, const GLuint* renderbuffers);
|
||||
typedef void (APIENTRY * glGenRenderbuffersProc) (GLsizei n, GLuint* renderbuffers);
|
||||
typedef void (APIENTRY * glRenderbufferStorageProc) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (APIENTRY * glGetRenderbufferParameterivProc) (GLenum target, GLenum pname, GLint* params);
|
||||
typedef GLboolean (APIENTRY * glIsFramebufferProc) (GLuint framebuffer);
|
||||
typedef void (APIENTRY * glBindFramebufferProc) (GLenum target, GLuint framebuffer);
|
||||
typedef void (APIENTRY * glDeleteFramebuffersProc) (GLsizei n, const GLuint* framebuffers);
|
||||
typedef void (APIENTRY * glGenFramebuffersProc) (GLsizei n, GLuint* framebuffers);
|
||||
typedef GLenum (APIENTRY * glCheckFramebufferStatusProc) (GLenum target);
|
||||
typedef void (APIENTRY * glFramebufferRenderbufferProc) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef void (APIENTRY * glFramebufferTexture2DProc) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (APIENTRY * glGetFramebufferAttachmentParameterivProc) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
|
||||
typedef void (APIENTRY * glGenerateMipmapProc) (GLenum target);
|
||||
|
||||
/*
|
||||
* ARB_shader_objects
|
||||
*/
|
||||
#ifndef GL_ARB_shader_objects
|
||||
#define GL_ARB_shader_objects 1
|
||||
/* GL types for handling shader object handles and program/shader text */
|
||||
typedef char GLcharARB; /* native character */
|
||||
typedef unsigned int GLhandleARB; /* shader object handle */
|
||||
|
||||
#define GL_PROGRAM_OBJECT_ARB 0x8B40
|
||||
#define GL_SHADER_OBJECT_ARB 0x8B48
|
||||
#define GL_OBJECT_TYPE_ARB 0x8B4E
|
||||
#define GL_OBJECT_SUBTYPE_ARB 0x8B4F
|
||||
#define GL_FLOAT_VEC2_ARB 0x8B50
|
||||
#define GL_FLOAT_VEC3_ARB 0x8B51
|
||||
#define GL_FLOAT_VEC4_ARB 0x8B52
|
||||
#define GL_INT_VEC2_ARB 0x8B53
|
||||
#define GL_INT_VEC3_ARB 0x8B54
|
||||
#define GL_INT_VEC4_ARB 0x8B55
|
||||
#define GL_BOOL_ARB 0x8B56
|
||||
#define GL_BOOL_VEC2_ARB 0x8B57
|
||||
#define GL_BOOL_VEC3_ARB 0x8B58
|
||||
#define GL_BOOL_VEC4_ARB 0x8B59
|
||||
#define GL_FLOAT_MAT2_ARB 0x8B5A
|
||||
#define GL_FLOAT_MAT3_ARB 0x8B5B
|
||||
#define GL_FLOAT_MAT4_ARB 0x8B5C
|
||||
#define GL_SAMPLER_1D_ARB 0x8B5D
|
||||
#define GL_SAMPLER_2D_ARB 0x8B5E
|
||||
#define GL_SAMPLER_3D_ARB 0x8B5F
|
||||
#define GL_SAMPLER_CUBE_ARB 0x8B60
|
||||
#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61
|
||||
#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62
|
||||
#define GL_SAMPLER_2D_RECT_ARB 0x8B63
|
||||
#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64
|
||||
#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80
|
||||
#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81
|
||||
#define GL_OBJECT_LINK_STATUS_ARB 0x8B82
|
||||
#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83
|
||||
#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84
|
||||
#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85
|
||||
#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86
|
||||
#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87
|
||||
#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88
|
||||
#endif
|
||||
|
||||
typedef void (APIENTRY * glDeleteObjectProc) (GLhandleARB obj);
|
||||
typedef GLhandleARB (APIENTRY * glGetHandleProc) (GLenum pname);
|
||||
typedef void (APIENTRY * glDetachObjectProc) (GLhandleARB containerObj, GLhandleARB attachedObj);
|
||||
typedef GLhandleARB (APIENTRY * glCreateShaderObjectProc) (GLenum shaderType);
|
||||
typedef void (APIENTRY * glShaderSourceProc) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length);
|
||||
typedef void (APIENTRY * glCompileShaderProc) (GLhandleARB shaderObj);
|
||||
typedef GLhandleARB (APIENTRY * glCreateProgramObjectProc) (void);
|
||||
typedef void (APIENTRY * glAttachObjectProc) (GLhandleARB containerObj, GLhandleARB obj);
|
||||
typedef void (APIENTRY * glLinkProgramProc) (GLhandleARB programObj);
|
||||
typedef void (APIENTRY * glUseProgramObjectProc) (GLhandleARB programObj);
|
||||
typedef void (APIENTRY * glValidateProgramProc) (GLhandleARB programObj);
|
||||
typedef void (APIENTRY * glUniform1fProc) (GLint location, GLfloat v0);
|
||||
typedef void (APIENTRY * glUniform2fProc) (GLint location, GLfloat v0, GLfloat v1);
|
||||
typedef void (APIENTRY * glUniform3fProc) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
typedef void (APIENTRY * glUniform4fProc) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
typedef void (APIENTRY * glUniform1iProc) (GLint location, GLint v0);
|
||||
typedef void (APIENTRY * glUniform2iProc) (GLint location, GLint v0, GLint v1);
|
||||
typedef void (APIENTRY * glUniform3iProc) (GLint location, GLint v0, GLint v1, GLint v2);
|
||||
typedef void (APIENTRY * glUniform4iProc) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
typedef void (APIENTRY * glUniform1fvProc) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (APIENTRY * glUniform2fvProc) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (APIENTRY * glUniform3fvProc) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (APIENTRY * glUniform4fvProc) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (APIENTRY * glUniform1ivProc) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (APIENTRY * glUniform2ivProc) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (APIENTRY * glUniform3ivProc) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (APIENTRY * glUniform4ivProc) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (APIENTRY * glUniformMatrix2fvProc) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (APIENTRY * glUniformMatrix3fvProc) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (APIENTRY * glUniformMatrix4fvProc) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (APIENTRY * glGetObjectParameterfvProc) (GLhandleARB obj, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRY * glGetObjectParameterivProc) (GLhandleARB obj, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRY * glGetInfoLogProc) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);
|
||||
typedef void (APIENTRY * glGetAttachedObjectsProc) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);
|
||||
typedef GLint (APIENTRY * glGetUniformLocationProc) (GLhandleARB programObj, const GLcharARB *name);
|
||||
typedef void (APIENTRY * glGetActiveUniformProc) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
|
||||
typedef void (APIENTRY * glGetUniformfvProc) (GLhandleARB programObj, GLint location, GLfloat *params);
|
||||
typedef void (APIENTRY * glGetUniformivProc) (GLhandleARB programObj, GLint location, GLint *params);
|
||||
typedef void (APIENTRY * glGetShaderSourceProc) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
|
||||
|
||||
/*
|
||||
* ARB_vertex_shader
|
||||
*/
|
||||
#ifndef GL_ARB_vertex_shader
|
||||
#define GL_ARB_vertex_shader 1
|
||||
#define GL_VERTEX_SHADER_ARB 0x8B31
|
||||
#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A
|
||||
#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B
|
||||
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C
|
||||
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D
|
||||
#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89
|
||||
#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A
|
||||
#endif
|
||||
|
||||
typedef void (APIENTRY * glBindAttribLocationProc) (GLhandleARB programObj, GLuint index, const GLcharARB *name);
|
||||
typedef void (APIENTRY * glGetActiveAttribProc) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
|
||||
typedef GLint (APIENTRY * glGetAttribLocationProc) (GLhandleARB programObj, const GLcharARB *name);
|
||||
|
||||
/*
|
||||
* ARB_fragment_shader
|
||||
*/
|
||||
#ifndef GL_ARB_fragment_shader
|
||||
#define GL_ARB_fragment_shader1
|
||||
#define GL_FRAGMENT_SHADER_ARB 0x8B30
|
||||
#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49
|
||||
#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NV_fragment_program
|
||||
*/
|
||||
#ifndef GL_NV_fragment_program
|
||||
#define GL_NV_fragment_program 1
|
||||
#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868
|
||||
#define GL_FRAGMENT_PROGRAM_NV 0x8870
|
||||
#define GL_MAX_TEXTURE_COORDS_NV 0x8871
|
||||
#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872
|
||||
#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873
|
||||
#define GL_PROGRAM_ERROR_STRING_NV 0x8874
|
||||
#endif
|
||||
#ifndef GL_NV_vertex_program
|
||||
#define GL_NV_vertex_program 1
|
||||
#define GL_VERTEX_PROGRAM_NV 0x8620
|
||||
#define GL_PROGRAM_ERROR_POSITION_NV 0x864B
|
||||
#endif
|
||||
|
||||
typedef void (APIENTRY * glBindProgramNVProc) (GLenum target, GLuint id);
|
||||
typedef void (APIENTRY * glDeleteProgramsNVProc) (GLsizei n, const GLuint *programs);
|
||||
typedef void (APIENTRY * glGenProgramsNVProc) (GLsizei n, GLuint *programs);
|
||||
typedef void (APIENTRY * glLoadProgramNVProc) (GLenum target, GLuint id, GLsizei len, const GLubyte *program);
|
||||
typedef void (APIENTRY * glProgramParameter4fvNVProc) (GLenum target, GLuint index, const GLfloat *v);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif // !__SG_EXTENSIONS_HXX
|
||||
|
||||
|
||||
@@ -1,709 +0,0 @@
|
||||
/* Shader
|
||||
*
|
||||
* Copyright (C) 2003-2005, Alexander Zaprjagaev <frustum@frustum.org>
|
||||
* Roman Grigoriev <grigoriev@gosniias.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <simgear_config.h>
|
||||
#endif
|
||||
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#include "shader.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
glVertexAttrib1dProc glVertexAttrib1dPtr = NULL;
|
||||
glVertexAttrib1dvProc glVertexAttrib1dvPtr = NULL;
|
||||
glVertexAttrib1fProc glVertexAttrib1fPtr = NULL;
|
||||
glVertexAttrib1fvProc glVertexAttrib1fvPtr = NULL;
|
||||
glVertexAttrib1sProc glVertexAttrib1sPtr = NULL;
|
||||
glVertexAttrib1svProc glVertexAttrib1svPtr = NULL;
|
||||
glVertexAttrib2dProc glVertexAttrib2dPtr = NULL;
|
||||
glVertexAttrib2dvProc glVertexAttrib2dvPtr = NULL;
|
||||
glVertexAttrib2fProc glVertexAttrib2fPtr = NULL;
|
||||
glVertexAttrib2fvProc glVertexAttrib2fvPtr = NULL;
|
||||
glVertexAttrib2sProc glVertexAttrib2sPtr = NULL;
|
||||
glVertexAttrib2svProc glVertexAttrib2svPtr = NULL;
|
||||
glVertexAttrib3dProc glVertexAttrib3dPtr = NULL;
|
||||
glVertexAttrib3dvProc glVertexAttrib3dvPtr = NULL;
|
||||
glVertexAttrib3fProc glVertexAttrib3fPtr = NULL;
|
||||
glVertexAttrib3fvProc glVertexAttrib3fvPtr = NULL;
|
||||
glVertexAttrib3sProc glVertexAttrib3sPtr = NULL;
|
||||
glVertexAttrib3svProc glVertexAttrib3svPtr = NULL;
|
||||
glVertexAttrib4NbvProc glVertexAttrib4NbvPtr = NULL;
|
||||
glVertexAttrib4NivProc glVertexAttrib4NivPtr = NULL;
|
||||
glVertexAttrib4NsvProc glVertexAttrib4NsvPtr = NULL;
|
||||
glVertexAttrib4NubProc glVertexAttrib4NubPtr = NULL;
|
||||
glVertexAttrib4NubvProc glVertexAttrib4NubvPtr = NULL;
|
||||
glVertexAttrib4NuivProc glVertexAttrib4NuivPtr = NULL;
|
||||
glVertexAttrib4NusvProc glVertexAttrib4NusvPtr = NULL;
|
||||
glVertexAttrib4bvProc glVertexAttrib4bvPtr = NULL;
|
||||
glVertexAttrib4dProc glVertexAttrib4dPtr = NULL;
|
||||
glVertexAttrib4dvProc glVertexAttrib4dvPtr = NULL;
|
||||
glVertexAttrib4fProc glVertexAttrib4fPtr = NULL;
|
||||
glVertexAttrib4fvProc glVertexAttrib4fvPtr = NULL;
|
||||
glVertexAttrib4ivProc glVertexAttrib4ivPtr = NULL;
|
||||
glVertexAttrib4sProc glVertexAttrib4sPtr = NULL;
|
||||
glVertexAttrib4svProc glVertexAttrib4svPtr = NULL;
|
||||
glVertexAttrib4ubvProc glVertexAttrib4ubvPtr = NULL;
|
||||
glVertexAttrib4uivProc glVertexAttrib4uivPtr = NULL;
|
||||
glVertexAttrib4usvProc glVertexAttrib4usvPtr = NULL;
|
||||
glVertexAttribPointerProc glVertexAttribPointerPtr = NULL;
|
||||
glEnableVertexAttribArrayProc glEnableVertexAttribArrayPtr = NULL;
|
||||
glDisableVertexAttribArrayProc glDisableVertexAttribArrayPtr = NULL;
|
||||
glProgramStringProc glProgramStringPtr = NULL;
|
||||
glBindProgramProc glBindProgramPtr = NULL;
|
||||
glDeleteProgramsProc glDeleteProgramsPtr = NULL;
|
||||
glGenProgramsProc glGenProgramsPtr = NULL;
|
||||
glProgramEnvParameter4dProc glProgramEnvParameter4dPtr = NULL;
|
||||
glProgramEnvParameter4dvProc glProgramEnvParameter4dvPtr = NULL;
|
||||
glProgramEnvParameter4fProc glProgramEnvParameter4fPtr = NULL;
|
||||
glProgramEnvParameter4fvProc glProgramEnvParameter4fvPtr = NULL;
|
||||
glProgramLocalParameter4dProc glProgramLocalParameter4dPtr = NULL;
|
||||
glProgramLocalParameter4dvProc glProgramLocalParameter4dvPtr = NULL;
|
||||
glProgramLocalParameter4fProc glProgramLocalParameter4fPtr = NULL;
|
||||
glProgramLocalParameter4fvProc glProgramLocalParameter4fvPtr = NULL;
|
||||
glGetProgramEnvParameterdvProc glGetProgramEnvParameterdvPtr = NULL;
|
||||
glGetProgramEnvParameterfvProc glGetProgramEnvParameterfvPtr = NULL;
|
||||
glGetProgramLocalParameterdvProc glGetProgramLocalParameterdvPtr = NULL;
|
||||
glGetProgramLocalParameterfvProc glGetProgramLocalParameterfvPtr = NULL;
|
||||
glGetProgramivProc glGetProgramivPtr = NULL;
|
||||
glGetProgramStringProc glGetProgramStringPtr = NULL;
|
||||
glGetVertexAttribdvProc glGetVertexAttribdvPtr = NULL;
|
||||
glGetVertexAttribfvProc glGetVertexAttribfvPtr = NULL;
|
||||
glGetVertexAttribivProc glGetVertexAttribivPtr = NULL;
|
||||
glGetVertexAttribPointervProc glGetVertexAttribPointervPtr = NULL;
|
||||
glIsProgramProc glIsProgramPtr = NULL;
|
||||
|
||||
glDeleteObjectProc glDeleteObjectPtr = NULL;
|
||||
glGetHandleProc glGetHandlePtr = NULL;
|
||||
glDetachObjectProc glDetachObjectPtr = NULL;
|
||||
glCreateShaderObjectProc glCreateShaderObjectPtr = NULL;
|
||||
glShaderSourceProc glShaderSourcePtr = NULL;
|
||||
glCompileShaderProc glCompileShaderPtr = NULL;
|
||||
glCreateProgramObjectProc glCreateProgramObjectPtr = NULL;
|
||||
glAttachObjectProc glAttachObjectPtr = NULL;
|
||||
glLinkProgramProc glLinkProgramPtr = NULL;
|
||||
glUseProgramObjectProc glUseProgramObjectPtr = NULL;
|
||||
glValidateProgramProc glValidateProgramPtr = NULL;
|
||||
glUniform1fProc glUniform1fPtr = NULL;
|
||||
glUniform2fProc glUniform2fPtr = NULL;
|
||||
glUniform3fProc glUniform3fPtr = NULL;
|
||||
glUniform4fProc glUniform4fPtr = NULL;
|
||||
glUniform1iProc glUniform1iPtr = NULL;
|
||||
glUniform2iProc glUniform2iPtr = NULL;
|
||||
glUniform3iProc glUniform3iPtr = NULL;
|
||||
glUniform4iProc glUniform4iPtr = NULL;
|
||||
glUniform1fvProc glUniform1fvPtr = NULL;
|
||||
glUniform2fvProc glUniform2fvPtr = NULL;
|
||||
glUniform3fvProc glUniform3fvPtr = NULL;
|
||||
glUniform4fvProc glUniform4fvPtr = NULL;
|
||||
glUniform1ivProc glUniform1ivPtr = NULL;
|
||||
glUniform2ivProc glUniform2ivPtr = NULL;
|
||||
glUniform3ivProc glUniform3ivPtr = NULL;
|
||||
glUniform4ivProc glUniform4ivPtr = NULL;
|
||||
glUniformMatrix2fvProc glUniformMatrix2fvPtr = NULL;
|
||||
glUniformMatrix3fvProc glUniformMatrix3fvPtr = NULL;
|
||||
glUniformMatrix4fvProc glUniformMatrix4fvPtr = NULL;
|
||||
glGetObjectParameterfvProc glGetObjectParameterfvPtr = NULL;
|
||||
glGetObjectParameterivProc glGetObjectParameterivPtr = NULL;
|
||||
glGetInfoLogProc glGetInfoLogPtr = NULL;
|
||||
glGetAttachedObjectsProc glGetAttachedObjectsPtr = NULL;
|
||||
glGetUniformLocationProc glGetUniformLocationPtr = NULL;
|
||||
glGetActiveUniformProc glGetActiveUniformPtr = NULL;
|
||||
glGetUniformfvProc glGetUniformfvPtr = NULL;
|
||||
glGetUniformivProc glGetUniformivPtr = NULL;
|
||||
glGetShaderSourceProc glGetShaderSourcePtr = NULL;
|
||||
|
||||
glBindAttribLocationProc glBindAttribLocationPtr = NULL;
|
||||
glGetActiveAttribProc glGetActiveAttribPtr = NULL;
|
||||
glGetAttribLocationProc glGetAttribLocationPtr = NULL;
|
||||
|
||||
glBindProgramNVProc glBindProgramNVPtr = NULL;
|
||||
glDeleteProgramsNVProc glDeleteProgramsNVPtr = NULL;
|
||||
glGenProgramsNVProc glGenProgramsNVPtr = NULL;
|
||||
glLoadProgramNVProc glLoadProgramNVPtr = NULL;
|
||||
glProgramParameter4fvNVProc glProgramParameter4fvNVPtr = NULL;
|
||||
|
||||
bool Shader::VP_supported = false;
|
||||
bool Shader::FP_supported = false;
|
||||
bool Shader::GLSL_supported = false;
|
||||
bool Shader::NVFP_supported = false;
|
||||
GLint Shader::nb_texture_unit = 0;
|
||||
|
||||
Shader::Shader(const char *name,const char *vertex,const char *fragment) {
|
||||
|
||||
program = 0;
|
||||
vertex_target = 0;
|
||||
vertex_id = 0;
|
||||
fragment_target = 0;
|
||||
fragment_id = 0;
|
||||
|
||||
char *data;
|
||||
FILE *file = fopen(name,"rb");
|
||||
if(!file) {
|
||||
SG_LOG(SG_GL, SG_ALERT, "Shader::Shader(): can't open '" << name << "' file\n");
|
||||
return;
|
||||
}
|
||||
|
||||
fseek(file,0,SEEK_END);
|
||||
int size = ftell(file);
|
||||
data = new char[size + 1];
|
||||
data[size] = '\0';
|
||||
fseek(file,0,SEEK_SET);
|
||||
fread(data,1,size,file);
|
||||
fclose(file);
|
||||
|
||||
// skip comments
|
||||
char *s = data;
|
||||
char *d = data;
|
||||
while(*s) {
|
||||
if(*s == '/' && *(s + 1) == '/') {
|
||||
while(*s && *s != '\n') s++;
|
||||
while(*s && *s == '\n') s++;
|
||||
*d++ = '\n';
|
||||
}
|
||||
else if(*s == '/' && *(s + 1) == '*') {
|
||||
while(*s && (*s != '*' || *(s + 1) != '/')) s++;
|
||||
s += 2;
|
||||
while(*s && *s == '\n') s++;
|
||||
*d++ = '\n';
|
||||
}
|
||||
else *d++ = *s++;
|
||||
}
|
||||
*d = '\0';
|
||||
|
||||
// find shaders
|
||||
char *vertex_src = NULL;
|
||||
char *fragment_src = NULL;
|
||||
s = data;
|
||||
while(*s) {
|
||||
if(*s == '<') {
|
||||
char *name = s;
|
||||
while(*s) {
|
||||
if(std::strchr("> \t\n\r",*s)) break;
|
||||
s++;
|
||||
}
|
||||
if(*s == '>') { // it`s shader
|
||||
*name++ = '\0';
|
||||
*s++ = '\0';
|
||||
while(*s && std::strchr(" \t\n\r",*s)) s++;
|
||||
if(vertex == NULL && !std::strcmp(name,"vertex")) vertex_src = s;
|
||||
if(vertex && !std::strcmp(name,vertex)) vertex_src = s;
|
||||
if(fragment == NULL && !std::strcmp(name,"fragment")) fragment_src = s;
|
||||
if(fragment && !std::strcmp(name,fragment)) fragment_src = s;
|
||||
}
|
||||
}
|
||||
s++;
|
||||
}
|
||||
|
||||
if(vertex_src) {
|
||||
|
||||
// ARB vertex program
|
||||
if(VP_supported && !std::strncmp(vertex_src,"!!ARBvp1.0",10)) {
|
||||
vertex_target = GL_VERTEX_PROGRAM_ARB;
|
||||
glGenProgramsPtr(1,&vertex_id);
|
||||
glBindProgramPtr(GL_VERTEX_PROGRAM_ARB,vertex_id);
|
||||
glProgramStringPtr(GL_VERTEX_PROGRAM_ARB,GL_PROGRAM_FORMAT_ASCII_ARB,(GLsizei)std::strlen(vertex_src),vertex_src);
|
||||
GLint pos = -1;
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB,&pos);
|
||||
if(pos != -1) {
|
||||
SG_LOG(SG_GL, SG_ALERT, "Shader::Shader(): vertex program error in " << name << " file\n" << get_error(vertex_src,pos));
|
||||
return;
|
||||
}
|
||||
char *var = std::strstr(vertex_src, "#var ");
|
||||
while( var ) {
|
||||
char *eol = std::strchr( var + 1, '#');
|
||||
char *c2, *c3, *c4;
|
||||
c2 = strchr( var + 6, ' ');
|
||||
if( c2 ) {
|
||||
c3 = strchr( c2 + 1, ':');
|
||||
if( c3 ) {
|
||||
c4 = strchr( c3 + 1, ':');
|
||||
if( c4 )
|
||||
c4 = strchr( c4 + 1, '[');
|
||||
if( c4 && c4 < eol) {
|
||||
char type[10], name[30];
|
||||
std::strncpy( type, var + 5, c2-var-5 );
|
||||
type[c2-var-5] = 0;
|
||||
std::strncpy( name, c2 + 1, c3-c2-2 );
|
||||
name[c3-c2-2] = 0;
|
||||
struct Parameter p;
|
||||
p.location = atoi( c4 + 1);
|
||||
p.length = 4;
|
||||
if( ! std::strcmp(type, "float3") )
|
||||
p.length = 3;
|
||||
else if( ! strcmp(type, "float") )
|
||||
p.length = 1;
|
||||
arb_parameters[ name ] = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
var = strstr(var + 1, "#var ");
|
||||
}
|
||||
}
|
||||
// ARB vertex shader
|
||||
else {
|
||||
|
||||
program = glCreateProgramObjectPtr();
|
||||
|
||||
GLint length = (GLint)std::strlen(vertex_src);
|
||||
GLhandleARB vertex = glCreateShaderObjectPtr(GL_VERTEX_SHADER_ARB);
|
||||
glShaderSourcePtr(vertex,1,(const GLcharARB**)&vertex_src,&length);
|
||||
glCompileShaderPtr(vertex);
|
||||
glAttachObjectPtr(program,vertex);
|
||||
glDeleteObjectPtr(vertex);
|
||||
|
||||
glBindAttribLocationPtr(program,0,"s_attribute_0");
|
||||
glBindAttribLocationPtr(program,1,"s_attribute_1");
|
||||
glBindAttribLocationPtr(program,2,"s_attribute_2");
|
||||
glBindAttribLocationPtr(program,3,"s_attribute_3");
|
||||
glBindAttribLocationPtr(program,4,"s_attribute_4");
|
||||
glBindAttribLocationPtr(program,5,"s_attribute_5");
|
||||
glBindAttribLocationPtr(program,6,"s_attribute_6");
|
||||
|
||||
glBindAttribLocationPtr(program,0,"s_xyz");
|
||||
glBindAttribLocationPtr(program,1,"s_normal");
|
||||
glBindAttribLocationPtr(program,2,"s_tangent");
|
||||
glBindAttribLocationPtr(program,3,"s_binormal");
|
||||
glBindAttribLocationPtr(program,4,"s_texcoord");
|
||||
}
|
||||
}
|
||||
|
||||
if(fragment_src) {
|
||||
|
||||
// ARB fragment program
|
||||
if(FP_supported && !std::strncmp(fragment_src,"!!ARBfp1.0",10)) {
|
||||
fragment_target = GL_FRAGMENT_PROGRAM_ARB;
|
||||
glGenProgramsPtr(1,&fragment_id);
|
||||
glBindProgramPtr(GL_FRAGMENT_PROGRAM_ARB,fragment_id);
|
||||
glProgramStringPtr(GL_FRAGMENT_PROGRAM_ARB,GL_PROGRAM_FORMAT_ASCII_ARB,(GLsizei)std::strlen(fragment_src),fragment_src);
|
||||
GLint pos = -1;
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB,&pos);
|
||||
if(pos != -1) {
|
||||
SG_LOG(SG_GL, SG_ALERT, "Shader::Shader(): fragment program error in " << name << " file\n" << get_error(fragment_src,pos));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// NV fragment program
|
||||
else if(!strncmp(fragment_src,"!!FP1.0",7)) {
|
||||
fragment_target = GL_FRAGMENT_PROGRAM_NV;
|
||||
glGenProgramsNVPtr(1,&fragment_id);
|
||||
glBindProgramNVPtr(GL_FRAGMENT_PROGRAM_NV,fragment_id);
|
||||
glLoadProgramNVPtr(GL_FRAGMENT_PROGRAM_NV,fragment_id,(GLsizei)std::strlen(fragment_src),(GLubyte*)fragment_src);
|
||||
GLint pos = -1;
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_NV,&pos);
|
||||
if(pos != -1) {
|
||||
SG_LOG(SG_GL, SG_ALERT, "Shader::Shader(): fragment program error in " << name << " file\n" << get_error(fragment_src,pos));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// ARB fragment shader
|
||||
else {
|
||||
|
||||
if(!program) program = glCreateProgramObjectPtr();
|
||||
|
||||
GLint length = (GLint)std::strlen(fragment_src);
|
||||
GLhandleARB fragment = glCreateShaderObjectPtr(GL_FRAGMENT_SHADER_ARB);
|
||||
glShaderSourcePtr(fragment,1,(const GLcharARB**)&fragment_src,&length);
|
||||
glCompileShaderPtr(fragment);
|
||||
glAttachObjectPtr(program,fragment);
|
||||
glDeleteObjectPtr(fragment);
|
||||
}
|
||||
}
|
||||
|
||||
if(program) {
|
||||
|
||||
glLinkProgramPtr(program);
|
||||
GLint linked;
|
||||
glGetObjectParameterivPtr(program,GL_OBJECT_LINK_STATUS_ARB,&linked);
|
||||
if(!linked) {
|
||||
SG_LOG(SG_GL, SG_ALERT, "Shader::Shader(): GLSL error in " << name << " file\n" << get_glsl_error());
|
||||
return;
|
||||
}
|
||||
|
||||
glUseProgramObjectPtr(program);
|
||||
|
||||
for(int i = 0; i < 8; i++) {
|
||||
char texture[32];
|
||||
sprintf(texture,"s_texture_%d",i);
|
||||
GLint location = glGetUniformLocationPtr(program,texture);
|
||||
if(location >= 0) glUniform1iPtr(location,i);
|
||||
}
|
||||
|
||||
glUseProgramObjectPtr(0);
|
||||
|
||||
glValidateProgramPtr(program);
|
||||
GLint validated;
|
||||
glGetObjectParameterivPtr(program,GL_OBJECT_VALIDATE_STATUS_ARB,&validated);
|
||||
if(!validated) {
|
||||
SG_LOG(SG_GL, SG_ALERT, "Shader::Shader(): GLSL error in " << name << " file\n" << get_glsl_error());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
delete [] data;
|
||||
}
|
||||
|
||||
Shader::~Shader() {
|
||||
if(program) glDeleteObjectPtr(program);
|
||||
if(vertex_target == GL_VERTEX_PROGRAM_ARB) glDeleteProgramsPtr(1,&vertex_id);
|
||||
if(fragment_target == GL_FRAGMENT_PROGRAM_ARB) glDeleteProgramsPtr(1,&fragment_id);
|
||||
else if(fragment_target == GL_FRAGMENT_PROGRAM_NV) glDeleteProgramsNVPtr(1,&fragment_id);
|
||||
parameters.clear();
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
const char *Shader::get_error(char *data,int pos) {
|
||||
char *s = data;
|
||||
while(*s && pos--) s++;
|
||||
while(s >= data && *s != '\n') s--;
|
||||
char *e = ++s;
|
||||
while(*e != '\0' && *e != '\n') e++;
|
||||
*e = '\0';
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
const char *Shader::get_glsl_error() {
|
||||
GLint length;
|
||||
static char error[4096];
|
||||
glGetInfoLogPtr(program,sizeof(error),&length,error);
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
void Shader::getParameter(const char *name,Parameter *parameter) {
|
||||
if( program ) {
|
||||
char buf[1024];
|
||||
std::strcpy(buf,name);
|
||||
char *s = std::strchr(buf,':');
|
||||
if(s) {
|
||||
*s++ = '\0';
|
||||
parameter->length = std::atoi(s);
|
||||
} else {
|
||||
parameter->length = 4;
|
||||
}
|
||||
parameter->location = glGetUniformLocationPtr(program,buf);
|
||||
} else if( vertex_id ) {
|
||||
arb_parameter_list::iterator iParam = arb_parameters.find(name);
|
||||
if( iParam != arb_parameters.end() )
|
||||
parameter->location = iParam->second.location;
|
||||
else
|
||||
parameter->location = 90;
|
||||
parameter->length = 4;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
void Shader::bindNames(const char *name,...) {
|
||||
Parameter parameter;
|
||||
getParameter(name,¶meter);
|
||||
parameters.push_back(parameter);
|
||||
va_list args;
|
||||
va_start(args,name);
|
||||
while(1) {
|
||||
const char *name = va_arg(args,const char*);
|
||||
if(name == NULL) break;
|
||||
getParameter(name,¶meter);
|
||||
parameters.push_back(parameter);
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* enable/disable/bind */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
*/
|
||||
void Shader::enable() {
|
||||
if(vertex_id) glEnable(vertex_target);
|
||||
if(fragment_id) glEnable(fragment_target);
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
void Shader::disable() {
|
||||
if(program) glUseProgramObjectPtr(0);
|
||||
if(vertex_id) glDisable(vertex_target);
|
||||
if(fragment_id) glDisable(fragment_target);
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
void Shader::bind() {
|
||||
if(program) glUseProgramObjectPtr(program);
|
||||
if(vertex_id) {
|
||||
if(vertex_target == GL_VERTEX_PROGRAM_ARB) glBindProgramPtr(vertex_target,vertex_id);
|
||||
}
|
||||
if(fragment_id) {
|
||||
if(fragment_target == GL_FRAGMENT_PROGRAM_ARB) glBindProgramPtr(fragment_target,fragment_id);
|
||||
else if(fragment_target == GL_FRAGMENT_PROGRAM_NV) glBindProgramNVPtr(fragment_target,fragment_id);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
void Shader::bind(const float *v,...) {
|
||||
if(fragment_id) {
|
||||
if(fragment_target == GL_FRAGMENT_PROGRAM_ARB) glBindProgramPtr(fragment_target,fragment_id);
|
||||
else if(fragment_target == GL_FRAGMENT_PROGRAM_NV) glBindProgramNVPtr(fragment_target,fragment_id);
|
||||
} else {
|
||||
if(program == 0) {
|
||||
SG_LOG(SG_GL, SG_ALERT, "Shader::bind(): error GLSL shader isn't loaded\n");
|
||||
return;
|
||||
}
|
||||
glUseProgramObjectPtr(program);
|
||||
}
|
||||
const float *value = v;
|
||||
va_list args;
|
||||
va_start(args,v);
|
||||
for(int i = 0; i < (int)parameters.size(); i++) {
|
||||
if( vertex_target ) {
|
||||
glProgramLocalParameter4fvPtr( vertex_target, parameters[i].location, value);
|
||||
} else if( program ) {
|
||||
if(parameters[i].length == 1) glUniform1fvPtr(parameters[i].location,1,value);
|
||||
else if(parameters[i].length == 2) glUniform2fvPtr(parameters[i].location,1,value);
|
||||
else if(parameters[i].length == 3) glUniform3fvPtr(parameters[i].location,1,value);
|
||||
else if(parameters[i].length == 4) glUniform4fvPtr(parameters[i].location,1,value);
|
||||
else if(parameters[i].length == 9) glUniformMatrix3fvPtr(parameters[i].location,1,false,value);
|
||||
else if(parameters[i].length == 16) glUniformMatrix4fvPtr(parameters[i].location,1,false,value);
|
||||
}
|
||||
value = va_arg(args,const float*);
|
||||
if(!value) break;
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* set parameters */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
void Shader::setLocalParameter(int location,const float *value) {
|
||||
if(vertex_target == 0) {
|
||||
SG_LOG(SG_GL, SG_ALERT, "Shader::setLocalParameter(): error vertex program isn't loaded\n");
|
||||
return;
|
||||
}
|
||||
glProgramLocalParameter4fvPtr(vertex_target,location,value);
|
||||
}
|
||||
|
||||
void Shader::setEnvParameter(int location,const float *value) {
|
||||
if(vertex_target == 0) {
|
||||
SG_LOG(SG_GL, SG_ALERT, "Shader::setEnvParameter(): error vertex program isn't loaded\n");
|
||||
return;
|
||||
}
|
||||
glProgramEnvParameter4fvPtr(vertex_target,location,value);
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
void Shader::setParameter(const char *name,const float *value) {
|
||||
Parameter parameter;
|
||||
getParameter(name,¶meter);
|
||||
if( vertex_target ) {
|
||||
glProgramLocalParameter4fvPtr( vertex_target, parameter.location, value);
|
||||
return;
|
||||
}
|
||||
if(program == 0) {
|
||||
SG_LOG(SG_GL, SG_ALERT, "Shader::setLocalParameter(): error GLSL shader isn't loaded\n");
|
||||
return;
|
||||
}
|
||||
if(parameter.length == 1) glUniform1fvPtr(parameter.location,1,value);
|
||||
else if(parameter.length == 2) glUniform2fvPtr(parameter.location,1,value);
|
||||
else if(parameter.length == 3) glUniform3fvPtr(parameter.location,1,value);
|
||||
else if(parameter.length == 4) glUniform4fvPtr(parameter.location,1,value);
|
||||
else if(parameter.length == 9) glUniformMatrix3fvPtr(parameter.location,1,false,value);
|
||||
else if(parameter.length == 16) glUniformMatrix4fvPtr(parameter.location,1,false,value);
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
void Shader::setParameters(const float *v,...) {
|
||||
const float *value = v;
|
||||
va_list args;
|
||||
va_start(args,v);
|
||||
for(int i = 0; i < (int)parameters.size(); i++) {
|
||||
if( vertex_target ) {
|
||||
glProgramLocalParameter4fvPtr( vertex_target, parameters[i].location, value);
|
||||
} else if( program ) {
|
||||
if(parameters[i].length == 1) glUniform1fvPtr(parameters[i].location,1,value);
|
||||
else if(parameters[i].length == 2) glUniform2fvPtr(parameters[i].location,1,value);
|
||||
else if(parameters[i].length == 3) glUniform3fvPtr(parameters[i].location,1,value);
|
||||
else if(parameters[i].length == 4) glUniform4fvPtr(parameters[i].location,1,value);
|
||||
else if(parameters[i].length == 9) glUniformMatrix3fvPtr(parameters[i].location,1,false,value);
|
||||
else if(parameters[i].length == 16) glUniformMatrix4fvPtr(parameters[i].location,1,false,value);
|
||||
}
|
||||
value = va_arg(args,const float*);
|
||||
if(!value) break;
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
#ifndef CONCAT
|
||||
#define CONCAT(a,b) a##b
|
||||
#endif
|
||||
#define mystringify(a) CONCAT(ST,R)(a)
|
||||
#define STR(x) #x
|
||||
#define LOAD_EXT(fn) CONCAT(fn,Ptr) = (CONCAT(fn,Proc)) SGLookupFunction( mystringify(CONCAT(fn,ARB)) )
|
||||
|
||||
void Shader::Init(void) {
|
||||
if( SGIsOpenGLExtensionSupported("GL_ARB_multitexture") )
|
||||
glGetIntegerv( GL_MAX_TEXTURE_UNITS_ARB, &nb_texture_unit );
|
||||
VP_supported = SGIsOpenGLExtensionSupported("GL_ARB_vertex_program");
|
||||
FP_supported = SGIsOpenGLExtensionSupported("GL_ARB_fragment_program");
|
||||
// check that
|
||||
GLSL_supported = SGIsOpenGLExtensionSupported("GL_ARB_shading_language_100") &&
|
||||
SGIsOpenGLExtensionSupported("GL_ARB_fragment_shader") &&
|
||||
SGIsOpenGLExtensionSupported("GL_ARB_vertex_shader") &&
|
||||
SGIsOpenGLExtensionSupported("GL_ARB_shader_objects");
|
||||
NVFP_supported = SGIsOpenGLExtensionSupported("GL_NV_fragment_program");
|
||||
|
||||
if( VP_supported || FP_supported ) {
|
||||
/* All ARB_fragment_program entry points are shared with ARB_vertex_program. */
|
||||
LOAD_EXT(glVertexAttrib1d);
|
||||
LOAD_EXT( glVertexAttrib1dv );
|
||||
LOAD_EXT( glVertexAttrib1f );
|
||||
LOAD_EXT( glVertexAttrib1fv );
|
||||
LOAD_EXT( glVertexAttrib1s );
|
||||
LOAD_EXT( glVertexAttrib1sv );
|
||||
LOAD_EXT( glVertexAttrib2d );
|
||||
LOAD_EXT( glVertexAttrib2dv );
|
||||
LOAD_EXT( glVertexAttrib2f );
|
||||
LOAD_EXT( glVertexAttrib2fv );
|
||||
LOAD_EXT( glVertexAttrib2s );
|
||||
LOAD_EXT( glVertexAttrib2sv );
|
||||
LOAD_EXT( glVertexAttrib3d );
|
||||
LOAD_EXT( glVertexAttrib3dv );
|
||||
LOAD_EXT( glVertexAttrib3f );
|
||||
LOAD_EXT( glVertexAttrib3fv );
|
||||
LOAD_EXT( glVertexAttrib3s );
|
||||
LOAD_EXT( glVertexAttrib3sv );
|
||||
LOAD_EXT( glVertexAttrib4Nbv );
|
||||
LOAD_EXT( glVertexAttrib4Niv );
|
||||
LOAD_EXT( glVertexAttrib4Nsv );
|
||||
LOAD_EXT( glVertexAttrib4Nub );
|
||||
LOAD_EXT( glVertexAttrib4Nubv );
|
||||
LOAD_EXT( glVertexAttrib4Nuiv );
|
||||
LOAD_EXT( glVertexAttrib4Nusv );
|
||||
LOAD_EXT( glVertexAttrib4bv );
|
||||
LOAD_EXT( glVertexAttrib4d );
|
||||
LOAD_EXT( glVertexAttrib4dv );
|
||||
LOAD_EXT( glVertexAttrib4f );
|
||||
LOAD_EXT( glVertexAttrib4fv );
|
||||
LOAD_EXT( glVertexAttrib4iv );
|
||||
LOAD_EXT( glVertexAttrib4s );
|
||||
LOAD_EXT( glVertexAttrib4sv );
|
||||
LOAD_EXT( glVertexAttrib4ubv );
|
||||
LOAD_EXT( glVertexAttrib4uiv );
|
||||
LOAD_EXT( glVertexAttrib4usv );
|
||||
LOAD_EXT( glVertexAttribPointer );
|
||||
LOAD_EXT( glEnableVertexAttribArray );
|
||||
LOAD_EXT( glDisableVertexAttribArray );
|
||||
LOAD_EXT( glProgramString );
|
||||
LOAD_EXT( glBindProgram );
|
||||
LOAD_EXT( glDeletePrograms );
|
||||
LOAD_EXT( glGenPrograms );
|
||||
LOAD_EXT( glProgramEnvParameter4d );
|
||||
LOAD_EXT( glProgramEnvParameter4dv );
|
||||
LOAD_EXT( glProgramEnvParameter4f );
|
||||
LOAD_EXT( glProgramEnvParameter4fv );
|
||||
LOAD_EXT( glProgramLocalParameter4d );
|
||||
LOAD_EXT( glProgramLocalParameter4dv );
|
||||
LOAD_EXT( glProgramLocalParameter4f );
|
||||
LOAD_EXT( glProgramLocalParameter4fv );
|
||||
LOAD_EXT( glGetProgramEnvParameterdv );
|
||||
LOAD_EXT( glGetProgramEnvParameterfv );
|
||||
LOAD_EXT( glGetProgramLocalParameterdv );
|
||||
LOAD_EXT( glGetProgramLocalParameterfv );
|
||||
LOAD_EXT( glGetProgramiv );
|
||||
LOAD_EXT( glGetProgramString );
|
||||
LOAD_EXT( glGetVertexAttribdv );
|
||||
LOAD_EXT( glGetVertexAttribfv );
|
||||
LOAD_EXT( glGetVertexAttribiv );
|
||||
LOAD_EXT( glGetVertexAttribPointerv );
|
||||
LOAD_EXT( glIsProgram );
|
||||
}
|
||||
if( GLSL_supported ) {
|
||||
LOAD_EXT( glDeleteObject );
|
||||
LOAD_EXT( glGetHandle );
|
||||
LOAD_EXT( glDetachObject );
|
||||
LOAD_EXT( glCreateShaderObject );
|
||||
LOAD_EXT( glShaderSource );
|
||||
LOAD_EXT( glCompileShader );
|
||||
LOAD_EXT( glCreateProgramObject );
|
||||
LOAD_EXT( glAttachObject );
|
||||
LOAD_EXT( glLinkProgram );
|
||||
LOAD_EXT( glUseProgramObject );
|
||||
LOAD_EXT( glValidateProgram );
|
||||
LOAD_EXT( glUniform1f );
|
||||
LOAD_EXT( glUniform2f );
|
||||
LOAD_EXT( glUniform3f );
|
||||
LOAD_EXT( glUniform4f );
|
||||
LOAD_EXT( glUniform1i );
|
||||
LOAD_EXT( glUniform2i );
|
||||
LOAD_EXT( glUniform3i );
|
||||
LOAD_EXT( glUniform4i );
|
||||
LOAD_EXT( glUniform1fv );
|
||||
LOAD_EXT( glUniform2fv );
|
||||
LOAD_EXT( glUniform3fv );
|
||||
LOAD_EXT( glUniform4fv );
|
||||
LOAD_EXT( glUniform1iv );
|
||||
LOAD_EXT( glUniform2iv );
|
||||
LOAD_EXT( glUniform3iv );
|
||||
LOAD_EXT( glUniform4iv );
|
||||
LOAD_EXT( glUniformMatrix2fv );
|
||||
LOAD_EXT( glUniformMatrix3fv );
|
||||
LOAD_EXT( glUniformMatrix4fv );
|
||||
LOAD_EXT( glGetObjectParameterfv );
|
||||
LOAD_EXT( glGetObjectParameteriv );
|
||||
LOAD_EXT( glGetInfoLog );
|
||||
LOAD_EXT( glGetAttachedObjects );
|
||||
LOAD_EXT( glGetUniformLocation );
|
||||
LOAD_EXT( glGetActiveUniform );
|
||||
LOAD_EXT( glGetUniformfv );
|
||||
LOAD_EXT( glGetUniformiv );
|
||||
LOAD_EXT( glGetShaderSource );
|
||||
|
||||
LOAD_EXT( glBindAttribLocation );
|
||||
LOAD_EXT( glGetActiveAttrib );
|
||||
LOAD_EXT( glGetAttribLocation );
|
||||
|
||||
}
|
||||
if( NVFP_supported ) {
|
||||
glBindProgramNVPtr = (glBindProgramNVProc) SGLookupFunction( "glBindProgramNV" );
|
||||
glDeleteProgramsNVPtr = (glDeleteProgramsNVProc) SGLookupFunction( "glDeleteProgramsNV" );
|
||||
glGenProgramsNVPtr = (glGenProgramsNVProc) SGLookupFunction( "glGenProgramsNV" );
|
||||
glLoadProgramNVPtr = (glLoadProgramNVProc) SGLookupFunction( "glLoadProgramNV" );
|
||||
glProgramParameter4fvNVPtr = (glProgramParameter4fvNVProc) SGLookupFunction( "glProgramParameter4fvNV" );
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
/* Shader
|
||||
*
|
||||
* Copyright (C) 2003-2005, Alexander Zaprjagaev <frustum@frustum.org>
|
||||
* Roman Grigoriev <grigoriev@gosniias.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SHADER_H__
|
||||
#define __SHADER_H__
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/screen/extensions.hxx>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
using std::map;
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
class Shader {
|
||||
public:
|
||||
|
||||
Shader(const char *name,const char *vertex = NULL,const char *fragment = NULL);
|
||||
~Shader();
|
||||
|
||||
void bindNames(const char *name,...);
|
||||
|
||||
void enable();
|
||||
void disable();
|
||||
void bind();
|
||||
void bind(const float *value,...);
|
||||
|
||||
void setLocalParameter(int location,const float *value);
|
||||
void setEnvParameter(int location,const float *value);
|
||||
|
||||
void setParameter(const char *name,const float *value);
|
||||
void setParameters(const float *value,...);
|
||||
|
||||
static void Init(void);
|
||||
inline static bool is_VP_supported(void) {return VP_supported;}
|
||||
inline static bool is_FP_supported(void) {return FP_supported;}
|
||||
inline static bool is_GLSL_supported(void) {return GLSL_supported;}
|
||||
inline static bool is_NVFP_supported(void) {return NVFP_supported;}
|
||||
inline static int get_nb_texture_units(void) {return nb_texture_unit;}
|
||||
|
||||
protected:
|
||||
|
||||
struct Parameter {
|
||||
GLuint location;
|
||||
int length;
|
||||
};
|
||||
|
||||
const char *get_error(char *data,int pos);
|
||||
const char *get_glsl_error();
|
||||
|
||||
void getParameter(const char *name,Parameter *parameter);
|
||||
|
||||
GLhandleARB program;
|
||||
|
||||
GLuint vertex_target;
|
||||
GLuint vertex_id;
|
||||
|
||||
GLuint fragment_target;
|
||||
GLuint fragment_id;
|
||||
|
||||
std::vector<Parameter> parameters;
|
||||
typedef map<string, struct Parameter> arb_parameter_list;
|
||||
arb_parameter_list arb_parameters;
|
||||
|
||||
static bool VP_supported, FP_supported, GLSL_supported, NVFP_supported;
|
||||
static GLint nb_texture_unit;
|
||||
};
|
||||
|
||||
#endif /* __SHADER_H__ */
|
||||
@@ -1,325 +0,0 @@
|
||||
|
||||
class CGlPrinter
|
||||
{
|
||||
public:
|
||||
typedef enum { RENDER_TO_PRINTER, RENDER_TO_BITMAP, READ_BITMAP, PRINT_BITMAP } PRINTMODE;
|
||||
public:
|
||||
inline CGlPrinter( PRINTMODE mode = READ_BITMAP );
|
||||
inline ~CGlPrinter();
|
||||
inline bool Begin( char *title, int w=0, int h=0 );
|
||||
inline void End( GLubyte *bm=NULL );
|
||||
inline double GetAspect();
|
||||
inline int GetHorzRes();
|
||||
inline int GetVertRes();
|
||||
|
||||
private:
|
||||
PRINTMODE m_printMode;
|
||||
PRINTDLG m_printDLG;
|
||||
BITMAPINFO m_bitmapInfo;
|
||||
void *m_bitmap;
|
||||
HBITMAP bitmapHandle;
|
||||
HDC m_bitmapDC;
|
||||
HGLRC m_printerHGLRC;
|
||||
HGLRC m_bitmapHGLRC;
|
||||
int m_pageWidth; // Dimension of printer page (x)
|
||||
int m_pageHeight; // Dimension of printer page (y)
|
||||
};
|
||||
|
||||
inline double CGlPrinter::GetAspect()
|
||||
{
|
||||
return (double)m_pageWidth/(double)m_pageHeight;
|
||||
}
|
||||
|
||||
inline int CGlPrinter::GetHorzRes()
|
||||
{
|
||||
return m_pageWidth;
|
||||
}
|
||||
|
||||
inline int CGlPrinter::GetVertRes()
|
||||
{
|
||||
return m_pageHeight;
|
||||
}
|
||||
|
||||
inline CGlPrinter::CGlPrinter( PRINTMODE mode ) :
|
||||
m_printerHGLRC( 0 ), m_bitmapHGLRC( 0 ), m_printMode( mode ), m_bitmap( NULL )
|
||||
{
|
||||
}
|
||||
|
||||
inline CGlPrinter::~CGlPrinter()
|
||||
{
|
||||
}
|
||||
|
||||
inline bool CGlPrinter::Begin( char *title, int w, int h )
|
||||
{
|
||||
// Pixel format for Printer Device context
|
||||
static PIXELFORMATDESCRIPTOR pPrintfd = {
|
||||
sizeof(PIXELFORMATDESCRIPTOR), // Size of this structure
|
||||
1, // Version of this structure
|
||||
PFD_DRAW_TO_WINDOW | // Draw to Window (not to m_bitmap)
|
||||
PFD_SUPPORT_OPENGL | // Support OpenGL calls
|
||||
PFD_SUPPORT_GDI | // Allow GDI drawing in window too
|
||||
PFD_DEPTH_DONTCARE, // Don't care about depth buffering
|
||||
PFD_TYPE_RGBA, // RGBA Color mode
|
||||
24, // Want 24bit color
|
||||
0,0,0,0,0,0, // Not used to select mode
|
||||
0,0, // Not used to select mode
|
||||
0,0,0,0,0, // Not used to select mode
|
||||
0, // Size of depth buffer
|
||||
0, // Not used to select mode
|
||||
0, // Not used to select mode
|
||||
0, // Not used to select mode
|
||||
0, // Not used to select mode
|
||||
0,0,0 }; // Not used to select mode
|
||||
|
||||
DOCINFO docInfo; // Document Info
|
||||
int nPixelFormat; // Pixel format requested
|
||||
|
||||
// Get printer information
|
||||
memset(&m_printDLG,0,sizeof(PRINTDLG));
|
||||
m_printDLG.lStructSize = sizeof(PRINTDLG);
|
||||
m_printDLG.hwndOwner = GetForegroundWindow();
|
||||
m_printDLG.hDevMode = NULL;
|
||||
m_printDLG.hDevNames = NULL;
|
||||
m_printDLG.Flags = PD_RETURNDC | PD_ALLPAGES;
|
||||
|
||||
// Display printer dialog
|
||||
if(!PrintDlg(&m_printDLG))
|
||||
{
|
||||
printf( "PrintDlg() failed %lx\n", GetLastError() );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the dimensions of the page
|
||||
m_pageWidth = GetDeviceCaps(m_printDLG.hDC, HORZRES);
|
||||
m_pageHeight = GetDeviceCaps(m_printDLG.hDC, VERTRES);
|
||||
|
||||
// Initialize DocInfo structure
|
||||
docInfo.cbSize = sizeof(DOCINFO);
|
||||
docInfo.lpszDocName = title;
|
||||
docInfo.lpszOutput = NULL;
|
||||
|
||||
|
||||
// Choose a pixel format that best matches that described in pfd
|
||||
nPixelFormat = ChoosePixelFormat(m_printDLG.hDC, &pPrintfd);
|
||||
// Watch for no pixel format available for this printer
|
||||
if(nPixelFormat == 0)
|
||||
{
|
||||
// Delete the printer context
|
||||
DeleteDC(m_printDLG.hDC);
|
||||
|
||||
printf( "ChoosePixelFormat() failed %lx\n", GetLastError() );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Start the document and page
|
||||
StartDoc(m_printDLG.hDC, &docInfo);
|
||||
StartPage(m_printDLG.hDC);
|
||||
|
||||
// Set the pixel format for the device context, but watch for failure
|
||||
if(!SetPixelFormat(m_printDLG.hDC, nPixelFormat, &pPrintfd))
|
||||
{
|
||||
// Delete the printer context
|
||||
DeleteDC(m_printDLG.hDC);
|
||||
|
||||
printf( "SetPixelFormat() failed %lx\n", GetLastError() );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create the Rendering context and make it current
|
||||
if ( m_printMode == RENDER_TO_PRINTER )
|
||||
{
|
||||
m_printerHGLRC = wglCreateContext(m_printDLG.hDC);
|
||||
wglMakeCurrent(m_printDLG.hDC, m_printerHGLRC);
|
||||
}
|
||||
else
|
||||
{
|
||||
memset( &m_bitmapInfo, 0, sizeof(BITMAPINFO) );
|
||||
m_bitmapInfo.bmiHeader.biSize = sizeof( BITMAPINFOHEADER );
|
||||
if ( m_printMode == READ_BITMAP )
|
||||
{
|
||||
GLint vp[4];
|
||||
glGetIntegerv( GL_VIEWPORT, vp );
|
||||
m_bitmapInfo.bmiHeader.biWidth = vp[2];
|
||||
m_bitmapInfo.bmiHeader.biHeight = (vp[3] + 3) & ~3;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_printMode == RENDER_TO_BITMAP )
|
||||
{
|
||||
m_bitmapInfo.bmiHeader.biWidth = m_pageWidth;
|
||||
m_bitmapInfo.bmiHeader.biHeight = m_pageHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
// PRINT_BITMAP
|
||||
m_bitmapInfo.bmiHeader.biWidth = w;
|
||||
m_bitmapInfo.bmiHeader.biHeight = h;
|
||||
}
|
||||
}
|
||||
m_bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
m_bitmapInfo.bmiHeader.biBitCount = 24;
|
||||
m_bitmapInfo.bmiHeader.biCompression = BI_RGB;
|
||||
m_bitmapInfo.bmiHeader.biSizeImage = m_bitmapInfo.bmiHeader.biWidth*m_bitmapInfo.bmiHeader.biHeight*3;
|
||||
m_bitmapInfo.bmiHeader.biXPelsPerMeter = 2952; // 75dpi
|
||||
m_bitmapInfo.bmiHeader.biYPelsPerMeter = 2952; // 75dpi
|
||||
m_bitmapInfo.bmiHeader.biClrUsed = 0;
|
||||
m_bitmapInfo.bmiHeader.biClrImportant = 0;
|
||||
bitmapHandle = CreateDIBSection( NULL, &m_bitmapInfo, DIB_RGB_COLORS, &m_bitmap, NULL, 0);
|
||||
m_bitmapDC = CreateCompatibleDC( NULL );
|
||||
if ( m_bitmapDC == NULL )
|
||||
{
|
||||
DeleteDC(m_printDLG.hDC);
|
||||
printf( "CreateCompatibleDC() failed %lx\n", GetLastError() );
|
||||
return false;
|
||||
}
|
||||
if ( SelectObject( m_bitmapDC, bitmapHandle ) == NULL )
|
||||
{
|
||||
DeleteDC(m_printDLG.hDC);
|
||||
DeleteDC(m_bitmapDC);
|
||||
printf( "SelectObject() failed %lx\n", GetLastError() );
|
||||
return false;
|
||||
}
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
memset( &pfd, 0, sizeof(PIXELFORMATDESCRIPTOR) );
|
||||
pfd.nVersion = 1 ;
|
||||
pfd.dwFlags = PFD_DRAW_TO_BITMAP | PFD_SUPPORT_OPENGL;
|
||||
pfd.iPixelType = PFD_TYPE_RGBA ;
|
||||
pfd.cColorBits = 24;
|
||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||
int pixelFormat = ::ChoosePixelFormat(m_bitmapDC, &pfd);
|
||||
SetPixelFormat (m_bitmapDC, pixelFormat, &pfd);
|
||||
if ( m_printMode == RENDER_TO_BITMAP )
|
||||
{
|
||||
m_bitmapHGLRC = wglCreateContext( m_bitmapDC );
|
||||
wglMakeCurrent( m_bitmapDC, m_bitmapHGLRC );
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_printMode == RENDER_TO_PRINTER || m_printMode == RENDER_TO_BITMAP )
|
||||
{
|
||||
// Set viewing volume info
|
||||
//glViewport(0,0,m_pageWidth/2,m_pageHeight/2); // Put this in to restrict area of page.
|
||||
|
||||
GLfloat nRange = 100.0f;
|
||||
|
||||
// Reset projection matrix stack
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
|
||||
// Establish clipping volume (left, right, bottom, top, near, far)
|
||||
// This keeps the perspective square regardless of window or page size
|
||||
|
||||
if (m_pageHeight <= m_pageWidth)
|
||||
{
|
||||
glOrtho (-nRange, nRange, -nRange*m_pageHeight/m_pageWidth, nRange*m_pageHeight/m_pageWidth, -nRange, nRange);
|
||||
}
|
||||
else
|
||||
{
|
||||
glOrtho (-nRange*m_pageWidth/m_pageHeight, nRange*m_pageWidth/m_pageHeight, -nRange, nRange, -nRange, nRange);
|
||||
}
|
||||
|
||||
// Reset Model view matrix stack
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glRotatef(270.0f, 1.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void CGlPrinter::End( GLubyte *bm )
|
||||
{
|
||||
if ( m_printDLG.hDC )
|
||||
{
|
||||
glFinish();
|
||||
|
||||
if ( m_printMode == RENDER_TO_PRINTER )
|
||||
{
|
||||
if ( m_printerHGLRC )
|
||||
{
|
||||
wglDeleteContext( m_printerHGLRC );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_printMode == RENDER_TO_BITMAP )
|
||||
{
|
||||
BitBlt( m_printDLG.hDC, 0,0, m_pageWidth,m_pageHeight, m_bitmapDC, 0,0, SRCCOPY );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_printMode == READ_BITMAP )
|
||||
{
|
||||
glPixelStorei( GL_PACK_ALIGNMENT, 4 );
|
||||
glPixelStorei( GL_PACK_ROW_LENGTH, 0 );
|
||||
glPixelStorei( GL_PACK_SKIP_ROWS, 0 );
|
||||
glPixelStorei( GL_PACK_SKIP_PIXELS, 0 );
|
||||
//GLubyte *tempbitmap = (GLubyte *) malloc(m_bitmapInfo.bmiHeader.biWidth*m_bitmapInfo.bmiHeader.biHeight*4);
|
||||
glReadPixels( 0,0, m_bitmapInfo.bmiHeader.biWidth,m_bitmapInfo.bmiHeader.biHeight,
|
||||
GL_RGB, GL_UNSIGNED_BYTE, m_bitmap );
|
||||
}
|
||||
else
|
||||
{
|
||||
//PRINT_BITMAP
|
||||
memcpy( m_bitmap, bm, m_bitmapInfo.bmiHeader.biSizeImage );
|
||||
}
|
||||
int i,j;
|
||||
GLubyte *rgb, temp;
|
||||
for ( i = 0; i < m_bitmapInfo.bmiHeader.biHeight; i++ )
|
||||
{
|
||||
for ( j = 0, rgb = ((GLubyte *)m_bitmap) + i * m_bitmapInfo.bmiHeader.biWidth * 3;
|
||||
j < m_bitmapInfo.bmiHeader.biWidth;
|
||||
j++, rgb +=3 )
|
||||
{
|
||||
temp = rgb[0];
|
||||
rgb[0] = rgb[2];
|
||||
rgb[2] = temp;
|
||||
}
|
||||
}
|
||||
long width = m_pageWidth;
|
||||
long height = width * m_bitmapInfo.bmiHeader.biHeight / m_bitmapInfo.bmiHeader.biWidth;
|
||||
if ( height > m_pageHeight )
|
||||
{
|
||||
height = m_pageHeight;
|
||||
width = height * m_bitmapInfo.bmiHeader.biWidth / m_bitmapInfo.bmiHeader.biHeight;
|
||||
}
|
||||
long xoffset = (m_pageWidth - width) / 2;
|
||||
long yoffset = (m_pageHeight - height) / 2;
|
||||
StretchBlt( m_printDLG.hDC, xoffset, yoffset, width, height, m_bitmapDC, 0, 0,
|
||||
m_bitmapInfo.bmiHeader.biWidth, m_bitmapInfo.bmiHeader.biHeight, SRCCOPY );
|
||||
}
|
||||
if ( m_bitmapDC )
|
||||
{
|
||||
DeleteDC( m_bitmapDC );
|
||||
}
|
||||
if ( bitmapHandle )
|
||||
{
|
||||
DeleteObject( bitmapHandle );
|
||||
}
|
||||
if ( m_bitmapHGLRC )
|
||||
{
|
||||
wglDeleteContext( m_bitmapHGLRC );
|
||||
}
|
||||
}
|
||||
|
||||
/* EndPage... */
|
||||
if ( EndPage( m_printDLG.hDC ) <=0 )
|
||||
{
|
||||
printf( "EndPage() failed\n" );
|
||||
}
|
||||
|
||||
/* EndDoc... */
|
||||
if ( EndDoc( m_printDLG.hDC ) <=0 )
|
||||
{
|
||||
printf( "EndDoc() failed\n" );
|
||||
}
|
||||
|
||||
// Delete the printer context when done with it
|
||||
DeleteDC(m_printDLG.hDC);
|
||||
|
||||
// Restore window rendering context
|
||||
//wglMakeCurrent(hDC, hRC);
|
||||
wglMakeCurrent( NULL, NULL );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -854,7 +854,7 @@ Expression* logicopParser(const SGPropertyNode* exp, Parser* parser)
|
||||
parser->readChildren(exp, children);
|
||||
vector<Expression*>::iterator notBool =
|
||||
find_if(children.begin(), children.end(),
|
||||
bind(&Expression::getType, _1) != BOOL);
|
||||
boost::bind(&Expression::getType, _1) != BOOL);
|
||||
if (notBool != children.end())
|
||||
throw("non boolean operand to logical expression");
|
||||
Logicop *expr = new Logicop;
|
||||
@@ -870,7 +870,7 @@ int BindingLayout::addBinding(const string& name, Type type)
|
||||
//XXX error checkint
|
||||
vector<VariableBinding>::iterator itr
|
||||
= find_if(bindings.begin(), bindings.end(),
|
||||
bind(&VariableBinding::name, _1) == name);
|
||||
boost::bind(&VariableBinding::name, _1) == name);
|
||||
if (itr != bindings.end())
|
||||
return itr->location;
|
||||
int result = bindings.size();
|
||||
@@ -885,7 +885,7 @@ bool BindingLayout::findBinding(const std::string& name,
|
||||
using namespace boost;
|
||||
vector<VariableBinding>::const_iterator itr
|
||||
= find_if(bindings.begin(), bindings.end(),
|
||||
bind(&VariableBinding::name, _1) == name);
|
||||
boost::bind(&VariableBinding::name, _1) == name);
|
||||
if (itr != bindings.end()) {
|
||||
result = *itr;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user