revert between 56095 -> 55830 in arch
[AROS.git] / arch / all-hosted / libs / hostgl / hostgl_glamakecurrent.c
blob4e8a1470f719fc560f0927753c9bca9def910d1b
1 /*
2 Copyright 2011-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/debug.h>
8 #include <proto/exec.h>
10 #include "hostgl_ctx_manager.h"
11 #include "hostgl_support.h"
14 /*****************************************************************************
16 NAME */
18 void glAMakeCurrent(
20 /* SYNOPSIS */
21 GLAContext ctx)
23 /* FUNCTION
24 Make the selected GL rendering context active.
26 INPUTS
27 ctx - GL rendering context to be made active for all following GL
28 calls.
30 RESULT
32 BUGS
34 INTERNALS
36 HISTORY
38 *****************************************************************************/
40 HostGL_Lock();
42 D(bug("[HostGL] TASK: 0x%x, MAKE CURRENT 0x%x\n", FindTask(NULL), ((struct hostgl_context *)ctx)->glXctx));
44 if (ctx)
46 GLAContext cur_ctx = HostGL_GetCurrentContext();
48 if (ctx != cur_ctx)
50 /* Recalculate buffer dimensions */
51 HostGLRecalculateBufferWidthHeight(ctx);
53 /* Attach */
54 HostGL_SetCurrentContext(ctx);
55 HostGL_UpdateGlobalGLXContext();
58 else
60 /* Detach */
61 HostGL_SetCurrentContext(NULL);
62 HostGL_UpdateGlobalGLXContext();
65 HostGL_UnLock();