1 /** \file
2  * \brief OpenGL canvas for Iup.
3  *
4  * See Copyright Notice in "iup.h"
5  */
6 
7 module iup.iupgl;
8 
9 import iup.iup : Ihandle;
10 
11 version(DigitalMars) version(Windows) { pragma(lib, "iupgl.lib"); } // libiupgl.so depends on libiup.so, ...
12 version(DigitalMars) version(Windows) { pragma(lib, "opengl32.lib"); } // link with the "opengl32.lib" library on Windows.
13 
14 extern(C) @nogc nothrow :
15 
16 /* Attributes
17 ** To set the appropriate visual (pixel format) the following
18 ** attributes may be specified. Their values should be set
19 ** before the canvas is mapped to the scrren.
20 ** After mapping, changing their values has no effect.
21 */
22 /* IUP_SINGLE (defaut) or IUP_DOUBLE */
23 enum IUP_BUFFER           = "BUFFER";
24 /* IUP_NO (defaut) or IUP_YES */
25 enum IUP_STEREO           = "STEREO";
26 /* Number of bits if index mode */
27 enum IUP_BUFFER_SIZE      = "BUFFER_SIZE";
28 /* Number of red bits */
29 enum IUP_RED_SIZE         = "RED_SIZE";
30 /* Number of green bits */
31 enum IUP_GREEN_SIZE       = "GREEN_SIZE";
32 /* Number of blue bits */
33 enum IUP_BLUE_SIZE        = "BLUE_SIZE";
34 /* Number of alpha bits */
35 enum IUP_ALPHA_SIZE       = "ALPHA_SIZE";
36 /* Number of bits in depth buffer */
37 enum IUP_DEPTH_SIZE       = "DEPTH_SIZE";
38 /* Number of bits in stencil buffer */
39 enum IUP_STENCIL_SIZE     = "STENCIL_SIZE";
40 /* Number of red bits in accum. buffer */
41 enum IUP_ACCUM_RED_SIZE   = "ACCUM_RED_SIZE";
42 /* Number of green bits in accum. buffer */
43 enum IUP_ACCUM_GREEN_SIZE = "ACCUM_GREEN_SIZE";
44 /* Number of blue bits in accum. buffer */
45 enum IUP_ACCUM_BLUE_SIZE  = "ACCUM_BLUE_SIZE";
46 /* Number of alpha bits in accum. buffer */
47 enum IUP_ACCUM_ALPHA_SIZE = "ACCUM_ALPHA_SIZE";
48 
49 
50 /* Attribute values */
51 enum IUP_DOUBLE = "DOUBLE";
52 enum IUP_SINGLE = "SINGLE";
53 enum IUP_INDEX  = "INDEX";
54 enum IUP_RGBA   = "RGBA";
55 enum IUP_YES    = "YES";
56 enum IUP_NO     = "NO";
57 
58 void IupGLCanvasOpen(); /// See_Also: https://webserver2.tecgraf.puc-rio.br/iup/en/ctrl/iupglcanvas.html
59 
60 Ihandle* IupGLCanvas(const(char)* action);
61 Ihandle* IupGLBackgroundBox(Ihandle* child);
62 
63 void IupGLMakeCurrent(Ihandle* ih);
64 int IupGLIsCurrent(Ihandle* ih);
65 void IupGLSwapBuffers(Ihandle* ih);
66 void IupGLPalette(Ihandle* ih, int index, float r, float g, float b);
67 void IupGLUseFont(Ihandle* ih, int first, int count, int list_base);
68 void IupGLWait(int gl);