这篇教程C++ useVBOs函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中useVBOs函数的典型用法代码示例。如果您正苦于以下问题:C++ useVBOs函数的具体用法?C++ useVBOs怎么用?C++ useVBOs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了useVBOs函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mt// Map for data accessU8* LLVertexBuffer::mapBuffer(S32 access){ LLMemType mt(LLMemType::MTYPE_VERTEX_DATA); if (mFinal) { llwarns << "LLVertexBuffer::mapBuffer() called on a finalized buffer." << llendl; } if (!useVBOs() && !mMappedData && !mMappedIndexData) { llwarns << "LLVertexBuffer::mapBuffer() called on unallocated buffer." << llendl; } if (!mLocked && useVBOs()) { setBuffer(0); mLocked = TRUE; stop_glerror(); mMappedData = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); stop_glerror(); mMappedIndexData = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); stop_glerror(); if (!mMappedData) { //-------------------- //print out more debug info before crash llinfos << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << llendl ; GLint size ; glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size) ; llinfos << "GL_ARRAY_BUFFER_ARB size is " << size << llendl ; //-------------------- GLint buff; glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); if (buff != mGLBuffer) { llwarns << "Invalid GL vertex buffer bound: " << buff << llendl; } llwarns << "glMapBuffer returned NULL (no vertex data)" << llendl; } if (!mMappedIndexData) { GLint buff; glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); if (buff != mGLIndices) { llwarns << "Invalid GL index buffer bound: " << buff << llendl; } llwarns << "glMapBuffer returned NULL (no index data)" << llendl; } sMappedCount++; } return mMappedData;}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:61,
示例2: mt2U8* LLVertexBuffer::mapIndexBuffer(S32 access){ LLMemType mt2(LLMemType::MTYPE_VERTEX_MAP_BUFFER); if (mFinal) { llerrs << "LLVertexBuffer::mapIndexBuffer() called on a finalized buffer." << llendl; } if (!useVBOs() && !mMappedData && !mMappedIndexData) { llerrs << "LLVertexBuffer::mapIndexBuffer() called on unallocated buffer." << llendl; } if (!mIndexLocked && useVBOs()) { { LLMemType mt_v(LLMemType::MTYPE_VERTEX_MAP_BUFFER_INDICES); setBuffer(0, TYPE_INDEX); mIndexLocked = TRUE; stop_glerror(); if(sDisableVBOMapping) { allocateClientIndexBuffer() ; } else { mMappedIndexData = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); } stop_glerror(); } if (!mMappedIndexData) { log_glerror(); if(!sDisableVBOMapping) { GLint buff; glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); if ((GLuint)buff != mGLIndices) { llerrs << "Invalid GL index buffer bound: " << buff << llendl; } llerrs << "glMapBuffer returned NULL (no index data)" << llendl; } else { llerrs << "memory allocation for Index data failed. " << llendl ; } } sMappedCount++; } return mMappedIndexData ;}
开发者ID:Krazy-Bish-Margie,项目名称:Thunderstorm,代码行数:58,
示例3: mtvoid LLVertexBuffer::destroyGLBuffer(){ LLMemType mt(LLMemType::MTYPE_VERTEX_DATA); if (mGLBuffer) { if (useVBOs()) { freeClientBuffer() ; if (mMappedData || mMappedIndexData) { llerrs << "Vertex buffer destroyed while mapped!" << llendl; } releaseBuffer(); } else { ll_aligned_free_16((void*)mMappedData); mMappedData = NULL; mEmpty = TRUE; } sAllocatedBytes -= getSize(); } mGLBuffer = 0; //unbind();}
开发者ID:Barosonix,项目名称:AstraViewer,代码行数:28,
示例4: mtvoid LLVertexBuffer::destroyGLIndices(){ LLMemType mt(LLMemType::MTYPE_VERTEX_DATA); if (mGLIndices) { if (useVBOs()) { freeClientBuffer() ; if (mMappedData || mMappedIndexData) { llerrs << "Vertex buffer destroyed while mapped." << llendl; } releaseIndices(); } else { delete [] mMappedIndexData; mMappedIndexData = NULL; mEmpty = TRUE; } sAllocatedBytes -= getIndicesSize(); } mGLIndices = 0; unbind();}
开发者ID:catface,项目名称:catfacebase,代码行数:28,
示例5: setupVertexBuffer // virtual void setupVertexBuffer(U32 data_mask) { if (LLGLSLShader::sNoFixedFunction) { //just use default if shaders are in play LLVertexBuffer::setupVertexBuffer(data_mask & ~(MAP_TEXCOORD2 | MAP_TEXCOORD3)); return; } volatile U8* base = useVBOs() ? (U8*) mAlignedOffset : mMappedData; //assume tex coords 2 and 3 are present U32 type_mask = mTypeMask | MAP_TEXCOORD2 | MAP_TEXCOORD3; if ((data_mask & type_mask) != data_mask) { llerrs << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << llendl; } if (data_mask & MAP_NORMAL) { glNormalPointer(GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL])); } if (data_mask & MAP_TEXCOORD3) { //substitute tex coord 1 for tex coord 3 glClientActiveTextureARB(GL_TEXTURE3_ARB); glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], (void*)(base + mOffsets[TYPE_TEXCOORD1])); glClientActiveTextureARB(GL_TEXTURE0_ARB); } if (data_mask & MAP_TEXCOORD2) { //substitute tex coord 0 for tex coord 2 glClientActiveTextureARB(GL_TEXTURE2_ARB); glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0])); glClientActiveTextureARB(GL_TEXTURE0_ARB); } if (data_mask & MAP_TEXCOORD1) { glClientActiveTextureARB(GL_TEXTURE1_ARB); glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], (void*)(base + mOffsets[TYPE_TEXCOORD1])); glClientActiveTextureARB(GL_TEXTURE0_ARB); } if (data_mask & MAP_TANGENT) { glClientActiveTextureARB(GL_TEXTURE2_ARB); glTexCoordPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TANGENT], (void*)(base + mOffsets[TYPE_TANGENT])); glClientActiveTextureARB(GL_TEXTURE0_ARB); } if (data_mask & MAP_TEXCOORD0) { glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0])); } if (data_mask & MAP_COLOR) { glColorPointer(4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_COLOR], (void*)(base + mOffsets[TYPE_COLOR])); } if (data_mask & MAP_VERTEX) { glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0)); } }
开发者ID:AlericInglewood,项目名称:SingularityViewer,代码行数:61,
示例6: llassertvoid LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_offset) const{ if (start >= (U32) mRequestedNumVerts || end >= (U32) mRequestedNumVerts) { llerrs << "Bad vertex buffer draw range: [" << start << ", " << end << "] vs " << mRequestedNumVerts << llendl; } llassert(mRequestedNumIndices >= 0); if (indices_offset >= (U32) mRequestedNumIndices || indices_offset + count > (U32) mRequestedNumIndices) { llerrs << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << llendl; } if (gDebugGL && !useVBOs()) { U16* idx = ((U16*) getIndicesPointer())+indices_offset; for (U32 i = 0; i < count; ++i) { if (idx[i] < start || idx[i] > end) { llerrs << "Index out of range: " << idx[i] << " not in [" << start << ", " << end << "]" << llendl; } } }}
开发者ID:Barosonix,项目名称:AstraViewer,代码行数:28,
示例7: useVBOsvoid LLVertexBufferAvatar::setupVertexBuffer(U32 data_mask) const{ if (sRenderingSkinned) { U8* base = useVBOs() ? (U8*) mAlignedOffset : mMappedData; glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_VERTEX], (void*)(base + 0)); glNormalPointer(GL_FLOAT, LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL])); glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0])); set_vertex_weights(LLDrawPoolAvatar::sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT], LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_WEIGHT], (F32*)(base + mOffsets[TYPE_WEIGHT])); if (sShaderLevel >= LLDrawPoolAvatar::SHADER_LEVEL_BUMP) { set_binormals(LLDrawPoolAvatar::sVertexProgram->mAttribute[LLViewerShaderMgr::BINORMAL], LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_BINORMAL], (LLVector3*)(base + mOffsets[TYPE_BINORMAL])); } if (sShaderLevel >= LLDrawPoolAvatar::SHADER_LEVEL_CLOTH) { set_vertex_clothing_weights(LLDrawPoolAvatar::sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_CLOTHING], LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_CLOTHWEIGHT], (LLVector4*)(base + mOffsets[TYPE_CLOTHWEIGHT])); } } else { LLVertexBuffer::setupVertexBuffer(data_mask); }}
开发者ID:VirtualReality,项目名称:Viewer,代码行数:30,
示例8: mtvoid LLVertexBuffer::createGLIndices(){ LLMemType mt(LLMemType::MTYPE_VERTEX_DATA); U32 size = getIndicesSize(); if (mGLIndices) { destroyGLIndices(); } if (size == 0) { return; } mMappedIndexData = new U8[size]; memset(mMappedIndexData, 0, size); mEmpty = TRUE; if (useVBOs()) { glGenBuffersARB(1, (GLuint*) &mGLIndices); mResized = TRUE; sGLCount++; } else { static int gl_buffer_idx = 0; mGLIndices = ++gl_buffer_idx; }}
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:31,
示例9: llassertvoid LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const{ llassert(mRequestedNumVerts >= 0); if (first >= (U32) mRequestedNumVerts || first + count > (U32) mRequestedNumVerts) { llerrs << "Bad vertex buffer draw range: [" << first << ", " << first+count << "]" << llendl; } if (mGLBuffer != sGLRenderBuffer || useVBOs() != sVBOActive) { llerrs << "Wrong vertex buffer bound." << llendl; } if (mode >= LLRender::NUM_MODES) { llerrs << "Invalid draw mode: " << mode << llendl; return; } stop_glerror(); glDrawArrays(sGLMode[mode], first, count); stop_glerror();}
开发者ID:Krazy-Bish-Margie,项目名称:Thunderstorm,代码行数:25,
示例10: operator void operator()(ResourceDatabase* db) { if (stripfy()) setRemoveDoubles(true); std::vector< vl::ref<vl::Geometry> > geom; db->get<Geometry>(geom); for(unsigned int i=0; i<geom.size(); ++i) { if (discardOriginalNormals()) geom[i]->setNormalArray(NULL); if (computeNormals() && !geom[i]->normalArray()) geom[i]->computeNormals(); if (removeDoubles()) DoubleVertexRemover().removeDoubles(geom[i].get()); if (sortVertices()) geom[i]->sortVertices(); if (stripfy()) TriangleStripGenerator().stripfy(geom[i].get(), 22, true, false, true); if (convertToDrawArrays()) geom[i]->convertDrawCallToDrawArrays(); geom[i]->setDisplayListEnabled(useDisplayLists()); geom[i]->setVBOEnabled(useVBOs()); if (transformGeometry()) geom[i]->transform(transformMatrix(),true); } }
开发者ID:TomasHurban,项目名称:DP_Hairs_simulation_and_visualization,代码行数:34,
示例11: markDirtyvoid LLVertexBuffer::markDirty(U32 vert_index, U32 vert_count, U32 indices_index, U32 indices_count){ if (useVBOs() && !mFilthy) { if (!mDirtyRegions.empty()) { DirtyRegion& region = *(mDirtyRegions.rbegin()); if (region.mIndex+region.mCount > vert_index) { //this buffer has received multiple updates since the last copy, mark it filthy mFilthy = TRUE; mDirtyRegions.clear(); return; } if (region.mIndex + region.mCount == vert_index && region.mIndicesIndex + region.mIndicesCount == indices_index) { region.mCount += vert_count; region.mIndicesCount += indices_count; return; } } mDirtyRegions.push_back(DirtyRegion(vert_index,vert_count,indices_index,indices_count)); }}
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:28,
示例12: freeClientBuffer//----------------------------------------------------------------------------void LLVertexBuffer::freeClientBuffer(){ if(useVBOs() && sDisableVBOMapping && (mMappedData || mMappedIndexData)) { delete[] mMappedData ; delete[] mMappedIndexData ; mMappedData = NULL ; mMappedIndexData = NULL ; }}
开发者ID:catface,项目名称:catfacebase,代码行数:11,
示例13: freeClientBuffer//----------------------------------------------------------------------------void LLVertexBuffer::freeClientBuffer(){ if(useVBOs() && sDisableVBOMapping && (mMappedData || mMappedIndexData)) { ll_aligned_free_16((void*)mMappedData) ; ll_aligned_free_16((void*)mMappedIndexData) ; mMappedData = NULL ; mMappedIndexData = NULL ; }}
开发者ID:Barosonix,项目名称:AstraViewer,代码行数:11,
示例14: makeStaticvoid LLVertexBuffer::makeStatic(){ if (!sEnableVBOs) { return; } if (sRenderActive) { llerrs << "Make static called during render." << llendl; } if (mUsage != GL_STATIC_DRAW_ARB) { if (useVBOs()) { if (mGLBuffer) { sDeleteList.push_back(mGLBuffer); } if (mGLIndices) { sDeleteList.push_back(mGLIndices); } } if (mGLBuffer) { sGLCount++; glGenBuffersARB(1, (GLuint*) &mGLBuffer); } if (mGLIndices) { sGLCount++; glGenBuffersARB(1, (GLuint*) &mGLIndices); } mUsage = GL_STATIC_DRAW_ARB; mResized = TRUE; if (!mLocked) { mLocked = TRUE; sLockedList.push_back(this); } }}
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:47,
注:本文中的useVBOs函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ usecs_to_jiffies函数代码示例 C++ useFallbackContent函数代码示例 |