1ca86eba8Smrg/* This is a copy of the test used by HomeBrew's libepoxy recipe,
2ca86eba8Smrg * originally written by Mikko Lehtonen.
3ca86eba8Smrg *
4ca86eba8Smrg * The Homebrew recipe is released under the BSD 2-Clause license.
5ca86eba8Smrg *
6ca86eba8Smrg * Copyright (c) 2009-present, Homebrew contributors
7ca86eba8Smrg * All rights reserved.
8ca86eba8Smrg *
9ca86eba8Smrg * Redistribution and use in source and binary forms, with or without
10ca86eba8Smrg * modification, are permitted provided that the following conditions are met:
11ca86eba8Smrg *
12ca86eba8Smrg *  * Redistributions of source code must retain the above copyright notice, this
13ca86eba8Smrg *    list of conditions and the following disclaimer.
14ca86eba8Smrg *  * Redistributions in binary form must reproduce the above copyright notice,
15ca86eba8Smrg *    this list of conditions and the following disclaimer in the documentation
16ca86eba8Smrg *    and/or other materials provided with the distribution.
17ca86eba8Smrg *
18ca86eba8Smrg * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19ca86eba8Smrg * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20ca86eba8Smrg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21ca86eba8Smrg * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22ca86eba8Smrg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23ca86eba8Smrg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24ca86eba8Smrg * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25ca86eba8Smrg * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26ca86eba8Smrg * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27ca86eba8Smrg * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28ca86eba8Smrg */
29ca86eba8Smrg
30ca86eba8Smrg#include <epoxy/gl.h>
31ca86eba8Smrg#include <Carbon/Carbon.h>
32ca86eba8Smrg#include <OpenGL/OpenGL.h>
33ca86eba8Smrg#include <OpenGL/CGLTypes.h>
34ca86eba8Smrg#include <OpenGL/CGLCurrent.h>
35ca86eba8Smrg#include <OpenGL/CGLContext.h>
36ca86eba8Smrg
37ca86eba8Smrgint
38ca86eba8Smrgmain (void)
39ca86eba8Smrg{
40ca86eba8Smrg    CGLPixelFormatAttribute attribs[] = {0};
41ca86eba8Smrg    CGLPixelFormatObj pix;
42ca86eba8Smrg    CGLContextObj ctx;
43ca86eba8Smrg    int npix;
44ca86eba8Smrg
45ca86eba8Smrg    CGLChoosePixelFormat(attribs, &pix, &npix);
46ca86eba8Smrg    CGLCreateContext(pix, (void *) 0, &ctx);
47ca86eba8Smrg
48ca86eba8Smrg    glClear(GL_COLOR_BUFFER_BIT);
49ca86eba8Smrg
50ca86eba8Smrg    CGLReleaseContext(ctx);
51ca86eba8Smrg    CGLReleasePixelFormat(pix);
52ca86eba8Smrg
53ca86eba8Smrg    return 0;
54ca86eba8Smrg}
55