2 * Copyright © 2017 VMware, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 * Basic WGL sanity check: create a window, context, clear window to green.
33 #include "piglit-util-gl.h"
34 #include "piglit-wgl-util.h"
43 static const float green
[4] = { 0, 1, 0, 1 };
46 glClearColor(0, 1, 0, 1);
47 glClear(GL_COLOR_BUFFER_BIT
);
49 if (!piglit_probe_rect_rgba(0, 0, piglit_width
, piglit_height
,
54 SwapBuffers(GetDC(hWnd
));
56 return pass
? PIGLIT_PASS
: PIGLIT_FAIL
;
61 main(int argc
, char **argv
)
65 for (i
= 1; i
< argc
; i
++) {
66 if (strcmp(argv
[i
], "-auto") == 0) {
72 hWnd
= piglit_get_wgl_window();
75 ctx
= piglit_get_wgl_context(hWnd
);
78 if (!wglMakeCurrent(GetDC(hWnd
), ctx
)) {
79 fprintf(stderr
, "wglMakeCurrent failed\n");
83 piglit_dispatch_default_init(PIGLIT_DISPATCH_GL
);
85 piglit_wgl_event_loop(draw
);