本文整理汇总了C++中GLint函数的典型用法代码示例。如果您正苦于以下问题:C++ GLint函数的具体用法?C++ GLint怎么用?C++ GLint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GLint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: initBuffer
bool initBuffer()
{
GLint UniformBufferOffset(0);
glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &UniformBufferOffset);
this->UniformBlockSize = glm::max(GLint(sizeof(glm::mat4)), UniformBufferOffset);
glCreateBuffers(buffer::MAX, &BufferName[0]);
glNamedBufferStorage(BufferName[buffer::ELEMENT], ElementSize, ElementData, 0);
glNamedBufferStorage(BufferName[buffer::VERTEX], VertexSize, VertexData, 0);
glNamedBufferStorage(BufferName[buffer::TRANSFORM], this->UniformBlockSize * 2, nullptr, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
this->UniformPointer = static_cast<glm::uint8*>(glMapNamedBufferRange(
BufferName[buffer::TRANSFORM], 0, this->UniformBlockSize * 2, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT | GL_MAP_INVALIDATE_BUFFER_BIT));
return true;
}
开发者ID:h3rb,项目名称:ogl-samples,代码行数:16,代码来源:gl-500-direct-state-access-gtc.cpp
示例2: light2Active
static void light2Active(OSG::SHLChunk::GetUniformLocProc fULoc,
OSG::DrawEnv *pEnv,
GLuint uiProg)
{
GLint iLoc = fULoc(uiProg, "Light2Active");
if(iLoc != -1)
{
OSGGETGLFUNC_EXT(glUniform1i,
osgGlUniform1i,
OSG::ShaderProgram::getFuncIdUniform1i());
osgGlUniform1i(iLoc,
GLint(pEnv->getLightState() & 0x0004));
}
}
开发者ID:vrsource,项目名称:OpenSGDevMaster,代码行数:16,代码来源:testSHLProcLights_compat.cpp
示例3: initTexture
bool initTexture()
{
gli::texture2d Texture(gli::load_dds((getDataDirectory() + TEXTURE_DIFFUSE).c_str()));
assert(!Texture.empty());
glm::uvec2 FramebufferSize(this->getWindowSize() / 16u);
glCreateTextures(GL_TEXTURE_2D_ARRAY, texture::MAX, &TextureName[0]);
glTextureParameteri(TextureName[0], GL_TEXTURE_BASE_LEVEL, 0);
glTextureParameteri(TextureName[0], GL_TEXTURE_MAX_LEVEL, 0);
glTextureParameteri(TextureName[0], GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTextureParameteri(TextureName[0], GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTextureStorage3D(TextureName[0], GLint(1), GL_RGBA8, GLsizei(FramebufferSize.x), GLsizei(FramebufferSize.y), 1);
return true;
}
开发者ID:g-truc,项目名称:ogl-samples,代码行数:16,代码来源:gl-500-conservative-raster-nv.cpp
示例4: if
void WrappedOpenGL::glGetIntegeri_v(GLenum pname, GLuint index, GLint *data)
{
if(pname == eGL_MIN_MAP_BUFFER_ALIGNMENT)
{
if(data)
*data = (GLint)64;
return;
}
else if(pname == eGL_DEBUG_TOOL_PURPOSE_EXT)
{
if(data)
*data = GLint(eGL_DEBUG_TOOL_FRAME_CAPTURE_BIT_EXT);
return;
}
m_Real.glGetIntegeri_v(pname, index, data);
}
开发者ID:DrChat,项目名称:renderdoc,代码行数:16,代码来源:gl_get_funcs.cpp
示例5: initTexture
bool initTexture()
{
bool Validated(true);
gli::gl GL;
gli::texture2D Texture(gli::load_dds((getDataDirectory() + TEXTURE_DIFFUSE).c_str()));
gli::gl::format const Format = GL.translate(Texture.format());
assert(!Texture.empty());
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures(texture::MAX, &TextureName[0]);
glBindTexture(GL_TEXTURE_2D, TextureName[texture::DIFFUSE]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, GLint(Texture.levels() - 1));
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_RED);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, GL_GREEN);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_BLUE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_ALPHA);
glTexStorage2D(GL_TEXTURE_2D, static_cast<GLint>(Texture.levels()), Format.Internal, static_cast<GLsizei>(Texture.dimensions().x), static_cast<GLsizei>(Texture.dimensions().y));
for (std::size_t Level = 0; Level < Texture.levels(); ++Level)
{
glCompressedTexSubImage2D(GL_TEXTURE_2D, static_cast<GLint>(Level),
0, 0,
static_cast<GLsizei>(Texture[Level].dimensions().x), static_cast<GLsizei>(Texture[Level].dimensions().y),
Format.External,
static_cast<GLsizei>(Texture[Level].size()),
Texture[Level].data());
}
glm::vec2 WindowSize(this->getWindowSize());
glBindTexture(GL_TEXTURE_2D, TextureName[texture::COLORBUFFER]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexStorage2D(GL_TEXTURE_2D, static_cast<GLint>(1), GL_RGBA8, static_cast<GLsizei>(WindowSize.x), static_cast<GLsizei>(WindowSize.y));
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
return Validated;
}
开发者ID:hurims,项目名称:ogl-samples,代码行数:47,代码来源:gl-450-texture-barrier.cpp
示例6: initTexture
bool initTexture()
{
gli::texture2D Texture(gli::loadStorageDDS(glf::DATA_DIRECTORY + TEXTURE_DIFFUSE));
glGenTextures(texture::MAX, &TextureName[0]);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, TextureName[texture::DIFFUSE]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
for(std::size_t Level = 0; Level < Texture.levels(); ++Level)
{
glTexImage2D(
GL_TEXTURE_2D,
GLint(Level),
GL_RGBA8UI,
GLsizei(Texture[Level].dimensions().x),
GLsizei(Texture[Level].dimensions().y),
0,
GL_BGR_INTEGER, GL_UNSIGNED_BYTE,
Texture[Level].data());
}
glBindTexture(GL_TEXTURE_2D, 0);
GLint MaxSampleMaskWords(0);
GLint MaxColorTextureSamples(0);
GLint MaxDepthTextureSamples(0);
GLint MaxIntegerSamples(0);
glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &MaxSampleMaskWords);
glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &MaxColorTextureSamples);
glGetIntegerv(GL_MAX_DEPTH_TEXTURE_SAMPLES, &MaxDepthTextureSamples);
glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &MaxIntegerSamples);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, TextureName[texture::MULTISAMPLE]);
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, MaxIntegerSamples, GL_RGBA8UI, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y, GL_TRUE);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, 0);
glBindTexture(GL_TEXTURE_2D, TextureName[texture::COLORBUFFER]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8UI, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y, 0, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, 0);
glBindTexture(GL_TEXTURE_2D, 0);
return glf::checkError("initTexture");
}
开发者ID:Daft-Freak,项目名称:vogl,代码行数:46,代码来源:gl-320-fbo-multisample-integer.cpp
示例7: initTexture
bool initTexture()
{
GLint MaxSampleMaskWords(0);
GLint MaxColorTextureSamples(0);
GLint MaxDepthTextureSamples(0);
GLint MaxIntegerSamples(0);
glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &MaxSampleMaskWords);
glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &MaxColorTextureSamples);
glGetIntegerv(GL_MAX_DEPTH_TEXTURE_SAMPLES, &MaxDepthTextureSamples);
glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &MaxIntegerSamples);
gli::texture2d Texture(gli::load_dds((getDataDirectory() + TEXTURE_DIFFUSE).c_str()));
gli::gl GL(gli::gl::PROFILE_GL32);
glGenTextures(texture::MAX, &TextureName[0]);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, TextureName[texture::DIFFUSE]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 3);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
gli::gl::format const Format = GL.translate(gli::FORMAT_RGB8_UINT_PACK8, Texture.swizzles());
for(std::size_t Level = 0; Level < Texture.levels(); ++Level)
{
glTexImage2D(GL_TEXTURE_2D, GLint(Level),
Format.Internal,
GLsizei(Texture[Level].extent().x), GLsizei(Texture[Level].extent().y),
0,
Format.External, Format.Type,
Texture[Level].data());
}
glm::ivec2 WindowSize(this->getWindowSize());
glBindTexture(GL_TEXTURE_2D, TextureName[texture::RENDERBUFFER]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8UI,
WindowSize.x / FRAMEBUFFER_SIZE, WindowSize.y / FRAMEBUFFER_SIZE,
0, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, 0);
glBindTexture(GL_TEXTURE_2D, 0);
return this->checkError("initTexture");
}
开发者ID:mzhg,项目名称:ogl-samples,代码行数:46,代码来源:gl-320-fbo-integer.cpp
示例8: snprintf
void Pager::addChild(Widget* newChild)
{
/* Do nothing if the new child is actually a page button: */
if(addingPageButton)
return;
/* Add the child to the list at the selected position: */
children.insert(children.begin()+nextChildIndex,newChild);
/* Create a new page button: */
char pbName[20];
snprintf(pbName,sizeof(pbName),"PageButton%u",nextPageIndex);
++nextPageIndex;
Button* newPageButton;
addingPageButton=true;
if(!nextPageName.empty())
{
newPageButton=new Button(pbName,this,nextPageName.c_str());
nextPageName="";
}
else
{
/* Create a default page button label: */
char pbLabel[20];
snprintf(pbLabel,sizeof(pbLabel),"Page %u",nextPageIndex);
newPageButton=new Button(pbName,this,pbLabel);
}
addingPageButton=false;
newPageButton->setBorderWidth(newPageButton->getBorderWidth()*0.5f);
newPageButton->getSelectCallbacks().add(this,&Pager::pageButtonSelectCallback);
/* Add the page button to the list: */
pageButtons.insert(pageButtons.begin()+nextChildIndex,newPageButton);
/* Select the just-added child: */
setCurrentChildIndex(nextChildIndex);
/* Prepare for the next page: */
nextChildIndex=GLint(children.size());
if(isManaged)
{
/* Try to resize the widget to accomodate the new child: */
parent->requestResize(this,calcNaturalSize());
}
}
开发者ID:Doc-Ok,项目名称:OpticalTracking,代码行数:46,代码来源:Pager.cpp
示例9: initTexture2D
bool initTexture2D()
{
glGenTextures(1, &Texture2DName);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, Texture2DName);
gli::texture2D Texture(gli::loadStorageDDS(glf::DATA_DIRECTORY + TEXTURE_DIFFUSE_DXT5));
for(std::size_t Level = 0; Level < Texture.levels(); ++Level)
{
glCompressedTexImage2D(
GL_TEXTURE_2D,
GLint(Level),
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
GLsizei(Texture[Level].dimensions().x),
GLsizei(Texture[Level].dimensions().y),
0,
GLsizei(Texture[Level].size()),
Texture[Level].data());
}
SwizzleR[viewport::V00] = GL_RED;
SwizzleG[viewport::V00] = GL_GREEN;
SwizzleB[viewport::V00] = GL_BLUE;
SwizzleA[viewport::V00] = GL_ALPHA;
SwizzleR[viewport::V10] = GL_BLUE;
SwizzleG[viewport::V10] = GL_GREEN;
SwizzleB[viewport::V10] = GL_RED;
SwizzleA[viewport::V10] = GL_ALPHA;
SwizzleR[viewport::V11] = GL_ONE;
SwizzleG[viewport::V11] = GL_GREEN;
SwizzleB[viewport::V11] = GL_BLUE;
SwizzleA[viewport::V11] = GL_ALPHA;
SwizzleR[viewport::V01] = GL_ZERO;
SwizzleG[viewport::V01] = GL_GREEN;
SwizzleB[viewport::V01] = GL_BLUE;
SwizzleA[viewport::V01] = GL_ALPHA;
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);
return glf::checkError("initTexture2D");
}
开发者ID:Daft-Freak,项目名称:vogl,代码行数:46,代码来源:gl-330-texture-swizzle.cpp
示例10: initTexture2D
bool initTexture2D()
{
glGenTextures(1, &Texture2DName);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, Texture2DName);
gli::image Image = gli::import_as(TEXTURE_DIFFUSE_DXT5);
for(std::size_t Level = 0; Level < Image.levels(); ++Level)
{
glCompressedTexImage2D(
GL_TEXTURE_2D,
GLint(Level),
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
GLsizei(Image[Level].dimensions().x),
GLsizei(Image[Level].dimensions().y),
0,
GLsizei(Image[Level].capacity()),
Image[Level].data());
}
SwizzleR[viewport::V00] = GL_RED;
SwizzleG[viewport::V00] = GL_GREEN;
SwizzleB[viewport::V00] = GL_BLUE;
SwizzleA[viewport::V00] = GL_ALPHA;
SwizzleR[viewport::V10] = GL_BLUE;
SwizzleG[viewport::V10] = GL_GREEN;
SwizzleB[viewport::V10] = GL_RED;
SwizzleA[viewport::V10] = GL_ALPHA;
SwizzleR[viewport::V11] = GL_ONE;
SwizzleG[viewport::V11] = GL_GREEN;
SwizzleB[viewport::V11] = GL_BLUE;
SwizzleA[viewport::V11] = GL_ALPHA;
SwizzleR[viewport::V01] = GL_ZERO;
SwizzleG[viewport::V01] = GL_GREEN;
SwizzleB[viewport::V01] = GL_BLUE;
SwizzleA[viewport::V01] = GL_ALPHA;
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);
return glf::checkError("initTexture2D");
}
开发者ID:spetz911,项目名称:vog,代码行数:46,代码来源:ogl-330-sampler-swizzle.cpp
示例11: drawElementsInstancedBaseVertexBaseInstance
inline void drawElementsInstancedBaseVertexBaseInstance(
DrawElementsInstancedBaseVertexBaseInstanceMode mode,
GLsizei count,
DrawElementsInstancedBaseVertexBaseInstanceType type,
GLvoid *indices,
GLsizei primcount,
GLint basevertex,
GLuint baseinstance) {
glDrawElementsInstancedBaseVertexBaseInstance(
GLenum(mode),
GLsizei(count),
GLenum(type),
(GLvoid*)(indices),
GLsizei(primcount),
GLint(basevertex),
GLuint(baseinstance));
}
开发者ID:ngzHappy,项目名称:OpenGL45Book,代码行数:17,代码来源:DrawFunctions.hpp
示例12: glCompileShaderFromFile
void glCompileShaderFromFile(GLhandleARB shaderObject,const char* shaderSourceFileName,IO::File& shaderSourceFile)
{
/* Read the entire shader source: */
size_t shaderAllocSize=8192;
GLcharARB* shaderSource=new GLcharARB[shaderAllocSize];
size_t shaderSourceLength=0;
while(!shaderSourceFile.eof())
{
/* Make room in the shader source buffer: */
if(shaderSourceLength==shaderAllocSize)
{
shaderAllocSize=(shaderAllocSize*3)/2;
GLcharARB* newShaderSource=new GLcharARB[shaderAllocSize];
memcpy(newShaderSource,shaderSource,shaderSourceLength);
delete[] shaderSource;
shaderSource=newShaderSource;
}
/* Read more data from the file: */
size_t numBytesRead=shaderSourceFile.readUpTo(shaderSource+shaderSourceLength,shaderAllocSize-shaderSourceLength);
shaderSourceLength+=numBytesRead;
}
/* Upload the shader source into the shader object: */
const GLcharARB* ss=shaderSource;
GLint ssl=GLint(shaderSourceLength);
glShaderSourceARB(shaderObject,1,&ss,&ssl);
delete[] shaderSource;
/* Compile the shader source: */
glCompileShaderARB(shaderObject);
/* Check if the shader compiled successfully: */
GLint compileStatus;
glGetObjectParameterivARB(shaderObject,GL_OBJECT_COMPILE_STATUS_ARB,&compileStatus);
if(!compileStatus)
{
/* Get some more detailed information: */
GLcharARB compileLogBuffer[2048];
GLsizei compileLogSize;
glGetInfoLogARB(shaderObject,sizeof(compileLogBuffer),&compileLogSize,compileLogBuffer);
/* Signal an error: */
Misc::throwStdErr("glCompileShaderFromFile: Error \"%s\" while compiling shader %s",compileLogBuffer,shaderSourceFileName);
}
}
开发者ID:chebee7i,项目名称:Vrui,代码行数:46,代码来源:GLARBShaderObjects.cpp
示例13: initBuffer
bool initBuffer()
{
glGenBuffers(buffer::MAX, BufferName);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, BufferName[buffer::ELEMENT]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, ElementSize, ElementData, GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, BufferName[buffer::POSITION_INPUT]);
glBufferData(GL_ARRAY_BUFFER, PositionSize * 2, NULL, GL_STATIC_DRAW);
glBufferSubData(GL_ARRAY_BUFFER, 0, PositionSize, PositionData);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, BufferName[buffer::TEXCOORD_INPUT]);
glBufferData(GL_ARRAY_BUFFER, TexcoordSize * 2, TexcoordData, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, BufferName[buffer::COLOR_INPUT]);
glBufferData(GL_ARRAY_BUFFER, ColorSize * 2, ColorData, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, BufferName[buffer::POSITION_OUTPUT]);
glBufferData(GL_ARRAY_BUFFER, PositionSize * 2, NULL, GL_STATIC_COPY);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, BufferName[buffer::TEXCOORD_OUTPUT]);
glBufferData(GL_ARRAY_BUFFER, TexcoordSize * 2, NULL, GL_STATIC_COPY);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, BufferName[buffer::COLOR_OUTPUT]);
glBufferData(GL_ARRAY_BUFFER, ColorSize * 2, NULL, GL_STATIC_COPY);
glBindBuffer(GL_ARRAY_BUFFER, 0);
GLint UniformBufferOffset(0);
glGetIntegerv(
GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT,
&UniformBufferOffset);
GLint UniformBlockSize = glm::max(GLint(sizeof(glm::mat4)), UniformBufferOffset);
glBindBuffer(GL_UNIFORM_BUFFER, BufferName[buffer::TRANSFORM]);
glBufferData(GL_UNIFORM_BUFFER, UniformBlockSize, NULL, GL_DYNAMIC_DRAW);
glBindBuffer(GL_UNIFORM_BUFFER, 0);
return true;
}
开发者ID:alexa-infra,项目名称:ogl-samples,代码行数:45,代码来源:gl-430-program-compute-image.cpp
示例14: flags
void VertexData::use()
{
uint32_t flags(0);
for(auto& element : _vertexStreams)
{
flags = flags | (1 << element.second._stream._semantic);
}
GL::enableVertexAttribs(flags);
for(auto& element : _vertexStreams)
{
//glEnableVertexAttribArray((GLint)element.second._stream._semantic);
glBindBuffer(GL_ARRAY_BUFFER, element.second._buffer->getVBO());
glVertexAttribPointer(GLint(element.second._stream._semantic),element.second._stream._size,
element.second._stream._type,element.second._stream._normalize, element.second._buffer->getSizePerVertex(), (GLvoid*)element.second._stream._offset);
}
}
开发者ID:CatalystApps,项目名称:Cocos2dx_WP8ShaderCompiler,代码行数:18,代码来源:CCVertexIndexData.cpp
示例15: initBuffer
bool initBuffer()
{
GLint UniformBufferOffset(0);
glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &UniformBufferOffset);
GLint UniformBlockSize = glm::max(GLint(sizeof(glm::mat4)), UniformBufferOffset);
glm::vec4 Material0(1.0f, 0.5f, 0.0f, 1.0f);
glm::vec4 Material1(0.0f, 0.5f, 1.0f, 1.0f);
glCreateBuffers(buffer::MAX, &BufferName[0]);
glNamedBufferStorage(BufferName[buffer::VERTEX], VertexSize, VertexData, 0);
glNamedBufferStorage(BufferName[buffer::ELEMENT], ElementSize, ElementData, 0);
glNamedBufferStorage(BufferName[buffer::TRANSFORM], UniformBlockSize, nullptr, GL_MAP_WRITE_BIT);
glNamedBufferStorage(BufferName[buffer::MATERIAL0], sizeof(glm::vec4), &Material0[0], 0);
glNamedBufferStorage(BufferName[buffer::MATERIAL1], sizeof(glm::vec4), &Material1[0], 0);
return true;
}
开发者ID:g-truc,项目名称:ogl-samples,代码行数:18,代码来源:gl-500-conservative-raster-nv.cpp
示例16: initBuffer
bool initBuffer()
{
glGenBuffers(buffer::MAX, &BufferName[0]);
glBindBuffer(GL_ARRAY_BUFFER, BufferName[buffer::VERTEX]);
glBufferData(GL_ARRAY_BUFFER, VertexSize, VertexData, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
GLint UniformBufferOffset(0);
glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &UniformBufferOffset);
GLint UniformBlockSize = glm::max(GLint(sizeof(glm::mat4)), UniformBufferOffset);
glBindBuffer(GL_UNIFORM_BUFFER, BufferName[buffer::TRANSFORM]);
glBufferData(GL_UNIFORM_BUFFER, UniformBlockSize, NULL, GL_DYNAMIC_DRAW);
glBindBuffer(GL_UNIFORM_BUFFER, 0);
return this->checkError("initBuffer");
}
开发者ID:StephenAArredondo,项目名称:ogl-samples,代码行数:18,代码来源:gl-320-sync.cpp
示例17: initBuffer
bool initBuffer()
{
glGenBuffers(buffer::MAX, &BufferName[0]);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, BufferName[buffer::VERTEX]);
glBufferStorage(GL_SHADER_STORAGE_BUFFER, VertexSize, VertexData, 0);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
GLint UniformBufferOffset(0);
glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &UniformBufferOffset);
GLint UniformBlockSize = glm::max(GLint(sizeof(transform)), UniformBufferOffset);
glBindBuffer(GL_UNIFORM_BUFFER, BufferName[buffer::TRANSFORM]);
glBufferStorage(GL_UNIFORM_BUFFER, UniformBlockSize, nullptr, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
glBindBuffer(GL_UNIFORM_BUFFER, 0);
return true;
}
开发者ID:h3rb,项目名称:ogl-samples,代码行数:18,代码来源:gl-500-texture-cube-arb.cpp
示例18: initBuffer
bool initBuffer()
{
glGenBuffers(buffer::MAX, &BufferName[0]);
glBindBuffer(GL_ARRAY_BUFFER, BufferName[buffer::VERTEX]);
glBufferData(GL_ARRAY_BUFFER, PositionSize, &PositionData[0][0], GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
GLint UniformBufferOffset(0);
glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &UniformBufferOffset);
GLint UniformBlockSize = glm::max(GLint(sizeof(glm::mat4)), UniformBufferOffset);
glBindBuffer(GL_UNIFORM_BUFFER, BufferName[buffer::TRANSFORM]);
glBufferData(GL_UNIFORM_BUFFER, UniformBlockSize, nullptr, GL_DYNAMIC_DRAW);
glBindBuffer(GL_UNIFORM_BUFFER, 0);
return true;
}
开发者ID:NeilMonday,项目名称:ogl-samples,代码行数:18,代码来源:gl-430-query-occlusion.cpp
示例19: initTexture2D
bool initTexture2D()
{
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures(1, &Texture2DName);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, Texture2DName);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
// Set image
gli::texture2D Texture = gli::load(TEXTURE_DIFFUSE);
for(std::size_t Level = 0; Level < Texture.levels(); ++Level)
{
glTexImage2D(
GL_TEXTURE_2D,
GLint(Level),
GL_RGB,
GLsizei(Texture[Level].dimensions().x),
GLsizei(Texture[Level].dimensions().y),
0,
GL_BGR,
GL_UNSIGNED_BYTE,
NULL);
}
GLsizei TextureSize = GLsizei(Texture[0].dimensions().x) * GLsizei(Texture[0].dimensions().y) * 3;
glGenBuffers(1, &PixelBuffer);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, PixelBuffer);
glBufferData(GL_PIXEL_UNPACK_BUFFER, TextureSize, NULL, GL_STREAM_DRAW);
//void* Pointer = glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
void* Pointer = glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, TextureSize, GL_MAP_WRITE_BIT);
memcpy(Pointer, Texture[0].data(), TextureSize);
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, GLsizei(Texture[0].dimensions().x), GLsizei(Texture[0].dimensions().y), GL_BGR, GL_UNSIGNED_BYTE, NULL);
glDeleteBuffers(1, &PixelBuffer);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
return glf::checkError("initTexture2D");
}
开发者ID:spetz911,项目名称:vog,代码行数:44,代码来源:ogl-330-texture-streaming.cpp
示例20: StencilFuncSeparate
/**
* @glsymbols
* @glfunref{StencilFuncSeparate}
*/
static void StencilFuncSeparate(
Face face,
CompareFunction func,
GLint ref = GLint(0),
GLuint mask = ~GLuint(0)
)
{
OGLPLUS_GLFUNC(StencilFuncSeparate)(
GLenum(face),
GLenum(func),
ref,
mask
);
OGLPLUS_VERIFY(
StencilFuncSeparate,
Error,
EnumParam(func)
);
}
开发者ID:MaikKlein,项目名称:OglplusGen,代码行数:23,代码来源:stencil_test.hpp
注:本文中的GLint函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论