#ifndef	ARCH_COMMON_GL_CTX_H
#define	ARCH_COMMON_GL_CTX_H

#include <../arch/common/winlib.h>
#include <GL/gl.h>

#define ARCH_COMMON_GL_CONTEXT_FIELDS \
	libv_object_t base; \
	arch_window_p wnd; \
	char *vendor, *renderer, *version, *extensions; \

#define ARCH_CLEAR_COMMON_GL_CONTEXT_FIELDS(ctx) \
	if((ctx)->vendor) { \
		memFree(gl_context->vendor); \
		gl_context->vendor = NULL; \
	} \
	if((ctx)->renderer) { \
		memFree(gl_context->renderer); \
		gl_context->renderer = NULL; \
	} \
	if((ctx)->version) { \
		memFree(gl_context->version); \
		gl_context->version = NULL; \
	} \
	if((ctx)->extensions) { \
		memFree(gl_context->extensions); \
		gl_context->extensions = NULL; \
	} \
	if((ctx)->wnd) { \
		archWinClose(gl_context->wnd); \
		gl_context->wnd = NULL; \
	}

#endif	/* !ARCH_COMMON_GL_CTX_H */
