16 { { 0x00, 0x00, 0xff, 0x00 },
19 { { 0x00, 0xff, 0x00, 0x00 },
22 { { 0xff, 0x00, 0x00, 0x00 },
25 { { 0xff, 0xff, 0xff, 0x00 },
26 { -0.9, -0.9, 0.0 } },
29 GLuint indices
[] = { 1, 2, 3 };
31 static void Init( void )
36 static const char *prog1
=
38 "MOV result.color, vertex.color;\n"
39 "MOV result.position, vertex.position;\n"
42 glGenProgramsARB(1, &prognum
);
43 glBindProgramARB(GL_VERTEX_PROGRAM_ARB
, prognum
);
44 glProgramStringARB(GL_VERTEX_PROGRAM_ARB
, GL_PROGRAM_FORMAT_ASCII_ARB
,
45 strlen(prog1
), (const GLubyte
*) prog1
);
47 assert(glIsProgramARB(prognum
));
49 printf("glGetError = %d\n", errno
);
50 if (errno
!= GL_NO_ERROR
)
54 glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB
, &errorpos
);
55 printf("errorpos: %d\n", errorpos
);
56 printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB
));
59 glInterleavedArrays( GL_C4UB_V3F
, sizeof(verts
[0]), verts
);
64 static void Display( void )
66 glClearColor(0.3, 0.3, 0.3, 1);
67 glClear( GL_COLOR_BUFFER_BIT
| GL_DEPTH_BUFFER_BIT
);
69 glEnable(GL_VERTEX_PROGRAM_NV
);
71 /* Should have min_index == 1, maybe force a rebase:
73 glDrawElements( GL_TRIANGLES
, 3, GL_UNSIGNED_INT
, indices
);
79 static void Reshape( int width
, int height
)
81 glViewport( 0, 0, width
, height
);
82 glMatrixMode( GL_PROJECTION
);
84 glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
85 glMatrixMode( GL_MODELVIEW
);
87 /*glTranslatef( 0.0, 0.0, -15.0 );*/
91 static void Key( unsigned char key
, int x
, int y
)
106 int main( int argc
, char *argv
[] )
108 glutInit( &argc
, argv
);
109 glutInitWindowPosition( 0, 0 );
110 glutInitWindowSize( 250, 250 );
111 glutInitDisplayMode( GLUT_RGB
| GLUT_SINGLE
| GLUT_DEPTH
);
112 glutCreateWindow(argv
[0]);
114 glutReshapeFunc( Reshape
);
115 glutKeyboardFunc( Key
);
116 glutDisplayFunc( Display
);