本文整理汇总了C++中SDL_GL_GetProcAddress函数的典型用法代码示例。如果您正苦于以下问题:C++ SDL_GL_GetProcAddress函数的具体用法?C++ SDL_GL_GetProcAddress怎么用?C++ SDL_GL_GetProcAddress使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SDL_GL_GetProcAddress函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadGLFunctions
int LoadGLFunctions() {
/*if(!(glCreateShader = (PFNGLCREATESHADERPROC) SDL_GL_GetProcAddress("glCreateShader"))) return 10;
if(!(glShaderSource = (PFNGLSHADERSOURCEPROC) SDL_GL_GetProcAddress("glShaderSource"))) return 20;
if(!(glCompileShader = (PFNGLCOMPILESHADERPROC) SDL_GL_GetProcAddress("glCompileShader"))) return 30;
if(!(glGetShaderiv = (PFNGLGETSHADERIVPROC) SDL_GL_GetProcAddress("glGetShaderiv"))) return 40;
if(!(glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) SDL_GL_GetProcAddress("glGetShaderInfoLog"))) return 50;
if(!(glCreateProgram = (PFNGLCREATEPROGRAMPROC) SDL_GL_GetProcAddress("glCreateProgram"))) return 60;
if(!(glAttachShader = (PFNGLATTACHSHADERPROC) SDL_GL_GetProcAddress("glAttachShader"))) return 70;
if(!(glLinkProgram = (PFNGLLINKPROGRAMPROC) SDL_GL_GetProcAddress("glLinkProgram"))) return 80;
if(!(glGetProgramiv = (PFNGLGETPROGRAMIVPROC) SDL_GL_GetProcAddress("glGetProgramiv"))) return 90;
if(!(glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) SDL_GL_GetProcAddress("glGetProgramInfoLog"))) return 100;
if(!(glDetachShader = (PFNGLDETACHSHADERPROC) SDL_GL_GetProcAddress("glDetachShader"))) return 108;
if(!(glDeleteShader = (PFNGLDELETESHADERPROC) SDL_GL_GetProcAddress("glDeleteShader"))) return 110;
if(!(glGenBuffers = (PFNGLGENBUFFERSPROC) SDL_GL_GetProcAddress("glGenBuffers"))) return 120;
if(!(glBindBuffer = (PFNGLBINDBUFFERPROC) SDL_GL_GetProcAddress("glBindBuffer"))) return 130;
if(!(glBufferData = (PFNGLBUFFERDATAPROC) SDL_GL_GetProcAddress("glBufferData"))) return 140;
if(!(glBufferSubData = (PFNGLBUFFERSUBDATAPROC) SDL_GL_GetProcAddress("glBufferSubData"))) return 141;
if(!(glUseProgram = (PFNGLUSEPROGRAMPROC) SDL_GL_GetProcAddress("glUseProgram"))) return 150;
if(!(glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC) SDL_GL_GetProcAddress("glEnableVertexAttribArray"))) return 160;
if(!(glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC) SDL_GL_GetProcAddress("glVertexAttribPointer"))) return 170;
if(!(glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC) SDL_GL_GetProcAddress("glDisableVertexAttribArray"))) return 180;
if(!(glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) SDL_GL_GetProcAddress("glGetUniformLocation"))) return 190;
if(!(glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC) SDL_GL_GetProcAddress("glGetAttribLocation"))) return 192;
if(!(glActiveTexture = (PFNGLACTIVETEXTUREPROC) SDL_GL_GetProcAddress("glActiveTexture"))) return 200;
if(!(glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC) SDL_GL_GetProcAddress("glUniformMatrix4fv"))) return 210;
if(!(glDeleteBuffers = (PFNGLDELETEBUFFERSPROC) SDL_GL_GetProcAddress("glDeleteBuffers"))) return 220;
if(!(glDeleteProgram = (PFNGLDELETEPROGRAMPROC) SDL_GL_GetProcAddress("glDeleteProgram"))) return 230;*/
if(!(glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC) SDL_GL_GetProcAddress("glGenVertexArrays"))) return 240;
if(!(glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC) SDL_GL_GetProcAddress("glBindVertexArray"))) return 241;
if(!(glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC) SDL_GL_GetProcAddress("glDeleteVertexArrays"))) return 242;
return 0;
}
示例2: vw_Internal_InitializationVBO
//------------------------------------------------------------------------------------
// Инициализация работы с VBO
//------------------------------------------------------------------------------------
bool vw_Internal_InitializationVBO()
{
// Get Pointers To The GL Functions
#ifdef USE_GLES
glGenBuffersARB = (PFNGLGENBUFFERSARBPROC) SDL_GL_GetProcAddress("glGenBuffers");
glBindBufferARB = (PFNGLBINDBUFFERARBPROC) SDL_GL_GetProcAddress("glBindBuffer");
glBufferDataARB = (PFNGLBUFFERDATAARBPROC) SDL_GL_GetProcAddress("glBufferData");
glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC) SDL_GL_GetProcAddress("glDeleteBuffers");
glIsBufferARB = (PFNGLISBUFFERARBPROC) SDL_GL_GetProcAddress("glIsBuffer");
#else
glGenBuffersARB = (PFNGLGENBUFFERSARBPROC) SDL_GL_GetProcAddress("glGenBuffersARB");
glBindBufferARB = (PFNGLBINDBUFFERARBPROC) SDL_GL_GetProcAddress("glBindBufferARB");
glBufferDataARB = (PFNGLBUFFERDATAARBPROC) SDL_GL_GetProcAddress("glBufferDataARB");
glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC) SDL_GL_GetProcAddress("glDeleteBuffersARB");
glIsBufferARB = (PFNGLISBUFFERARBPROC) SDL_GL_GetProcAddress("glIsBufferARB");
#endif
if (glGenBuffersARB == NULL || glBindBufferARB == NULL || glBufferDataARB == NULL ||
glDeleteBuffersARB == NULL || glIsBufferARB == NULL)
{
glGenBuffersARB = NULL;
glBindBufferARB = NULL;
glBufferDataARB = NULL;
glDeleteBuffersARB = NULL;
glIsBufferARB = NULL;
return false;
}
return true;
}
示例3: InitGLExtensions
void InitGLExtensions()
{
#ifdef __EMSCRIPTEN__
return;
#endif
const char* p = (const char*)glGetString( GL_EXTENSIONS );
std::string extname;
while( *p )
{
char c = *p++;
if( c != ' ' )
extname += c;
else
{
// printf("'%s'\n", extname.c_str() );
if( !g_Config.nomultitexture &&
(extname == "GL_ARB_multitexture" ||
extname == "GL_EXT_multitexture" ) )
{
#ifdef WIN32
g_glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)
SDL_GL_GetProcAddress( "glActiveTextureARB" );
g_glMultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)
SDL_GL_GetProcAddress( "glMultiTexCoord2fARB" );
#else
g_glActiveTextureARB = (GL_ActiveTextureARB_Func)
SDL_GL_GetProcAddress( "glActiveTextureARB" );
g_glMultiTexCoord2fARB = (GL_MultiTexCoord2fARB_Func)
SDL_GL_GetProcAddress( "glMultiTexCoord2fARB" );
#endif
if( g_glActiveTextureARB && g_glMultiTexCoord2fARB )
{
GLint numunits;
glGetIntegerv( GL_MAX_TEXTURE_UNITS_ARB, &numunits );
g_NumTextureUnits = numunits;
g_GLMultitexture = true;
// printf( "got %s (%d textureunits)\n", extname.c_str(), g_NumTextureUnits );
}
}
else if( extname == "GL_ARB_texture_env_add" )
{
g_ARB_texture_env_add = true;
// printf( "got texture_env_add\n" );
}
extname.erase();
}
}
}
示例4: init_glframebufferext
void init_glframebufferext()
{
glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC) SDL_GL_GetProcAddress("glGenFramebuffersEXT");
glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC) SDL_GL_GetProcAddress("glBindFramebufferEXT");
glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC) SDL_GL_GetProcAddress("glGenRenderbuffersEXT");
glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC) SDL_GL_GetProcAddress("glBindRenderbufferEXT");
glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC) SDL_GL_GetProcAddress("glRenderbufferStorageEXT");
glGetRenderbufferParameterivEXT = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) SDL_GL_GetProcAddress("glGetRenderbufferParameterivEXT");
glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) SDL_GL_GetProcAddress("glFramebufferTexture2DEXT");
glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) SDL_GL_GetProcAddress("glFramebufferRenderbufferEXT");
glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) SDL_GL_GetProcAddress("glCheckFramebufferStatusEXT");
glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC) SDL_GL_GetProcAddress("glGenerateMipmapEXT");
}
示例5: init_group
static void
init_group(const struct fv_gl_group *group)
{
int minor_gl_version = fv_gl.minor_version;
const char *suffix;
struct fv_buffer buffer;
void *func;
int gl_version;
int i;
if (minor_gl_version >= 10)
minor_gl_version = 9;
gl_version = fv_gl.major_version * 10 + minor_gl_version;
if (group->minimum_gl_version >= 0 &&
gl_version >= group->minimum_gl_version)
suffix = "";
else if (group->extension &&
SDL_GL_ExtensionSupported(group->extension))
suffix = group->extension_suffix;
else
return;
fv_buffer_init(&buffer);
for (i = 0; group->funcs[i].name; i++) {
fv_buffer_set_length(&buffer, 0);
fv_buffer_append_string(&buffer, group->funcs[i].name);
fv_buffer_append_string(&buffer, suffix);
func = SDL_GL_GetProcAddress((char *) buffer.data);
*(void **) ((char *) &fv_gl + group->funcs[i].offset) = func;
}
fv_buffer_destroy(&buffer);
}
示例6: SDL_GL_GetProcAddress
void *GetGLFunc(const char *proc)
{
void *func = SDL_GL_GetProcAddress(proc);
if (!func)
func = hwSym(proc, GLUhandle);
return func;
}
示例7: wzGetSwapInterval
int wzGetSwapInterval()
{
if (swapInterval >= 0)
{
return swapInterval;
}
typedef void (* PFNGLXQUERYDRAWABLEPROC)(Display *, GLXDrawable, int, unsigned int *);
typedef int (* PFNGLXGETSWAPINTERVALMESAPROC)(void);
typedef int (* PFNGLXSWAPINTERVALSGIPROC)(int);
PFNGLXQUERYDRAWABLEPROC glXQueryDrawable;
PFNGLXGETSWAPINTERVALMESAPROC glXGetSwapIntervalMESA;
PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI;
#if GLX_VERSION_1_2
// Hack-ish, but better than not supporting GLX_SWAP_INTERVAL_EXT?
GLXDrawable drawable = glXGetCurrentDrawable();
Display *display = glXGetCurrentDisplay();
glXQueryDrawable = (PFNGLXQUERYDRAWABLEPROC) SDL_GL_GetProcAddress("glXQueryDrawable");
if (glXQueryDrawable && drawable)
{
unsigned interval;
glXQueryDrawable(display, drawable, GLX_SWAP_INTERVAL_EXT, &interval);
swapInterval = interval;
return swapInterval;
}
#endif
glXGetSwapIntervalMESA = (PFNGLXGETSWAPINTERVALMESAPROC) SDL_GL_GetProcAddress("glXGetSwapIntervalMESA");
if (glXGetSwapIntervalMESA)
{
swapInterval = glXGetSwapIntervalMESA();
return swapInterval;
}
glXSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC) SDL_GL_GetProcAddress("glXSwapIntervalSGI");
if (glXSwapIntervalSGI)
{
swapInterval = 1;
}
else
{
swapInterval = 0;
}
return swapInterval;
}
示例8: VID_InitGL
static void
VID_InitGL(void)
{
gl_vendor = (const char *)glGetString(GL_VENDOR);
gl_renderer = (const char *)glGetString(GL_RENDERER);
gl_version = (const char *)glGetString(GL_VERSION);
gl_extensions = (const char *)glGetString(GL_EXTENSIONS);
printf("GL_VENDOR: %s\n", gl_vendor);
printf("GL_RENDERER: %s\n", gl_renderer);
printf("GL_VERSION: %s\n", gl_version);
printf("GL_EXTENSIONS: %s\n", gl_extensions);
gl_mtexable = false;
if (!COM_CheckParm("-nomtex") && VID_GL_CheckExtn("GL_ARB_multitexture")) {
qglMultiTexCoord2fARB = SDL_GL_GetProcAddress("glMultiTexCoord2fARB");
qglActiveTextureARB = SDL_GL_GetProcAddress("glActiveTextureARB");
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &gl_num_texture_units);
if (gl_num_texture_units >= 2 &&
qglMultiTexCoord2fARB && qglActiveTextureARB)
gl_mtexable = true;
Con_Printf("ARB multitexture extension enabled\n"
"-> %i texture units available\n",
gl_num_texture_units);
}
glClearColor(0.5, 0.5, 0.5, 0);
glCullFace(GL_FRONT);
glEnable(GL_TEXTURE_2D);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.666);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glShadeModel(GL_FLAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
}
示例9: SDL_GL_GetProcAddress
void *load_opengl_command(const char *cmd) {
void *r = SDL_GL_GetProcAddress(cmd);
if (r == NULL) {
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Failed to load %s command.", cmd);
}
return r;
}
示例10: InitOpenGLExtensions
/**
** Initialize OpenGL extensions
*/
static void InitOpenGLExtensions()
{
// ARB_texture_compression
if (IsExtensionSupported("GL_ARB_texture_compression"))
{
glCompressedTexImage3DARB =
(PFNGLCOMPRESSEDTEXIMAGE3DARBPROC)SDL_GL_GetProcAddress("glCompressedTexImage3DARB");
glCompressedTexImage2DARB =
(PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)SDL_GL_GetProcAddress("glCompressedTexImage2DARB");
glCompressedTexImage1DARB =
(PFNGLCOMPRESSEDTEXIMAGE1DARBPROC)SDL_GL_GetProcAddress("glCompressedTexImage1DARB");
glCompressedTexSubImage3DARB =
(PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC)SDL_GL_GetProcAddress("glCompressedTexSubImage3DARB");
glCompressedTexSubImage2DARB =
(PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC)SDL_GL_GetProcAddress("glCompressedTexSubImage2DARB");
glCompressedTexSubImage1DARB =
(PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC)SDL_GL_GetProcAddress("glCompressedTexSubImage1DARB");
glGetCompressedTexImageARB =
(PFNGLGETCOMPRESSEDTEXIMAGEARBPROC)SDL_GL_GetProcAddress("glGetCompressedTexImageARB");
if (glCompressedTexImage3DARB && glCompressedTexImage2DARB &&
glCompressedTexImage1DARB && glCompressedTexSubImage3DARB &&
glCompressedTexSubImage2DARB && glCompressedTexSubImage1DARB &&
glGetCompressedTexImageARB)
{
GLTextureCompressionSupported = true;
}
else
{
GLTextureCompressionSupported = false;
}
}
}
示例11: rsmEnable
/* general OpenGL initialization function */
void Graphics::initGL( GLvoid ) {
/* Enable Texture Mapping */
rsmEnable( GL_TEXTURE_2D );
/* Enable smooth shading */
glShadeModel( GL_SMOOTH );
// which one to use?
// default is good
//glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
/* Set the background black */
glClearColor( 0.0f, 0.0f, 0.0f, 0.5f );
/* Depth buffer setup */
glClearDepth( 1.0f );
if( stencilBufferUsed ) glClearStencil(0); // Clear The Stencil Buffer To 0
/* Enables Depth Testing */
rsmEnable( GL_DEPTH_TEST );
/* The Type Of Depth Test To Do */
glDepthFunc( GL_LEQUAL );
/* Really Nice Perspective Calculations */
// glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
glColorMaterial ( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE ) ;
rsmEnable( GL_COLOR_MATERIAL );
/* initialize opengl extensions */
if( Constants::multitexture ) {
// fprintf(stderr, "BEFORE: glSDLActiveTextureARB=%u\n", glSDLActiveTextureARB);
glSDLActiveTextureARB =
(PFNGLACTIVETEXTUREARBPROC)SDL_GL_GetProcAddress ("glActiveTextureARB");
// fprintf(stderr, "AFTER: glSDLActiveTextureARB=%u\n", glSDLActiveTextureARB);
glSDLMultiTexCoord2fARB =
(PFNGLMULTITEXCOORD2FARBPROC)SDL_GL_GetProcAddress ("glMultiTexCoord2fARB");
glSDLMultiTexCoord2iARB =
(PFNGLMULTITEXCOORD2IARBPROC)SDL_GL_GetProcAddress ("glMultiTexCoord2iARB");
}
return;
}
示例12: bindEXTFunction
static bool bindEXTFunction( void *&fnAddress, const char *name )
{
void* addr = (void*)SDL_GL_GetProcAddress(name);
if( !addr )
Con::errorf(ConsoleLogEntry::General, " Missing OpenGL extension '%s'", name);
else
fnAddress = addr;
return (addr != NULL);
}
示例13: setup_gl_extensions
void setup_gl_extensions() {
glActiveTextureARB_ptr = (GL_ACTIVETEXTUREARB_FUNC)
SDL_GL_GetProcAddress("glActiveTextureARB");
glClientActiveTextureARB_ptr = (GL_CLIENTACTIVETEXTUREARB_FUNC)
SDL_GL_GetProcAddress("glClientActiveTextureARB");
if (glActiveTextureARB_ptr == 0 || glClientActiveTextureARB_ptr == 0) {
has_multitex = 0;
} else {
has_multitex = 1;
}
glCompressedTexImage2DARB_ptr = (PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)
SDL_GL_GetProcAddress("glCompressedTexImage2DARB");
if (!glCompressedTexImage2DARB_ptr) fprintf(stderr, "uh oh!\n");
}
示例14: ogl_extensions_init
void ogl_extensions_init()
{
const auto version_str = reinterpret_cast<const char *>(glGetString(GL_VERSION));
if (!version_str) {
con_puts(CON_URGENT, "DXX-Rebirth: no valid OpenGL context when querying GL extensions!");
return;
}
const auto version = parse_version_str(version_str);
const auto extension_str = reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS));
#if DXX_USE_OGLES
#define DXX_OGL_STRING " ES"
#else
#define DXX_OGL_STRING ""
#endif
con_printf(CON_VERBOSE, "DXX-Rebirth: OpenGL" DXX_OGL_STRING ": version %ld.%ld (%s)", version[0], version[1], version_str);
#undef DXX_OGL_STRING
/* GL_EXT_texture_filter_anisotropic */
if (is_supported(extension_str, version, "GL_EXT_texture_filter_anisotropic", -1, -1, -1, -1)) {
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &ogl_maxanisotropy);
con_printf(CON_VERBOSE, "DXX-Rebirth: OpenGL: GL_EXT_texture_filter_anisotropic available, max anisotropy: %f", ogl_maxanisotropy);
} else {
ogl_maxanisotropy=0.0f;
con_puts(CON_VERBOSE, "DXX-Rebirth: OpenGL: GL_EXT_texture_filter_anisotropic not available");
}
/* GL_ARB_sync */
if (is_supported(extension_str, version, "GL_ARB_sync", 3, 2, 3, 0)) {
glFenceSyncFunc = reinterpret_cast<PFNGLFENCESYNCPROC>(SDL_GL_GetProcAddress("glFenceSync"));
glDeleteSyncFunc = reinterpret_cast<PFNGLDELETESYNCPROC>(SDL_GL_GetProcAddress("glDeleteSync"));
glClientWaitSyncFunc = reinterpret_cast<PFNGLCLIENTWAITSYNCPROC>(SDL_GL_GetProcAddress("glClientWaitSync"));
}
const char *s;
if (glFenceSyncFunc && glDeleteSyncFunc && glClientWaitSyncFunc) {
ogl_have_ARB_sync=true;
s = "DXX-Rebirth: OpenGL: GL_ARB_sync available";
} else {
s = "DXX-Rebirth: OpenGL: GL_ARB_sync not available";
}
con_puts(CON_VERBOSE, s);
}
示例15: lookup_glsym
static bool lookup_glsym(const char *funcname, void **func)
{
*func = SDL_GL_GetProcAddress(funcname);
if (*func == NULL)
{
LOG(ERROR) << "Failed to find OpenGL symbol '" << funcname << "'";
return false;
}
return true;
}