Trying backport
[AROS.git] / test / mesa / mesagetprocaddress.c
blob0bf01a09db1ef286b110f947fe7dec0e8b039da4
1 /*
2 Copyright © 1995-2014, 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 initmesa()
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 deinitmesa()
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)"MesaGetProcAddress",
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 initmesa();
103 testextensions();
105 deinitmesa();
107 CloseWindow(win);
109 return 0;