本文整理汇总了C++中qglGetIntegerv函数的典型用法代码示例。如果您正苦于以下问题:C++ qglGetIntegerv函数的具体用法?C++ qglGetIntegerv怎么用?C++ qglGetIntegerv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qglGetIntegerv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qglGetIntegerv
void CQuickSpriteSystem::StartGroup(textureBundle_t *bundle, unsigned long glbits, unsigned long fogcolor )
{
mNextVert = 0;
mTexBundle = bundle;
mGLStateBits = glbits;
if (fogcolor)
{
mUseFog = qtrue;
mFogColor = fogcolor;
}
else
{
mUseFog = qfalse;
}
int cullingOn;
qglGetIntegerv(GL_CULL_FACE,&cullingOn);
if(cullingOn)
{
mTurnCullBackOn=true;
}
else
{
mTurnCullBackOn=false;
}
qglDisable(GL_CULL_FACE);
}
示例2: glf_create_font_mem
/**
* Creates gl texture font from true type font;
* @param ft_library: base font library;
* @param face_data: pointer to the buffer with font file content; DO NOT FREE that pointer otherway using FT_Face prevets to crash;
* @param face_data_size: size of buffer with font file content;
* @param font_size: size of font glyph?
* @return pointer to the gl_tex_font_s structure;
*/
gl_tex_font_p glf_create_font_mem(void *face_data, size_t face_data_size, uint16_t font_size)
{
if(g_ft_library)
{
gl_tex_font_p glf = (gl_tex_font_p)malloc(sizeof(gl_tex_font_t));
glf->ft_face = NULL;
if(FT_New_Memory_Face(g_ft_library, (const FT_Byte*)face_data, face_data_size, 0, (FT_Face*)&glf->ft_face))
{
free(glf);
return NULL;
}
glf->glyphs_count = ((FT_Face)glf->ft_face)->num_glyphs;
glf->glyphs = (char_info_p)malloc(glf->glyphs_count * sizeof(char_info_t));
qglGetIntegerv(GL_MAX_TEXTURE_SIZE, &glf->gl_max_tex_width);
glf->gl_tex_width = glf->gl_max_tex_width;
glf->gl_tex_indexes = NULL;
glf->gl_tex_indexes_count = 0;
glf->gl_real_tex_indexes_count = 0;
glf_resize(glf, font_size);
FT_Select_Charmap(glf->ft_face, FT_ENCODING_UNICODE);
return glf;
}
return NULL;
}
示例3: glf_create_font
gl_tex_font_p glf_create_font(const char *file_name, uint16_t font_size)
{
if(g_ft_library)
{
gl_tex_font_p glf = (gl_tex_font_p)malloc(sizeof(gl_tex_font_t));
glf->ft_face = NULL;
if(FT_New_Face(g_ft_library, file_name, 0, (FT_Face*)&glf->ft_face))
{
free(glf);
return NULL;
}
glf->glyphs_count = ((FT_Face)glf->ft_face)->num_glyphs;
glf->glyphs = (char_info_p)malloc(glf->glyphs_count * sizeof(char_info_t));
qglGetIntegerv(GL_MAX_TEXTURE_SIZE, &glf->gl_max_tex_width);
glf->gl_tex_width = glf->gl_max_tex_width;
glf->gl_tex_indexes = NULL;
glf->gl_tex_indexes_count = 0;
glf->gl_real_tex_indexes_count = 0;
glf->gl_font_color[0] = 0.0;
glf->gl_font_color[1] = 0.0;
glf->gl_font_color[2] = 0.0;
glf->gl_font_color[3] = 1.0;
glf_resize(glf, font_size);
FT_Select_Charmap(glf->ft_face, FT_ENCODING_UNICODE);
return glf;
}
return NULL;
}
示例4: GLimp_Init
/*
** GLimp_Init
**
** This is the platform specific OpenGL initialization function. It
** is responsible for loading OpenGL, initializing it, setting
** extensions, creating a window of the appropriate size, doing
** fullscreen manipulations, etc. Its overall responsibility is
** to make sure that a functional OpenGL subsystem is operating
** when it returns to the ref.
*/
void GLimp_Init( void )
{
// load appropriate DLL and initialize subsystem
GLW_StartOpenGL();
// get our config strings
glConfig.vendor_string = (const char *) qglGetString (GL_VENDOR);
glConfig.renderer_string = (const char *) qglGetString (GL_RENDERER);
glConfig.version_string = (const char *) qglGetString (GL_VERSION);
glConfig.extensions_string = (const char *) qglGetString (GL_EXTENSIONS);
if (!glConfig.vendor_string || !glConfig.renderer_string || !glConfig.version_string || !glConfig.extensions_string)
{
Com_Error( ERR_FATAL, "GLimp_Init() - Invalid GL Driver\n" );
}
// OpenGL driver constants
qglGetIntegerv( GL_MAX_TEXTURE_SIZE, &glConfig.maxTextureSize );
// stubbed or broken drivers may have reported 0...
if ( glConfig.maxTextureSize <= 0 )
{
glConfig.maxTextureSize = 0;
}
GLW_InitExtensions();
WG_CheckHardwareGamma();
}
示例5: InitOpenGL
/*
** InitOpenGL
**
** This function is responsible for initializing a valid OpenGL subsystem. This
** is done by calling GLimp_Init (which gives us a working OGL subsystem) then
** setting variables, checking GL constants, and reporting the gfx system config
** to the user.
*/
static void InitOpenGL( void ) {
char renderer_buffer[1024];
//
// initialize OS specific portions of the renderer
//
// GLimp_Init directly or indirectly references the following cvars:
// - r_fullscreen
// - r_mode
// - r_(color|depth|stencil)bits
// - r_ignorehwgamma
// - r_gamma
//
if ( glConfig.vidWidth == 0 ) {
GLint temp;
GLimp_Init();
strcpy( renderer_buffer, glConfig.renderer_string );
Q_strlwr( renderer_buffer );
// OpenGL driver constants
qglGetIntegerv( GL_MAX_TEXTURE_SIZE, &temp );
glConfig.maxTextureSize = temp;
// stubbed or broken drivers may have reported 0...
if ( glConfig.maxTextureSize <= 0 ) {
glConfig.maxTextureSize = 0;
}
}
// set default state
GL_SetDefaultState();
}
示例6: qglGetIntegerv
void CQuickSpriteSystem::StartGroup(textureBundle_t *bundle, uint32_t glbits, int fogIndex )
{
mNextVert = 0;
mTexBundle = bundle;
mGLStateBits = glbits;
if (fogIndex != -1)
{
mUseFog = qtrue;
mFogIndex = fogIndex;
}
else
{
mUseFog = qfalse;
}
int cullingOn;
qglGetIntegerv(GL_CULL_FACE,&cullingOn);
if(cullingOn)
{
mTurnCullBackOn=true;
}
else
{
mTurnCullBackOn=false;
}
qglDisable(GL_CULL_FACE);
}
示例7: qglGetIntegerv
/*
==================
RB_ReadPixels
Reads an image but takes care of alignment issues for reading RGB images.
Reads a minimum offset for where the RGB data starts in the image from
integer stored at pointer offset. When the function has returned the actual
offset was written back to address offset. This address will always have an
alignment of packAlign to ensure efficient copying.
Stores the length of padding after a line of pixels to address padlen
Return value must be freed with ri.Hunk_FreeTempMemory()
==================
*/
byte *RB_ReadPixels(int x, int y, int width, int height, size_t *offset, int *padlen)
{
byte *buffer, *bufstart;
int padwidth, linelen;
GLint packAlign;
qglGetIntegerv(GL_PACK_ALIGNMENT, &packAlign);
linelen = width * 3;
padwidth = PAD(linelen, packAlign);
// Allocate a few more bytes so that we can choose an alignment we like
buffer = ri.Hunk_AllocateTempMemory(padwidth * height + *offset + packAlign - 1);
bufstart = buffer;
padwidth = linelen;
int p2width = 1, p2height = 1;
int xx, yy, aa;
while (p2width < glConfig.vidWidth)
p2width *= 2;
while (p2height < glConfig.vidHeight)
p2height *= 2;
byte *source = (byte *) ri.Hunk_AllocateTempMemory(p2width * p2height * 4);
qglReadPixels(0, 0, p2width, p2height, GL_RGBA, GL_UNSIGNED_BYTE, source);
for (yy = y; yy < height; yy++)
for (xx = x; xx < width; xx++)
for (aa = 0; aa < 3; aa++)
buffer[yy * width * 3 + xx * 3 + aa] = source[(yy + y) * p2width * 4 + (xx + x) * 4 + aa];
ri.Hunk_FreeTempMemory(source);
*offset = bufstart - buffer;
*padlen = padwidth - linelen;
return buffer;
}
示例8: GfxMemInfo_f
/*
* GfxMemInfo_f
*/
void
GfxMemInfo_f(void)
{
switch(glRefConfig.memInfo){
case MI_NONE:
{
ri.Printf(PRINT_ALL, "No extension found for GPU memory info.\n");
}
break;
case MI_NVX:
{
int value;
qglGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &value);
ri.Printf(PRINT_ALL, "GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX: %ikb\n", value);
qglGetIntegerv(GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, &value);
ri.Printf(PRINT_ALL, "GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX: %ikb\n", value);
qglGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &value);
ri.Printf(PRINT_ALL, "GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX: %ikb\n", value);
qglGetIntegerv(GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX, &value);
ri.Printf(PRINT_ALL, "GPU_MEMORY_INFO_EVICTION_COUNT_NVX: %i\n", value);
qglGetIntegerv(GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX, &value);
ri.Printf(PRINT_ALL, "GPU_MEMORY_INFO_EVICTED_MEMORY_NVX: %ikb\n", value);
}
break;
case MI_ATI:
{
/* GL_ATI_meminfo */
int value[4];
qglGetIntegerv(GL_VBO_FREE_MEMORY_ATI, &value[0]);
ri.Printf(PRINT_ALL,
"VBO_FREE_MEMORY_ATI: %ikb total %ikb largest aux: %ikb total %ikb largest\n",
value[0], value[1], value[2],
value[3]);
qglGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, &value[0]);
ri.Printf(PRINT_ALL,
"TEXTURE_FREE_MEMORY_ATI: %ikb total %ikb largest aux: %ikb total %ikb largest\n",
value[0], value[1], value[2],
value[3]);
qglGetIntegerv(GL_RENDERBUFFER_FREE_MEMORY_ATI, &value[0]);
ri.Printf(
PRINT_ALL,
"RENDERBUFFER_FREE_MEMORY_ATI: %ikb total %ikb largest aux: %ikb total %ikb largest\n",
value[0], value[1], value[2], value[3]);
}
break;
}
}
示例9: border_width
bordered_texture_atlas::bordered_texture_atlas(int border,
size_t page_count,
const tr4_textile32_t *pages,
size_t object_texture_count,
const tr4_object_texture_t *object_textures,
size_t sprite_texture_count,
const tr_sprite_texture_t *sprite_textures)
: border_width(border),
number_result_pages(0),
result_page_width(0),
result_page_height(NULL),
number_original_pages(page_count),
original_pages(pages),
number_file_object_textures(0),
file_object_textures(NULL),
number_sprite_textures(0),
canonical_textures_for_sprite_textures(NULL),
number_canonical_object_textures(0),
canonical_object_textures(NULL),
textures_indexes(NULL)
{
GLint max_texture_edge_length = 0;
qglGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_edge_length);
if (max_texture_edge_length > 4096)
max_texture_edge_length = 4096; // That is already 64 MB and covers up to 256 pages.
result_page_width = max_texture_edge_length;
size_t maxNumberCanonicalTextures = object_texture_count + sprite_texture_count + 1;
canonical_object_textures = new canonical_object_texture[maxNumberCanonicalTextures];
number_canonical_object_textures = 1;
canonical_object_texture &canonical = canonical_object_textures[0];
canonical.width = 8;
canonical.height = 8;
canonical.original_page = WHITE_TEXTURE_INDEX;
canonical.original_x = 0;
canonical.original_y = 0;
file_object_textures = new file_object_texture[object_texture_count];
for (size_t i = 0; i < object_texture_count; i++)
{
addObjectTexture(object_textures[i]);
}
canonical_textures_for_sprite_textures = new unsigned long[sprite_texture_count];
for (size_t i = 0; i < sprite_texture_count; i++)
{
addSpriteTexture(sprite_textures[i]);
}
layOutTextures();
}
示例10: GLW_InitExtensions
static void GLW_InitExtensions()
{
ri.Printf( PRINT_DEVELOPER, "Initializing OpenGL extensions\n" );
#define QGL_EXT(T, fn) q##fn = (T)qwglGetProcAddress( #fn ); \
if (!q##fn) Com_Error( ERR_FATAL, "QGL_EXT: required extension "#fn" not found" );
QGL_EXT( PFNGLLOCKARRAYSEXTPROC, glLockArraysEXT );
QGL_EXT( PFNGLUNLOCKARRAYSEXTPROC, glUnlockArraysEXT );
QGL_EXT( PFNGLACTIVETEXTUREARBPROC, glActiveTextureARB );
QGL_EXT( PFNGLCLIENTACTIVETEXTUREARBPROC, glClientActiveTextureARB );
#undef QGL_EXT
// WGL_EXT_swap_control
qwglSwapIntervalEXT = ( BOOL (WINAPI *)(int)) qwglGetProcAddress( "wglSwapIntervalEXT" );
if ( qwglSwapIntervalEXT )
{
ri.Printf( PRINT_DEVELOPER, "...using WGL_EXT_swap_control\n" );
r_swapInterval->modified = qtrue; // force a set next frame
}
else
{
ri.Printf( PRINT_DEVELOPER, "...WGL_EXT_swap_control not found\n" );
}
int maxAnisotropy = 0;
if ( strstr( glConfig.extensions_string, "GL_EXT_texture_filter_anisotropic" ) )
{
if (r_ext_max_anisotropy->integer > 1) {
qglGetIntegerv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropy );
if ( maxAnisotropy <= 0 ) {
ri.Printf( PRINT_DEVELOPER, "...GL_EXT_texture_filter_anisotropic not properly supported!\n" );
maxAnisotropy = 0;
}
else
{
ri.Printf( PRINT_DEVELOPER, "...using GL_EXT_texture_filter_anisotropic (max: %i)\n", maxAnisotropy );
}
}
else
{
ri.Printf( PRINT_DEVELOPER, "...ignoring GL_EXT_texture_filter_anisotropic\n" );
}
}
else
{
ri.Printf( PRINT_DEVELOPER, "...GL_EXT_texture_filter_anisotropic not found\n" );
}
Cvar_Set( "r_ext_max_anisotropy", va("%i", maxAnisotropy) );
}
示例11: glEndFragmentShaderATI
static void glEndFragmentShaderATI (void) {
GLint errPos;
int i;
char fragString[4096];
sGeneratingProgram = 0;
// header
strcpy(fragString, "!!ATIfs1.0\n");
// constants
if (sConstString[0] || sConstUsed) {
strcat (fragString, "StartConstants;\n");
if (sConstUsed) {
for (i = 0; i < 8; i ++) {
if (sConst[i] == 1) {
char str[128];
sprintf (str, " CONSTANT c%d = program.env[%d];\n", i, i);
strcat (fragString, str);
}
}
}
if (sConstString[0]) {
strcat (fragString, sConstString);
}
strcat (fragString, "EndConstants;\n\n");
}
if (sCurrentPass == 0) {
strcat(fragString, "StartOutputPass;\n");
strcat(fragString, sPassString[0]);
strcat(fragString, "EndPass;\n");
} else {
strcat(fragString, "StartPrelimPass;\n");
strcat(fragString, sPassString[0]);
strcat(fragString, "EndPass;\n\n");
strcat(fragString, "StartOutputPass;\n");
strcat(fragString, sPassString[1]);
strcat(fragString, "EndPass;\n");
}
qglProgramStringARB(GL_TEXT_FRAGMENT_SHADER_ATI, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(fragString), fragString);
qglGetIntegerv( GL_PROGRAM_ERROR_POSITION_ARB, &errPos );
if(errPos != -1) {
const GLubyte *errString = glGetString(GL_PROGRAM_ERROR_STRING_ARB);
common->Warning("WARNING: glError at %d:%s when compiling atiFragmentShader %s", errPos, errString, fragString);
}
}
示例12: R_PrintMemoryInfo
/*
* R_PrintMemoryInfo
*/
static void R_PrintMemoryInfo( void )
{
int mem[12];
Com_Printf( "\n" );
Com_Printf( "Video memory information:\n" );
if( glConfig.ext.gpu_memory_info ) {
// NV
qglGetIntegerv( GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, mem );
Com_Printf( "total: %i MB\n", mem[0] >>10 );
qglGetIntegerv( GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, mem );
Com_Printf( "dedicated: %i MB\n", mem[0] >>10 );
qglGetIntegerv( GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, mem );
Com_Printf( "available: %i MB\n", mem[0] >>10 );
qglGetIntegerv( GPU_MEMORY_INFO_EVICTION_COUNT_NVX, mem );
Com_Printf( "eviction count: %i MB\n", mem[0] >> 10 );
qglGetIntegerv( GPU_MEMORY_INFO_EVICTED_MEMORY_NVX, mem );
Com_Printf( "totally evicted: %i MB\n", mem[0] >>10 );
}
示例13: InitOpenGL
/*
** InitOpenGL
**
** This function is responsible for initializing a valid OpenGL subsystem. This
** is done by calling GLimp_Init (which gives us a working OGL subsystem) then
** setting variables, checking GL constants, and reporting the gfx system config
** to the user.
*/
static void InitOpenGL( void )
{
char renderer_buffer[1024];
//
// initialize OS specific portions of the renderer
//
// GLimp_Init directly or indirectly references the following cvars:
// - r_fullscreen
// - r_glDriver
// - r_mode
// - r_(color|depth|stencil)bits
// - r_ignorehwgamma
// - r_gamma
//
if ( !glState.initialized ) // @pjb: vdConfig.vidWidth == 0 is no longer a good indicator
{
GLint temp;
GLimp_Init();
strcpy( renderer_buffer, vdConfig.renderer_string );
Q_strlwr( renderer_buffer );
// OpenGL driver constants
qglGetIntegerv( GL_MAX_TEXTURE_SIZE, &temp );
vdConfig.maxTextureSize = temp;
// stubbed or broken drivers may have reported 0...
if ( vdConfig.maxTextureSize <= 0 )
{
vdConfig.maxTextureSize = 0;
}
glState.initialized = qtrue;
}
// init command buffers and SMP
R_InitCommandBuffers();
// print info
GLRB_GfxInfo_f();
// set default state
GL_SetDefaultState();
}
示例14: qglGetIntegerv
/*
===============
idRenderSystemLocal::ProjectMouseToWorldCoord
http://nehe.gamedev.net/article/using_gluunproject/16013/
===============
*/
void idRenderSystemLocal::ProjectMouseToWorldCoord( idVec2 mouseXY, idVec3 &worldPos ) {
GLint viewport[4]; // Where The Viewport Values Will Be Stored
GLfloat modelview[16]; // Where The 16 Doubles Of The Modelview Matrix Are To Be Stored
GLfloat projection[16];
GLfloat winX, winY, winZ;
qglGetIntegerv(GL_VIEWPORT, viewport); // Retrieves The Viewport Values (X, Y, Width, height).
qglGetFloatv(GL_MODELVIEW_MATRIX, modelview); // Retrieve The Modelview Matrix
qglGetFloatv(GL_PROJECTION_MATRIX, projection); // Retrieve The Modelview Matrix
winX = (float)mouseXY.x;
winY = (float)viewport[3] - (float)mouseXY.y;
qglReadPixels( mouseXY.x, int(winY), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ );
myUnProjectf( winX, winY, winZ, modelview, projection, viewport, &worldPos.x);
}
示例15: InitOpenGL
/*
** InitOpenGL
**
** This function is responsible for initializing a valid OpenGL subsystem. This
** is done by calling GLimp_Init (which gives us a working OGL subsystem) then
** setting variables, checking GL constants, and reporting the gfx system config
** to the user.
*/
static void
InitOpenGL(void)
{
char renderer_buffer[1024];
/*
* initialize OS specific portions of the renderer
*
* GLimp_Init directly or indirectly references the following cvars:
* - r_fullscreen
* - r_mode
* - r_(color|depth|stencil)bits
* - r_ignorehwgamma
* - r_gamma
* */
if(glConfig.vidWidth == 0){
GLint temp;
GLimp_Init();
strcpy(renderer_buffer, glConfig.renderer_string);
Q_strlwr(renderer_buffer);
/* OpenGL driver constants */
qglGetIntegerv(GL_MAX_TEXTURE_SIZE, &temp);
glConfig.maxTextureSize = temp;
/* stubbed or broken drivers may have reported 0... */
if(glConfig.maxTextureSize <= 0){
glConfig.maxTextureSize = 0;
}
}
/* init command buffers and SMP */
R_InitCommandBuffers();
/* print info */
GfxInfo_f();
/* set default state */
GL_SetDefaultState();
}