本文整理汇总了C++中CTexture::setFiltering方法的典型用法代码示例。如果您正苦于以下问题:C++ CTexture::setFiltering方法的具体用法?C++ CTexture::setFiltering怎么用?C++ CTexture::setFiltering使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTexture
的用法示例。
在下文中一共展示了CTexture::setFiltering方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: build
//.........这里部分代码省略.........
for(ushort i = 0; i < nNumIndices; i+=3)
{
GLushort tmp = indices[i+1];
indices[i+1] = indices[i+2];
indices[i+2] = tmp;
}
}
if(mTextureScale != 1.0f)
{
for(size_t i = 0; i < nNumVertices; ++i)
texcoords[i] = texcoords[i] / mTextureScale;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CObject* pObject = new CObject;
pObject->mNumVertices = nNumVertices;
pObject->mNumIndices = nNumIndices;
pObject->setDrawStrategy(mDrawStrategy == nullptr ? new CDrawStrategy : mDrawStrategy);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{ // shapes
CShape* pShape = new CShape;
pShape->setVertexBufferRange(0, pObject->mNumVertices, GL_FLOAT);
pShape->setIndexBufferRange(0, pObject->mNumIndices, GL_UNSIGNED_SHORT);
CMaterial* pMaterial = new CMaterial;
CDdsTextureBuilder* pTextureBuilder = new CDdsTextureBuilder;
pTextureBuilder->setFile("notfound.dds");
CTexture* pTexture = pTextureBuilder->build();
pTexture->setFiltering(CTexture::EFiltering::TRILINEAR);
delete pTextureBuilder;
pMaterial->setTexture(CTexture::EScope::DIFFUSE, pTexture);
pShape->setMaterial(pMaterial);
pObject->addShape(pShape);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
pObject->mBuffers.resize(5);
glGenVertexArrays(1, &(pObject->mVAO));
glBindVertexArray(pObject->mVAO);
// indices
glGenBuffers(1, &(pObject->mBuffers[INDEX_BUFFER_INDEX]));
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, pObject->mBuffers[INDEX_BUFFER_INDEX]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, nNumIndices * sizeof(GLushort), indices, GL_STATIC_DRAW);
// positions
glGenBuffers(1, &(pObject->mBuffers[POSITION_BUFFER_INDEX]));
glBindBuffer(GL_ARRAY_BUFFER, pObject->mBuffers[POSITION_BUFFER_INDEX]);
glBufferData(GL_ARRAY_BUFFER, nNumVertices * sizeof(math::vec3), positions, GL_STATIC_DRAW);
glVertexAttribPointer(POSITION_ATTRIBUTE, 3, GL_FLOAT, GL_FALSE, sizeof(math::vec3), (const GLvoid*)(0));
glEnableVertexAttribArray(POSITION_ATTRIBUTE); // positions
// texcoords
glGenBuffers(1, &(pObject->mBuffers[TEXCOORD_BUFFER_INDEX]));
glBindBuffer(GL_ARRAY_BUFFER, pObject->mBuffers[TEXCOORD_BUFFER_INDEX]);
glBufferData(GL_ARRAY_BUFFER, nNumVertices * sizeof(math::vec2), texcoords, GL_STATIC_DRAW);