2 Copyright 2011-2017, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
8 #include <proto/exec.h>
11 #include "hostgl_ctx_manager.h"
12 #include "hostgl_funcs.h"
13 #include "hostgl_support.h"
15 #include <x11gfx_bitmapclass.h>
17 /*****************************************************************************
21 void glADestroyContext(
27 Destroys the GL rendering context and frees all resoureces.
30 ctx - pointer to GL rendering context. A NULL pointer will be
34 The GL context is destroyed. Do no use it anymore.
42 *****************************************************************************/
44 struct hostgl_context
*_ctx
= (struct hostgl_context
*)ctx
;
49 struct hostgl_context
*cur_ctx
= NULL
;
53 dsp
= HostGL_GetGlobalX11Display();
54 cur_ctx
= HostGL_GetCurrentContext();
56 /* If the passed context is current context, detach it */
59 HostGL_SetCurrentContext(NULL
);
60 HostGL_UpdateGlobalGLXContext();
64 GLXCALL(glXDestroyContext
, dsp
, _ctx
->glXctx
);
66 #if defined(RENDERER_SEPARATE_X_WINDOW)
67 GLXCALL(glXDestroyWindow
, dsp
, _ctx
->glXWindow
);
68 XCALL(XDestroyWindow
, dsp
, _ctx
->XWindow
);
70 #if defined(RENDERER_PBUFFER_WPA)
71 HostGL_DeAllocatePBuffer(_ctx
);
73 #if defined(RENDERER_PIXMAP_BLIT)
74 HostGL_DeAllocatePixmap(_ctx
);
77 if (_ctx
->HiddX11BitMapAB
)
78 OOP_ReleaseAttrBase(IID_Hidd_BitMap_X11
);
80 XCALL(XFree
, _ctx
->framebuffer
->fbconfigs
);
81 FreeVec(_ctx
->framebuffer
);
82 HostGLFreeContext(ctx
);