GLDispatcher.h 1.92 KB
Newer Older
1 2
/*
 * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
3
 * Copyright 2000-2015 Haiku, Inc. All Rights Reserved.
4 5 6 7 8 9 10 11 12 13 14 15 16 17
 * Distributed under the terms of the MIT License.
 *
 * Authors:
 *		Brian Paul <brian.e.paul@gmail.com>
 *		Philippe Houdoin <philippe.houdoin@free.fr>
 */
#ifndef GLDISPATCHER_H
#define GLDISPATCHER_H


#include <BeBuild.h>
#include <GL/gl.h>
#include <SupportDefs.h>

18
#include "main/glheader.h"
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105

#include "glapi/glapi.h"


class BGLDispatcher
{
		// Private unimplemented copy constructors
		BGLDispatcher(const BGLDispatcher &);
		BGLDispatcher & operator=(const BGLDispatcher &);

	public:
		BGLDispatcher();
		~BGLDispatcher();

		void 					SetCurrentContext(void* context);
		void*					CurrentContext();

		struct _glapi_table* 	Table();
		status_t				SetTable(struct _glapi_table* dispatch);
		uint32					TableSize();

		const _glapi_proc 		operator[](const char* functionName);
		const char*				operator[](uint32 offset);

		const _glapi_proc		AddressOf(const char* functionName);
		uint32					OffsetOf(const char* functionName);
};


// Inlines methods
inline void
BGLDispatcher::SetCurrentContext(void* context)
{
	_glapi_set_context(context);
}


inline void*
BGLDispatcher::CurrentContext()
{
	return _glapi_get_context();
}


inline struct _glapi_table*
BGLDispatcher::Table()
{
	return _glapi_get_dispatch();
}


inline uint32
BGLDispatcher::TableSize()
{
	return _glapi_get_dispatch_table_size();
}


inline const _glapi_proc
BGLDispatcher::operator[](const char* functionName)
{
	return _glapi_get_proc_address(functionName);
}


inline const char*
BGLDispatcher::operator[](uint32 offset)
{
	return _glapi_get_proc_name((GLuint) offset);
}


inline const _glapi_proc
BGLDispatcher::AddressOf(const char* functionName)
{
	return _glapi_get_proc_address(functionName);
}


inline uint32
BGLDispatcher::OffsetOf(const char* functionName)
{
	return (uint32) _glapi_get_proc_offset(functionName);
}


#endif	// GLDISPATCHER_H