26 printf("Compiled against changeset %s\n", MOJOSHADER_CHANGESET); |
26 printf("Compiled against changeset %s\n", MOJOSHADER_CHANGESET); |
27 printf("Linked against changeset %s\n", MOJOSHADER_changeset()); |
27 printf("Linked against changeset %s\n", MOJOSHADER_changeset()); |
28 printf("\n"); |
28 printf("\n"); |
29 #endif |
29 #endif |
30 |
30 |
|
31 SDL_Window *sdlwindow = NULL; |
31 if (SDL_Init(SDL_INIT_VIDEO) == -1) |
32 if (SDL_Init(SDL_INIT_VIDEO) == -1) |
32 fprintf(stderr, "SDL_Init(SDL_INIT_VIDEO) error: %s\n", SDL_GetError()); |
33 fprintf(stderr, "SDL_Init() error: %s\n", SDL_GetError()); |
|
34 else if (SDL_GL_LoadLibrary(NULL) == -1) |
|
35 fprintf(stderr, "SDL_GL_LoadLibrary() error: %s\n", SDL_GetError()); |
|
36 else if ((sdlwindow = SDL_CreateWindow(argv[0], SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_OPENGL)) == NULL) |
|
37 fprintf(stderr, "SDL_CreateWindow() error: %s\n", SDL_GetError()); |
|
38 else if (SDL_GL_CreateContext(sdlwindow) == NULL) |
|
39 fprintf(stderr, "SDL_GL_CreateContext() error: %s\n", SDL_GetError()); |
33 else |
40 else |
34 { |
41 { |
35 SDL_GL_LoadLibrary(NULL); |
42 const char *best = MOJOSHADER_glBestProfile(lookup, NULL, NULL, NULL, NULL); |
36 if (SDL_SetVideoMode(640, 480, 0, SDL_OPENGL) == NULL) |
43 MOJOSHADER_glContext *ctx = MOJOSHADER_glCreateContext(best, lookup, 0, 0, 0, 0); |
37 fprintf(stderr, "SDL_SetVideoMode() error: %s\n", SDL_GetError()); |
44 if (ctx == NULL) |
|
45 printf("MOJOSHADER_glCreateContext() fail: %s\n", MOJOSHADER_glGetError()); |
38 else |
46 else |
39 { |
47 { |
40 const char *best = MOJOSHADER_glBestProfile(lookup, NULL, NULL, NULL, NULL); |
48 printf("%s\n", best); |
41 MOJOSHADER_glContext *ctx; |
49 retval = 0; // success. |
42 ctx = MOJOSHADER_glCreateContext(best, lookup, 0, 0, 0, 0); |
50 MOJOSHADER_glDestroyContext(ctx); |
43 if (ctx == NULL) |
|
44 printf("MOJOSHADER_glCreateContext() fail: %s\n", MOJOSHADER_glGetError()); |
|
45 else |
|
46 { |
|
47 printf("%s\n", best); |
|
48 retval = 0; // success. |
|
49 MOJOSHADER_glDestroyContext(ctx); |
|
50 } // else |
|
51 } // else |
51 } // else |
52 SDL_Quit(); |
|
53 } // else |
52 } // else |
54 |
53 |
|
54 SDL_Quit(); |
55 return retval; |
55 return retval; |
56 } // main |
56 } // main |
57 |
57 |
58 // end of bestprofile.c ... |
58 // end of bestprofile.c ... |
59 |
59 |