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