1 /* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */
11 static void Init( void )
16 static const char *prog1
=
18 "MOV result.color, vertex.color;\n"
19 "MOV result.position, vertex.position;\n"
22 glGenProgramsARB(1, &prognum
);
24 glBindProgramARB(GL_VERTEX_PROGRAM_ARB
, prognum
);
25 glProgramStringARB(GL_VERTEX_PROGRAM_ARB
, GL_PROGRAM_FORMAT_ASCII_ARB
,
26 strlen(prog1
), (const GLubyte
*) prog1
);
28 assert(glIsProgramARB(prognum
));
29 errnum
= glGetError();
30 printf("glGetError = %d\n", errnum
);
31 if (errnum
!= GL_NO_ERROR
)
35 glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB
, &errorpos
);
36 printf("errorpos: %d\n", errorpos
);
37 printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB
));
41 static void Display( void )
43 glClearColor(0.3, 0.3, 0.3, 1);
44 glClear( GL_COLOR_BUFFER_BIT
| GL_DEPTH_BUFFER_BIT
);
46 glEnable(GL_VERTEX_PROGRAM_NV
);
51 glVertex3f( 0.75, -0.75, 0.0);
53 glVertex3f( 0.75, 0.75, 0.0);
56 glVertex3f( 0.75, 0.75, 0.0);
58 glVertex3f(-1.75, 0.0, 0.0);
61 glBegin(GL_LINE_STRIP
);
63 glVertex3f( 0.75, -0.75, 0.0);
65 glVertex3f( 0.75, 0.75, 0.0);
67 glVertex3f(-1.75, 0.0, 0.0);
76 static void Reshape( int width
, int height
)
78 glViewport( 0, 0, width
, height
);
79 glMatrixMode( GL_PROJECTION
);
81 glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
82 glMatrixMode( GL_MODELVIEW
);
84 /*glTranslatef( 0.0, 0.0, -15.0 );*/
88 static void Key( unsigned char key
, int x
, int y
)
103 int main( int argc
, char *argv
[] )
105 glutInit( &argc
, argv
);
106 glutInitWindowPosition( 0, 0 );
107 glutInitWindowSize( 250, 250 );
108 glutInitDisplayMode( GLUT_RGB
| GLUT_SINGLE
| GLUT_DEPTH
);
109 glutCreateWindow(argv
[0]);
111 glutReshapeFunc( Reshape
);
112 glutKeyboardFunc( Key
);
113 glutDisplayFunc( Display
);