Port vp to Windows.
This commit is contained in:
parent
93305bd680
commit
5b16730df8
|
@ -5,10 +5,22 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glut.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#else
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
static PFNGLBINDPROGRAMARBPROC glBindProgramARB = NULL;
|
||||
static PFNGLGENPROGRAMSARBPROC glGenProgramsARB = NULL;
|
||||
static PFNGLPROGRAMSTRINGARBPROC glProgramStringARB = NULL;
|
||||
static PFNGLISPROGRAMARBPROC glIsProgramARB = NULL;
|
||||
#endif
|
||||
|
||||
static const char *filename = NULL;
|
||||
static GLuint nr_steps = 4;
|
||||
|
@ -25,6 +37,9 @@ static void usage( char *name )
|
|||
|
||||
unsigned show_fps = 0;
|
||||
unsigned int frame_cnt = 0;
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
void alarmhandler(int);
|
||||
|
||||
void alarmhandler (int sig)
|
||||
|
@ -39,6 +54,8 @@ void alarmhandler (int sig)
|
|||
alarm(5);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void args(int argc, char *argv[])
|
||||
{
|
||||
GLint i;
|
||||
|
@ -83,7 +100,7 @@ static void Init( void )
|
|||
exit(1);
|
||||
}
|
||||
|
||||
sz = fread(buf, 1, sizeof(buf), f);
|
||||
sz = (GLuint) fread(buf, 1, sizeof(buf), f);
|
||||
if (!feof(f)) {
|
||||
fprintf(stderr, "file too long\n");
|
||||
exit(1);
|
||||
|
@ -91,7 +108,14 @@ static void Init( void )
|
|||
|
||||
fprintf(stderr, "%.*s\n", sz, buf);
|
||||
|
||||
glEnable(GL_VERTEX_PROGRAM_NV);
|
||||
#ifdef WIN32
|
||||
glBindProgramARB = (PFNGLBINDPROGRAMARBPROC) wglGetProcAddress( "glBindProgramARB" );
|
||||
glGenProgramsARB = (PFNGLGENPROGRAMSARBPROC) wglGetProcAddress( "glGenProgramsARB" );
|
||||
glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC) wglGetProcAddress( "glProgramStringARB" );
|
||||
glIsProgramARB = (PFNGLISPROGRAMARBPROC) wglGetProcAddress( "glIsProgramARB" );
|
||||
#endif
|
||||
|
||||
glEnable(GL_VERTEX_PROGRAM_ARB);
|
||||
|
||||
glGenProgramsARB(1, &prognum);
|
||||
|
||||
|
@ -236,10 +260,12 @@ int main( int argc, char *argv[] )
|
|||
glutDisplayFunc( Display );
|
||||
args( argc, argv );
|
||||
Init();
|
||||
#ifndef WIN32
|
||||
if (show_fps) {
|
||||
signal(SIGALRM, alarmhandler);
|
||||
alarm(5);
|
||||
}
|
||||
#endif
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vp2003", "vp2003.vcproj", "{E1C70416-98E7-4282-B6B2-6C9CF90B12C0}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{E1C70416-98E7-4282-B6B2-6C9CF90B12C0}.Debug.ActiveCfg = Debug|Win32
|
||||
{E1C70416-98E7-4282-B6B2-6C9CF90B12C0}.Debug.Build.0 = Debug|Win32
|
||||
{E1C70416-98E7-4282-B6B2-6C9CF90B12C0}.Release.ActiveCfg = Release|Win32
|
||||
{E1C70416-98E7-4282-B6B2-6C9CF90B12C0}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,121 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="vp2003"
|
||||
ProjectGUID="{E1C70416-98E7-4282-B6B2-6C9CF90B12C0}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="glut32.lib"
|
||||
OutputFile="$(OutDir)/vp2003.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/vp2003.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="glut32.lib"
|
||||
OutputFile="$(OutDir)/vp2003.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="..\vp-tris.c">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
Loading…
Reference in New Issue