grub2: bring back build of aros-side grub2 tools
[AROS.git] / test / gl / glgetprocaddress.c
blob6a5ebc79bd1c30e860be03ba18ebc5b9b8acb617
1 /*
2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <exec/types.h>
7 #include <intuition/intuition.h>
8 #include <intuition/intuitionbase.h>
9 #include <intuition/screens.h>
11 #include <proto/exec.h>
12 #include <proto/dos.h>
13 #include <proto/intuition.h>
16 #include <GL/gla.h>
17 #include <GL/gl.h>
19 #include <stdio.h>
21 GLAContext glcont=NULL;
23 #define RAND_COL 1.0
25 PFNGLUNIFORM4IPROC AROSglUniform4i = NULL;
27 void testextensions()
29 printf("Getting pointer to glUniform4i...\n");
30 AROSglUniform4i = glAGetProcAddress("glUniform4i");
32 if (AROSglUniform4i != NULL)
34 printf("Pointer to glUniform4i acquired\n");
35 printf("Calling glUniform4i via pointer\n");
36 AROSglUniform4i(0, 0, 0, 0, 0);
37 printf("glUniform4i called\n");
39 else
41 printf("Failed to get pointer to glUniform4i");
45 struct Window * win = NULL;
47 void initgl()
49 struct TagItem attributes [ 14 ]; /* 14 should be more than enough :) */
50 int i = 0;
52 // default config. Always used...
53 attributes[i].ti_Tag = GLA_Window; attributes[i++].ti_Data = (IPTR)win;
54 attributes[i].ti_Tag = GLA_Left; attributes[i++].ti_Data = win->BorderLeft;
55 attributes[i].ti_Tag = GLA_Top; attributes[i++].ti_Data = win->BorderTop;
56 attributes[i].ti_Tag = GLA_Bottom; attributes[i++].ti_Data = win->BorderBottom;
57 attributes[i].ti_Tag = GLA_Right; attributes[i++].ti_Data = win->BorderRight;
59 // double buffer ?
60 attributes[i].ti_Tag = GLA_DoubleBuf; attributes[i++].ti_Data = GL_TRUE;
62 // RGB(A) Mode ?
63 attributes[i].ti_Tag = GLA_RGBMode; attributes[i++].ti_Data = GL_TRUE;
65 // done...
66 attributes[i].ti_Tag = TAG_DONE;
68 glcont = glACreateContext(attributes);
69 glAMakeCurrent(glcont);
72 void deinitgl()
74 glADestroyContext(glcont);
80 ** Open a simple window using OpenWindowTagList()
82 int main(int argc, char **argv)
85 win = OpenWindowTags(0,
86 WA_Title, (IPTR)"glAGetProcAddress",
87 WA_CloseGadget, TRUE,
88 WA_DragBar, TRUE,
89 WA_DepthGadget, TRUE,
90 WA_Left, 10,
91 WA_Top, 10,
92 WA_InnerWidth, 300,
93 WA_InnerHeight, 300,
94 WA_Activate, TRUE,
95 WA_RMBTrap, TRUE,
96 WA_SimpleRefresh, TRUE,
97 WA_NoCareRefresh, TRUE,
98 WA_IDCMP, IDCMP_CLOSEWINDOW,
99 TAG_DONE);
101 initgl();
103 testextensions();
105 deinitgl();
107 CloseWindow(win);
109 return 0;