本文整理匯總了C++中GL_CheckErrors函數的典型用法代碼示例。如果您正苦於以下問題:C++ GL_CheckErrors函數的具體用法?C++ GL_CheckErrors怎麽用?C++ GL_CheckErrors使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GL_CheckErrors函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: R_PerformanceCounters
/*
=============
EndFrame
Returns the number of msec spent in the back end
=============
*/
void idRenderSystemLocal::EndFrame( int *frontEndMsec, int *backEndMsec ) {
emptyCommand_t *cmd;
if ( !glConfig.isInitialized ) {
return;
}
// close any gui drawing
guiModel->EmitFullScreen();
guiModel->Clear();
// save out timing information
if ( frontEndMsec ) {
*frontEndMsec = pc.frontEndMsec;
}
if ( backEndMsec ) {
*backEndMsec = backEnd.pc.msec;
}
// print any other statistics and clear all of them
R_PerformanceCounters();
// check for dynamic changes that require some initialization
R_CheckCvars();
// check for errors
GL_CheckErrors();
// add the swapbuffers command
cmd = (emptyCommand_t *)R_GetCommandBuffer( sizeof( *cmd ) );
cmd->commandId = RC_SWAP_BUFFERS;
// start the back end up again with the new command list
R_IssueRenderCommands();
// use the other buffers next frame, because another CPU
// may still be rendering into the current buffers
R_ToggleSmpFrame();
// we can now release the vertexes used this frame
vertexCache.EndFrame();
if ( session->writeDemo ) {
session->writeDemo->WriteInt( DS_RENDER );
session->writeDemo->WriteInt( DC_END_FRAME );
if ( r_showDemo.GetBool() ) {
common->Printf( "write DC_END_FRAME\n" );
}
}
}
示例2: R_SyncRenderThread
/*
============
R_CreateVBO2
============
*/
VBO_t *R_CreateStaticVBO2( const char *name, int numVertexes, shaderVertex_t *verts, unsigned int stateBits )
{
VBO_t *vbo;
if ( !numVertexes )
{
return nullptr;
}
if ( strlen( name ) >= MAX_QPATH )
{
ri.Error( ERR_DROP, "R_CreateVBO2: \"%s\" is too long", name );
}
// make sure the render thread is stopped
R_SyncRenderThread();
vbo = ( VBO_t * ) ri.Hunk_Alloc( sizeof( *vbo ), h_low );
memset( vbo, 0, sizeof( *vbo ) );
Com_AddToGrowList( &tr.vbos, vbo );
Q_strncpyz( vbo->name, name, sizeof( vbo->name ) );
vbo->layout = VBO_LAYOUT_STATIC;
vbo->framesNum = 0;
vbo->vertexesNum = numVertexes;
vbo->attribBits = stateBits;
vbo->usage = GL_STATIC_DRAW;
R_SetVBOAttributeLayouts( vbo );
glGenBuffers( 1, &vbo->vertexesVBO );
R_BindVBO( vbo );
#ifdef GLEW_ARB_buffer_storage
if( glConfig2.bufferStorageAvailable ) {
glBufferStorage( GL_ARRAY_BUFFER, vbo->vertexesSize,
verts, 0 );
} else
#endif
{
glBufferData( GL_ARRAY_BUFFER, vbo->vertexesSize,
verts, vbo->usage );
}
R_BindNullVBO();
GL_CheckErrors();
return vbo;
}
示例3: switch
/*
============
R_CreateIBO
============
*/
IBO_t *R_CreateIBO(const char *name, byte * indexes, int indexesSize, vboUsage_t usage)
{
IBO_t *ibo;
int glUsage;
switch (usage)
{
case VBO_USAGE_STATIC:
glUsage = GL_STATIC_DRAW_ARB;
break;
case VBO_USAGE_DYNAMIC:
glUsage = GL_DYNAMIC_DRAW_ARB;
break;
default:
Com_Error(ERR_FATAL, "bad vboUsage_t given: %i", usage);
return NULL;
}
if(strlen(name) >= MAX_QPATH)
{
ri.Error(ERR_DROP, "R_CreateIBO: \"%s\" is too long", name);
}
if ( tr.numIBOs == MAX_IBOS ) {
ri.Error( ERR_DROP, "R_CreateIBO: MAX_IBOS hit");
}
R_IssuePendingRenderCommands();
ibo = tr.ibos[tr.numIBOs] = ri.Hunk_Alloc(sizeof(*ibo), h_low);
tr.numIBOs++;
Q_strncpyz(ibo->name, name, sizeof(ibo->name));
ibo->indexesSize = indexesSize;
qglGenBuffersARB(1, &ibo->indexesVBO);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, ibo->indexesVBO);
qglBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indexesSize, indexes, glUsage);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
glState.currentIBO = NULL;
GL_CheckErrors();
return ibo;
}
示例4: R_InitVBOs
/*
============
R_InitVBOs
============
*/
void R_InitVBOs( void )
{
int dataSize;
byte *data;
ri.Printf( PRINT_ALL, "------- R_InitVBOs -------\n" );
Com_InitGrowList( &tr.vbos, 100 );
Com_InitGrowList( &tr.ibos, 100 );
dataSize = sizeof( vec4_t ) * SHADER_MAX_VERTEXES * 11;
data = Com_Allocate( dataSize );
memset( data, 0, dataSize );
tess.vbo = R_CreateVBO( "tessVertexArray_VBO", data, dataSize, VBO_USAGE_DYNAMIC );
tess.vbo->ofsXYZ = 0;
tess.vbo->ofsTexCoords = tess.vbo->ofsXYZ + sizeof( tess.xyz );
tess.vbo->ofsLightCoords = tess.vbo->ofsTexCoords + sizeof( tess.texCoords );
tess.vbo->ofsTangents = tess.vbo->ofsLightCoords + sizeof( tess.lightCoords );
tess.vbo->ofsBinormals = tess.vbo->ofsTangents + sizeof( tess.tangents );
tess.vbo->ofsNormals = tess.vbo->ofsBinormals + sizeof( tess.binormals );
tess.vbo->ofsColors = tess.vbo->ofsNormals + sizeof( tess.normals );
#if !defined( COMPAT_Q3A ) && !defined( COMPAT_ET )
tess.vbo->ofsPaintColors = tess.vbo->ofsColors + sizeof( tess.colors );
tess.vbo->ofsLightDirections = tess.vbo->ofsPaintColors + sizeof( tess.paintColors );
#endif
tess.vbo->sizeXYZ = sizeof( tess.xyz );
tess.vbo->sizeTangents = sizeof( tess.tangents );
tess.vbo->sizeBinormals = sizeof( tess.binormals );
tess.vbo->sizeNormals = sizeof( tess.normals );
Com_Dealloc( data );
dataSize = sizeof( tess.indexes );
data = Com_Allocate( dataSize );
memset( data, 0, dataSize );
tess.ibo = R_CreateIBO( "tessVertexArray_IBO", data, dataSize, VBO_USAGE_DYNAMIC );
Com_Dealloc( data );
R_InitUnitCubeVBO();
R_BindNullVBO();
R_BindNullIBO();
GL_CheckErrors();
}
示例5: R_CreateFBOPackedDepthStencilBuffer
/*
================
R_CreateFBOPackedDepthStencilBuffer
================
*/
void R_CreateFBOPackedDepthStencilBuffer( FBO_t *fbo, int format )
{
#if defined( USE_D3D10 )
// TODO
#else
qboolean absent;
if ( format != GL_DEPTH_STENCIL_EXT && format != GL_DEPTH24_STENCIL8_EXT )
{
ri.Printf( PRINT_WARNING, "R_CreateFBOPackedDepthStencilBuffer: format %i is not depth-stencil-renderable\n", format );
return;
}
fbo->packedDepthStencilFormat = format;
absent = fbo->packedDepthStencilBuffer == 0;
if ( absent )
{
glGenRenderbuffersEXT( 1, &fbo->packedDepthStencilBuffer );
}
glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, fbo->packedDepthStencilBuffer );
glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, fbo->packedDepthStencilFormat, fbo->width, fbo->height );
GL_CheckErrors();
if ( absent )
{
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT,
fbo->packedDepthStencilBuffer );
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT,
fbo->packedDepthStencilBuffer );
}
GL_CheckErrors();
#endif
}
示例6: PC_EndNamedEvent
/*
========================
PC_EndNamedEvent
========================
*/
void PC_EndNamedEvent() {
#if 0
if ( !r_pix.GetBool() ) {
return;
}
if ( numPixLevels <= 0 ) {
idLib::FatalError( "PC_EndNamedEvent: level underflow" );
}
if ( --numPixLevels > 0 ) {
// only do timing on top level events
return;
}
if ( !glGetQueryObjectui64vEXT ) {
return;
}
pixEvent_t *ev = &pixEvents[numPixEvents-1];
ev->cpuTime = Sys_Microseconds() - ev->cpuTime;
GL_CheckErrors();
glEndQuery( GL_TIME_ELAPSED_EXT );
GL_CheckErrors();
#endif
}
示例7: switch
/*
============
R_CreateIBO
============
*/
IBO_t *R_CreateIBO( const char *name, byte *indexes, int indexesSize, vboUsage_t usage )
{
IBO_t *ibo;
int glUsage;
switch ( usage )
{
case VBO_USAGE_STATIC:
glUsage = GL_STATIC_DRAW;
break;
case VBO_USAGE_DYNAMIC:
glUsage = GL_DYNAMIC_DRAW;
break;
default:
glUsage = 0;
Com_Error( ERR_FATAL, "bad vboUsage_t given: %i", usage );
}
if ( strlen( name ) >= MAX_QPATH )
{
ri.Error( ERR_DROP, "R_CreateIBO: \"%s\" is too long", name );
}
// make sure the render thread is stopped
R_SyncRenderThread();
ibo = ri.Hunk_Alloc( sizeof( *ibo ), h_low );
Com_AddToGrowList( &tr.ibos, ibo );
Q_strncpyz( ibo->name, name, sizeof( ibo->name ) );
ibo->indexesSize = indexesSize;
glGenBuffers( 1, &ibo->indexesVBO );
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, ibo->indexesVBO );
glBufferData( GL_ELEMENT_ARRAY_BUFFER, indexesSize, indexes, glUsage );
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 );
GL_CheckErrors();
return ibo;
}
示例8: R_CreateFBOColorBuffer
/*
================
R_CreateFBOColorBuffer
Framebuffer must be bound
================
*/
void R_CreateFBOColorBuffer( FBO_t *fbo, int format, int index )
{
#if defined( USE_D3D10 )
// TODO
#else
qboolean absent;
if ( index < 0 || index >= glConfig2.maxColorAttachments )
{
ri.Printf( PRINT_WARNING, "R_CreateFBOColorBuffer: invalid attachment index %i\n", index );
return;
}
#if 0
if ( format != GL_RGB &&
format != GL_RGBA &&
format != GL_RGB16F && format != GL_RGBA16F && format != GL_RGB32F_ARB && format != GL_RGBA32F_ARB )
{
ri.Printf( PRINT_WARNING, "R_CreateFBOColorBuffer: format %i is not color-renderable\n", format );
//return;
}
#endif
fbo->colorFormat = format;
absent = fbo->colorBuffers[ index ] == 0;
if ( absent )
{
glGenRenderbuffersEXT( 1, &fbo->colorBuffers[ index ] );
}
glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, fbo->colorBuffers[ index ] );
glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, format, fbo->width, fbo->height );
if ( absent )
{
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT + index, GL_RENDERBUFFER_EXT,
fbo->colorBuffers[ index ] );
}
GL_CheckErrors();
#endif
}
示例9: memset
frameInfo_t idRenderSystemLocal::LocalEndFrame() {
frameInfo_t info;
memset(&info, 0, sizeof(info));
if (!glConfig.isInitialized) {
return info;
}
// close any gui drawing
guiModel->EmitFullScreen();
guiModel->Clear();
// save out timing information
info.time.frontEndMsec = pc.frontEndMsec;
info.time.backEndMsec = backEnd.pc.msec;
// print any other statistics and clear all of them
R_PerformanceCounters();
// check for errors
GL_CheckErrors(false);
// add the swapbuffers command
auto cmd = R_GetCommandBuffer<emptyCommand_t>();
cmd->commandId = RC_SWAP_BUFFERS;
// start the back end up again with the new command list
info.framebuffer = R_IssueRenderCommands();
// use the other buffers next frame, because another CPU
// may still be rendering into the current buffers
R_ToggleSmpFrame();
// we can now release the vertexes used this frame
vertexCache.EndFrame();
if (session->writeDemo) {
session->writeDemo->WriteInt(DS_RENDER);
session->writeDemo->WriteInt(DC_END_FRAME);
if (r_showDemo.GetBool()) {
common->Printf("write DC_END_FRAME\n");
}
}
return info;
}
示例10: R_InitVBOs
/*
============
R_InitVBOs
============
*/
void R_InitVBOs(void)
{
int dataSize;
byte *data;
Ren_Print("------- R_InitVBOs -------\n");
Com_InitGrowList(&tr.vbos, 100);
Com_InitGrowList(&tr.ibos, 100);
dataSize = sizeof(vec4_t) * SHADER_MAX_VERTEXES * 11;
data = (byte *)Com_Allocate(dataSize);
memset(data, 0, dataSize);
tess.vbo = R_CreateVBO("tessVertexArray_VBO", data, dataSize, VBO_USAGE_DYNAMIC);
tess.vbo->ofsXYZ = 0;
tess.vbo->ofsTexCoords = tess.vbo->ofsXYZ + sizeof(tess.xyz);
tess.vbo->ofsLightCoords = tess.vbo->ofsTexCoords + sizeof(tess.texCoords);
tess.vbo->ofsTangents = tess.vbo->ofsLightCoords + sizeof(tess.lightCoords);
tess.vbo->ofsBinormals = tess.vbo->ofsTangents + sizeof(tess.tangents);
tess.vbo->ofsNormals = tess.vbo->ofsBinormals + sizeof(tess.binormals);
tess.vbo->ofsColors = tess.vbo->ofsNormals + sizeof(tess.normals);
tess.vbo->sizeXYZ = sizeof(tess.xyz);
tess.vbo->sizeTangents = sizeof(tess.tangents);
tess.vbo->sizeBinormals = sizeof(tess.binormals);
tess.vbo->sizeNormals = sizeof(tess.normals);
Com_Dealloc(data);
dataSize = sizeof(tess.indexes);
data = (byte *)Com_Allocate(dataSize);
memset(data, 0, dataSize);
tess.ibo = R_CreateIBO("tessVertexArray_IBO", data, dataSize, VBO_USAGE_DYNAMIC);
Com_Dealloc(data);
R_InitUnitCubeVBO();
R_BindNullVBO();
R_BindNullIBO();
GL_CheckErrors();
}
示例11: R_NV20_Init
/*
==================
R_NV20_Init
==================
*/
void R_NV20_Init(void)
{
glConfig.allowNV20Path = false;
common->Printf("---------- R_NV20_Init ----------\n");
if (!glConfig.registerCombinersAvailable || !glConfig.ARBVertexProgramAvailable || glConfig.maxTextureUnits < 4) {
common->Printf("Not available.\n");
return;
}
GL_CheckErrors();
// create our "fragment program" display lists
fragmentDisplayListBase = qglGenLists(FPROG_NUM_FRAGMENT_PROGRAMS);
// force them to issue commands to build the list
bool temp = r_useCombinerDisplayLists.GetBool();
r_useCombinerDisplayLists.SetBool(false);
qglNewList(fragmentDisplayListBase + FPROG_BUMP_AND_LIGHT, GL_COMPILE);
RB_NV20_BumpAndLightFragment();
qglEndList();
qglNewList(fragmentDisplayListBase + FPROG_DIFFUSE_COLOR, GL_COMPILE);
RB_NV20_DiffuseColorFragment();
qglEndList();
qglNewList(fragmentDisplayListBase + FPROG_SPECULAR_COLOR, GL_COMPILE);
RB_NV20_SpecularColorFragment();
qglEndList();
qglNewList(fragmentDisplayListBase + FPROG_DIFFUSE_AND_SPECULAR_COLOR, GL_COMPILE);
RB_NV20_DiffuseAndSpecularColorFragment();
qglEndList();
r_useCombinerDisplayLists.SetBool(temp);
common->Printf("---------------------------------\n");
glConfig.allowNV20Path = true;
}
示例12: glGenRenderbuffers
void Framebuffer::AddDepthBuffer( int format )
{
depthFormat = format;
bool notCreatedYet = depthBuffer == 0;
if( notCreatedYet )
{
glGenRenderbuffers( 1, &depthBuffer );
}
glBindRenderbuffer( GL_RENDERBUFFER, depthBuffer );
glRenderbufferStorage( GL_RENDERBUFFER, format, width, height );
if( notCreatedYet )
{
glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthBuffer );
}
GL_CheckErrors();
}
示例13: R_CreateFBOColorBuffer
/*
================
R_CreateFBOColorBuffer
Framebuffer must be bound
================
*/
void R_CreateFBOColorBuffer(FBO_t *fbo, int format, int index)
{
qboolean absent;
BufferImage_t *bufferImage;
if (index < 0 || index >= glConfig2.maxColorAttachments)
{
Ren_Warning("R_CreateFBOColorBuffer: invalid attachment index %i\n", index);
return;
}
#if 0
if (format != GL_RGB &&
format != GL_RGBA &&
format != GL_RGB16F_ARB && format != GL_RGBA16F_ARB && format != GL_RGB32F_ARB && format != GL_RGBA32F_ARB)
{
Ren_Warning("R_CreateFBOColorBuffer: format %i is not color-renderable\n", format);
//return;
}
#endif
bufferImage = &fbo->colorBuffers[index];
bufferImage->format = format;
absent = bufferImage->buffer == 0;
if (absent)
{
glGenRenderbuffers(1, &bufferImage->buffer);
}
glBindRenderbuffer(GL_RENDERBUFFER, bufferImage->buffer);
glRenderbufferStorage(GL_RENDERBUFFER, format, fbo->width, fbo->height);
if (absent)
{
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + index, GL_RENDERBUFFER, bufferImage->buffer);
}
GL_CheckErrors();
}
示例14: R_BindNullVao
/*
============
R_BindNullVao
============
*/
void R_BindNullVao(void)
{
GLimp_LogComment("--- R_BindNullVao ---\n");
if(glState.currentVao)
{
if (glRefConfig.vertexArrayObject)
{
qglBindVertexArray(0);
// why you no save GL_ELEMENT_ARRAY_BUFFER binding, Intel?
if (1) qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
else
{
qglBindBuffer(GL_ARRAY_BUFFER, 0);
qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
glState.currentVao = NULL;
}
GL_CheckErrors();
}
示例15: R_InitVBOs
/*
============
R_InitVBOs
============
*/
void R_InitVBOs()
{
uint32_t attribs = ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT | ATTR_COLOR;
ri.Printf( PRINT_DEVELOPER, "------- R_InitVBOs -------\n" );
Com_InitGrowList( &tr.vbos, 100 );
Com_InitGrowList( &tr.ibos, 100 );
tess.vertsBuffer = ( shaderVertex_t * ) Com_Allocate_Aligned( 64, SHADER_MAX_VERTEXES * sizeof( shaderVertex_t ) );
tess.indexesBuffer = ( glIndex_t * ) Com_Allocate_Aligned( 64, SHADER_MAX_INDEXES * sizeof( glIndex_t ) );
if( glConfig2.mapBufferRangeAvailable ) {
tess.vbo = R_CreateDynamicVBO( "tessVertexArray_VBO", vertexCapacity, attribs, VBO_LAYOUT_STATIC );
tess.ibo = R_CreateDynamicIBO( "tessVertexArray_IBO", indexCapacity );
tess.vertsWritten = tess.indexesWritten = 0;
} else {
// use glBufferSubData to update VBO
tess.vbo = R_CreateDynamicVBO( "tessVertexArray_VBO", SHADER_MAX_VERTEXES, attribs, VBO_LAYOUT_STATIC );
tess.ibo = R_CreateDynamicIBO( "tessVertexArray_IBO", SHADER_MAX_INDEXES );
}
R_InitUnitCubeVBO();
// allocate a PBO for color grade map transfers
glGenBuffers( 1, &tr.colorGradePBO );
glBindBuffer( GL_PIXEL_PACK_BUFFER, tr.colorGradePBO );
glBufferData( GL_PIXEL_PACK_BUFFER,
REF_COLORGRADEMAP_STORE_SIZE * sizeof(u8vec4_t),
nullptr, GL_STREAM_COPY );
glBindBuffer( GL_PIXEL_PACK_BUFFER, 0 );
GL_CheckErrors();
}