📄 glprocs.c
字号:
/*
** GLprocs utility for getting function addresses for OpenGL(R) 1.2,
** OpenGL 1.3 and OpenGL extension functions.
**
** Version: 1.0
**
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: This software was created using the
** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
** not been independently verified as being compliant with the OpenGL(R)
** version 1.2.1 Specification.
**
** Initial version of glprocs.{c,h} contributed by Intel(R) Corporation.
*/
#include <assert.h>
#include <stdlib.h>
#ifdef _WIN32
#include <windows.h>
#include <GL/gl.h>
#include "glprocs.h"
#else /* GLX */
#include <GL/gl.h>
#include <GL/glx.h>
#include <GL/glprocs.h>
#define wglGetProcAddress glXGetProcAddresARB
#endif
#define _ASSERT(a) assert(a)
static void APIENTRY InitBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glBlendColor");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glBlendColor = extproc;
glBlendColor(red, green, blue, alpha);
}
static void APIENTRY InitBlendEquation (GLenum mode)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glBlendEquation");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glBlendEquation = extproc;
glBlendEquation(mode);
}
static void APIENTRY InitDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glDrawRangeElements");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glDrawRangeElements = extproc;
glDrawRangeElements(mode, start, end, count, type, indices);
}
static void APIENTRY InitColorTable (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glColorTable");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glColorTable = extproc;
glColorTable(target, internalformat, width, format, type, table);
}
static void APIENTRY InitColorTableParameterfv (GLenum target, GLenum pname, const GLfloat *params)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glColorTableParameterfv");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glColorTableParameterfv = extproc;
glColorTableParameterfv(target, pname, params);
}
static void APIENTRY InitColorTableParameteriv (GLenum target, GLenum pname, const GLint *params)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glColorTableParameteriv");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glColorTableParameteriv = extproc;
glColorTableParameteriv(target, pname, params);
}
static void APIENTRY InitCopyColorTable (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glCopyColorTable");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glCopyColorTable = extproc;
glCopyColorTable(target, internalformat, x, y, width);
}
static void APIENTRY InitGetColorTable (GLenum target, GLenum format, GLenum type, GLvoid *table)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glGetColorTable");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glGetColorTable = extproc;
glGetColorTable(target, format, type, table);
}
static void APIENTRY InitGetColorTableParameterfv (GLenum target, GLenum pname, GLfloat *params)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glGetColorTableParameterfv");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glGetColorTableParameterfv = extproc;
glGetColorTableParameterfv(target, pname, params);
}
static void APIENTRY InitGetColorTableParameteriv (GLenum target, GLenum pname, GLint *params)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glGetColorTableParameteriv");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glGetColorTableParameteriv = extproc;
glGetColorTableParameteriv(target, pname, params);
}
static void APIENTRY InitColorSubTable (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glColorSubTable");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glColorSubTable = extproc;
glColorSubTable(target, start, count, format, type, data);
}
static void APIENTRY InitCopyColorSubTable (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glCopyColorSubTable");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glCopyColorSubTable = extproc;
glCopyColorSubTable(target, start, x, y, width);
}
static void APIENTRY InitConvolutionFilter1D (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glConvolutionFilter1D");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glConvolutionFilter1D = extproc;
glConvolutionFilter1D(target, internalformat, width, format, type, image);
}
static void APIENTRY InitConvolutionFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glConvolutionFilter2D");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glConvolutionFilter2D = extproc;
glConvolutionFilter2D(target, internalformat, width, height, format, type, image);
}
static void APIENTRY InitConvolutionParameterf (GLenum target, GLenum pname, GLfloat params)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glConvolutionParameterf");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glConvolutionParameterf = extproc;
glConvolutionParameterf(target, pname, params);
}
static void APIENTRY InitConvolutionParameterfv (GLenum target, GLenum pname, const GLfloat *params)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glConvolutionParameterfv");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glConvolutionParameterfv = extproc;
glConvolutionParameterfv(target, pname, params);
}
static void APIENTRY InitConvolutionParameteri (GLenum target, GLenum pname, GLint params)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glConvolutionParameteri");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glConvolutionParameteri = extproc;
glConvolutionParameteri(target, pname, params);
}
static void APIENTRY InitConvolutionParameteriv (GLenum target, GLenum pname, const GLint *params)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glConvolutionParameteriv");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glConvolutionParameteriv = extproc;
glConvolutionParameteriv(target, pname, params);
}
static void APIENTRY InitCopyConvolutionFilter1D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glCopyConvolutionFilter1D");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glCopyConvolutionFilter1D = extproc;
glCopyConvolutionFilter1D(target, internalformat, x, y, width);
}
static void APIENTRY InitCopyConvolutionFilter2D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glCopyConvolutionFilter2D");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glCopyConvolutionFilter2D = extproc;
glCopyConvolutionFilter2D(target, internalformat, x, y, width, height);
}
static void APIENTRY InitGetConvolutionFilter (GLenum target, GLenum format, GLenum type, GLvoid *image)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glGetConvolutionFilter");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glGetConvolutionFilter = extproc;
glGetConvolutionFilter(target, format, type, image);
}
static void APIENTRY InitGetConvolutionParameterfv (GLenum target, GLenum pname, GLfloat *params)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glGetConvolutionParameterfv");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glGetConvolutionParameterfv = extproc;
glGetConvolutionParameterfv(target, pname, params);
}
static void APIENTRY InitGetConvolutionParameteriv (GLenum target, GLenum pname, GLint *params)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glGetConvolutionParameteriv");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glGetConvolutionParameteriv = extproc;
glGetConvolutionParameteriv(target, pname, params);
}
static void APIENTRY InitGetSeparableFilter (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glGetSeparableFilter");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glGetSeparableFilter = extproc;
glGetSeparableFilter(target, format, type, row, column, span);
}
static void APIENTRY InitSeparableFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glSeparableFilter2D");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glSeparableFilter2D = extproc;
glSeparableFilter2D(target, internalformat, width, height, format, type, row, column);
}
static void APIENTRY InitGetHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glGetHistogram");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glGetHistogram = extproc;
glGetHistogram(target, reset, format, type, values);
}
static void APIENTRY InitGetHistogramParameterfv (GLenum target, GLenum pname, GLfloat *params)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glGetHistogramParameterfv");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glGetHistogramParameterfv = extproc;
glGetHistogramParameterfv(target, pname, params);
}
static void APIENTRY InitGetHistogramParameteriv (GLenum target, GLenum pname, GLint *params)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glGetHistogramParameteriv");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glGetHistogramParameteriv = extproc;
glGetHistogramParameteriv(target, pname, params);
}
static void APIENTRY InitGetMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glGetMinmax");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glGetMinmax = extproc;
glGetMinmax(target, reset, format, type, values);
}
static void APIENTRY InitGetMinmaxParameterfv (GLenum target, GLenum pname, GLfloat *params)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glGetMinmaxParameterfv");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glGetMinmaxParameterfv = extproc;
glGetMinmaxParameterfv(target, pname, params);
}
static void APIENTRY InitGetMinmaxParameteriv (GLenum target, GLenum pname, GLint *params)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glGetMinmaxParameteriv");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glGetMinmaxParameteriv = extproc;
glGetMinmaxParameteriv(target, pname, params);
}
static void APIENTRY InitHistogram (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glHistogram");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glHistogram = extproc;
glHistogram(target, width, internalformat, sink);
}
static void APIENTRY InitMinmax (GLenum target, GLenum internalformat, GLboolean sink)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glMinmax");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glMinmax = extproc;
glMinmax(target, internalformat, sink);
}
static void APIENTRY InitResetHistogram (GLenum target)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glResetHistogram");
if (extproc == NULL) {
_ASSERT(0);
return;
}
glResetHistogram = extproc;
glResetHistogram(target);
}
static void APIENTRY InitResetMinmax (GLenum target)
{
void *extproc;
extproc = (void *) wglGetProcAddress("glResetMinmax");
if (extproc == NULL) {
_ASSERT(0);
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -