summaryrefslogtreecommitdiff
path: root/progs/vp/vp-tris.c
diff options
context:
space:
mode:
authorMichal Krol <michal@tungstengraphics.com>2008-08-19 14:43:19 +0200
committerMichal Krol <michal@tungstengraphics.com>2008-08-19 14:43:19 +0200
commit2858ec66c2dfb67c904cab5c56291b621c62720d (patch)
tree9a7648a1703973083f52e1cb501e18cd6cddc972 /progs/vp/vp-tris.c
parent4405e428e4c2a80172c803cc3c4933d546bf2b4d (diff)
Add support for NVIDIA programs.
Diffstat (limited to 'progs/vp/vp-tris.c')
-rw-r--r--progs/vp/vp-tris.c41
1 files changed, 31 insertions, 10 deletions
diff --git a/progs/vp/vp-tris.c b/progs/vp/vp-tris.c
index a65ac11dc3..3fe35f7e3e 100644
--- a/progs/vp/vp-tris.c
+++ b/progs/vp/vp-tris.c
@@ -20,6 +20,11 @@ static PFNGLBINDPROGRAMARBPROC glBindProgramARB = NULL;
static PFNGLGENPROGRAMSARBPROC glGenProgramsARB = NULL;
static PFNGLPROGRAMSTRINGARBPROC glProgramStringARB = NULL;
static PFNGLISPROGRAMARBPROC glIsProgramARB = NULL;
+
+static PFNGLBINDPROGRAMNVPROC glBindProgramNV = NULL;
+static PFNGLGENPROGRAMSNVPROC glGenProgramsNV = NULL;
+static PFNGLLOADPROGRAMNVPROC glLoadProgramNV = NULL;
+static PFNGLISPROGRAMNVPROC glIsProgramNV = NULL;
#endif
static const char *filename = NULL;
@@ -108,20 +113,37 @@ static void Init( void )
fprintf(stderr, "%.*s\n", sz, buf);
+ if (strncmp( buf, "!!VP", 4 ) == 0) {
#ifdef WIN32
- glBindProgramARB = (PFNGLBINDPROGRAMARBPROC) wglGetProcAddress( "glBindProgramARB" );
- glGenProgramsARB = (PFNGLGENPROGRAMSARBPROC) wglGetProcAddress( "glGenProgramsARB" );
- glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC) wglGetProcAddress( "glProgramStringARB" );
- glIsProgramARB = (PFNGLISPROGRAMARBPROC) wglGetProcAddress( "glIsProgramARB" );
+ glBindProgramNV = (PFNGLBINDPROGRAMNVPROC) wglGetProcAddress( "glBindProgramNV" );
+ glGenProgramsNV = (PFNGLGENPROGRAMSNVPROC) wglGetProcAddress( "glGenProgramsNV" );
+ glLoadProgramNV = (PFNGLLOADPROGRAMNVPROC) wglGetProcAddress( "glLoadProgramNV" );
+ glIsProgramNV = (PFNGLISPROGRAMNVPROC) wglGetProcAddress( "glIsProgramNV" );
#endif
- glEnable(GL_VERTEX_PROGRAM_ARB);
+ glEnable( GL_VERTEX_PROGRAM_NV );
+ glGenProgramsNV( 1, &prognum );
+ glBindProgramNV( GL_VERTEX_PROGRAM_NV, prognum );
+ glLoadProgramNV( GL_VERTEX_PROGRAM_NV, prognum, sz, (const GLubyte *) buf );
+ assert( glIsProgramNV( prognum ) );
+ }
+ else {
+#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);
+ glGenProgramsARB(1, &prognum);
- glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
- glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- sz, (const GLubyte *) buf);
+ glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
+ glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
+ sz, (const GLubyte *) buf);
+ assert(glIsProgramARB(prognum));
+ }
errno = glGetError();
printf("glGetError = %d\n", errno);
@@ -133,7 +155,6 @@ static void Init( void )
printf("errorpos: %d\n", errorpos);
printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
}
- assert(glIsProgramARB(prognum));
}