From 5b16730df8e19792ed92441857f586e0ec773a1f Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 18 Aug 2008 21:44:54 +0200 Subject: [PATCH] Port vp to Windows. --- progs/vp/vp-tris.c | 32 ++++++++- progs/vp/windows/vp2003.sln | 21 ++++++ progs/vp/windows/vp2003.vcproj | 121 +++++++++++++++++++++++++++++++++ 3 files changed, 171 insertions(+), 3 deletions(-) create mode 100644 progs/vp/windows/vp2003.sln create mode 100644 progs/vp/windows/vp2003.vcproj diff --git a/progs/vp/vp-tris.c b/progs/vp/vp-tris.c index eb450cb5981..a65ac11dc3d 100644 --- a/progs/vp/vp-tris.c +++ b/progs/vp/vp-tris.c @@ -5,10 +5,22 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES #include + +#ifndef WIN32 #include #include +#define GL_GLEXT_PROTOTYPES +#else +#include +#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; } diff --git a/progs/vp/windows/vp2003.sln b/progs/vp/windows/vp2003.sln new file mode 100644 index 00000000000..76de5cfd7ff --- /dev/null +++ b/progs/vp/windows/vp2003.sln @@ -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 diff --git a/progs/vp/windows/vp2003.vcproj b/progs/vp/windows/vp2003.vcproj new file mode 100644 index 00000000000..adca2c50731 --- /dev/null +++ b/progs/vp/windows/vp2003.vcproj @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +