本文整理汇总了C++中GLuint函数的典型用法代码示例。如果您正苦于以下问题:C++ GLuint函数的具体用法?C++ GLuint怎么用?C++ GLuint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GLuint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: init2DTexture
void init2DTexture(const graphics::Context::InitTextureParams & _params) override
{
if (_params.msaaLevel == 0) {
if (m_handle != _params.handle) {
m_handle = _params.handle;
glTextureStorage2D(GLuint(_params.handle),
_params.mipMapLevels,
GLenum(_params.internalFormat),
_params.width,
_params.height);
}
if (_params.data != nullptr) {
glTextureSubImage2D(GLuint(_params.handle),
_params.mipMapLevel,
0, 0,
_params.width,
_params.height,
GLuint(_params.format),
GLenum(_params.dataType),
_params.data);
}
}
else {
glTexStorage2DMultisample(GLuint(_params.handle),
_params.msaaLevel,
GLenum(_params.internalFormat),
_params.width,
_params.height,
GL_FALSE);
}
}
开发者ID:IlDucci,项目名称:GLideN64,代码行数:33,代码来源:opengl_TextureManipulationObjectFactory.cpp
示例2: GLuint
void ClusteredLightManager::buildClustering() {
GLuint index = 0;
glm::uvec4 affected_tiles;
glm::uvec3 frustrum_begin;
glm::uvec3 frustrum_end;
for (const world::PointLight* light : this->world.p_lights) {
// calculate tiles effected by light if false then no tiles are affected
// and it can be skipped
if (this->projector.computeProjection(*light,
this->view.camera,
this->view.viewport,
this->tile_size,
affected_tiles)) {
frustrum_begin.x = affected_tiles.x;
frustrum_begin.y = affected_tiles.y;
frustrum_end.x = affected_tiles.z;
frustrum_end.y = affected_tiles.w;
// calculate z_value of light in camera space
glm::vec4 light_camera_pos = view.camera.getLookAt() * light->position;
frustrum_begin.z = GLuint(std::max(int(floor(log(-(light_camera_pos.z + light->radius) / view.camera.getDepthrange().x) * this->k_inv_denominator)), 0));
frustrum_end.z = GLuint(std::max(int(floor(log(-(light_camera_pos.z - light->radius) / view.camera.getDepthrange().x) * this->k_inv_denominator)), 0));
this->light_clustering.incrementLight(frustrum_begin,
frustrum_end,
index);
}
index++;
}
}
开发者ID:BeardedPlatypus,项目名称:nTiled_new,代码行数:32,代码来源:ClusteredLightManager.cpp
示例3: snprintf
void RevolverTool::DataItem::writeNumber(const Point& position,int number)
{
/* Convert the number to a string: */
char buffer[20];
snprintf(buffer,sizeof(buffer),"%d",number);
/* Calculate the number's width: */
GLfloat width=-spacing;
for(const char* bPtr=buffer;*bPtr!='\0';++bPtr)
{
int index=*bPtr=='-'?10:int(*bPtr)-int('0');
width+=digitWidths[index];
width+=spacing;
}
/* Write the number: */
glPushMatrix();
glTranslated(position[0]-width*0.5f,position[1],position[2]-digitHeight*0.5f);
for(const char* bPtr=buffer;*bPtr!='\0';++bPtr)
{
GLuint index=*bPtr=='-'?GLuint(10):GLuint(*bPtr)-GLuint('0');
glCallList(digitListBase+index);
glTranslatef(digitWidths[index]+spacing,0.0f,0.0f);
}
glPopMatrix();
}
开发者ID:jrevote,项目名称:3DA-Vrui,代码行数:28,代码来源:RevolverTool.cpp
示例4: getUniformLocation
uint QGLEngineShaderManager::getUniformLocation(Uniform id)
{
QVector<uint> &uniformLocations = currentShaderProg->uniformLocations;
if (uniformLocations.isEmpty())
uniformLocations.fill(GLuint(-1), NumUniforms);
static const char *uniformNames[] = {
"imageTexture",
"patternColor",
"globalOpacity",
"depth",
"pmvMatrix",
"maskTexture",
"fragmentColor",
"linearData",
"angle",
"halfViewportSize",
"fmp",
"fmp2_m_radius2",
"inverse_2_fmp2_m_radius2",
"invertedTextureSize",
"brushTransform",
"brushTexture"
};
if (uniformLocations.at(id) == GLuint(-1))
uniformLocations[id] = currentShaderProg->program->uniformLocation(uniformNames[id]);
return uniformLocations.at(id);
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:30,代码来源:qglengineshadermanager.cpp
示例5: VertexAttribIOffset
/**
* @glsymbols
* @glfunref{VertexArrayVertexAttribIOffsetEXT}
*/
const ObjectOps& VertexAttribIOffset(
BufferName buffer,
VertexAttribSlot location,
GLint values_per_vertex,
DataType data_type,
GLsizei stride,
GLintptr offset
) const
{
OGLPLUS_GLFUNC(VertexArrayVertexAttribIOffsetEXT)(
_name,
GetGLName(buffer),
GLuint(location),
values_per_vertex,
GLenum(data_type),
stride,
offset
);
OGLPLUS_CHECK(
VertexArrayVertexAttribIOffsetEXT,
ObjectError,
Object(*this).
Index(GLuint(location))
);
return *this;
}
开发者ID:zhengxiuyu,项目名称:PCISPH,代码行数:30,代码来源:vertex_array.hpp
示例6: SpectraRenderer
SpectraDefaultRenderer::SpectraDefaultRenderer(
SpectraApp& app,
const std::shared_ptr<SpectraSharedObjects>& sh_obj,
const std::shared_ptr<SpectraVisualisation>& doc_vis,
wxGLCanvas* canvas
): SpectraRenderer(app, sh_obj, doc_vis, canvas)
, doc_vis_prog(Common().BuildProgram("default_doc_vis.prog"))
, doc_vis_projection_matrix(doc_vis_prog, "ProjectionMatrix")
, doc_vis_camera_matrix(doc_vis_prog, "CameraMatrix")
, doc_vis_stretch_matrix(doc_vis_prog, "StretchMatrix")
, doc_vis_transf_matrix(doc_vis_prog, "TransfMatrix")
, doc_vis_spectrum_tex(doc_vis_prog, "SpectrumTex")
, doc_vis_spectrum_size(doc_vis_prog, "SpectrumSize")
, doc_vis_samples_per_unit(doc_vis_prog, "SamplesPerUnit")
, doc_vis_selected_time(doc_vis_prog, "SelectedTime")
, doc_vis_selection_begin(doc_vis_prog, "SelectionBegin")
, doc_vis_selection_end(doc_vis_prog, "SelectionEnd")
, spectrum_plane_wrap(
Common().SpectrumPlane(
GLuint(DocVis().GridSamples()),
GLuint(DocVis().SignalSpectrumSize())
)
), spectrum_plane_vao(spectrum_plane_wrap.VAOForProgram(doc_vis_prog))
, vis_cue_prog(Common().BuildProgram("default_vis_cue.prog"))
, vis_cue_projection_matrix(vis_cue_prog, "ProjectionMatrix")
, vis_cue_camera_matrix(vis_cue_prog, "CameraMatrix")
, vis_cue_stretch_matrix(vis_cue_prog, "StretchMatrix")
, vis_cue_transf_matrix(vis_cue_prog, "TransfMatrix")
, vis_cue_color(vis_cue_prog, "Color")
, vis_cue_alpha(vis_cue_prog, "Alpha")
, ground_grid_vao(Common().GroundUnitGrid().VAOForProgram(vis_cue_prog))
, wall_grid_vao(Common().WallUnitGrid().VAOForProgram(vis_cue_prog))
{
CacheBgColor();
}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:35,代码来源:default_renderer.cpp
示例7: assert
Object::~Object()
{
assert(this->vertex_array_handle == GLuint(-1));
assert(this->vertex_data_handle == GLuint(-1));
assert(this->normal_array_handle == GLuint(-1));
assert(this->normal_data_handle == GLuint(-1));
}
开发者ID:acrlakshman,项目名称:BasicModelViewer,代码行数:7,代码来源:Object.cpp
示例8: GLuint
void gfx::BloomProgram::Render(){
//Do brightpass
ShaderProgram* prog = g_ShaderBank.GetProgramFromHandle(m_BrightPassShader);
prog->Apply();
const int WORK_GROUP_SIZE = 32;
GLuint WorkGroupSizeX = GLuint((m_Width + WORK_GROUP_SIZE - 1) / float(WORK_GROUP_SIZE));
GLuint WorkGroupSizeY = GLuint((m_Height + WORK_GROUP_SIZE - 1) / float(WORK_GROUP_SIZE));
prog->SetUniformTextureHandle("g_Image", m_TargetTex, 1);
prog->SetUniformVec2("g_ScreenSize", glm::vec2(m_Width, m_Height));
prog->SetUniformFloat("g_Threshold", 0.4f);
prog->SetUniformFloat("g_Smoothness", 0.8f);
glBindImageTexture(0, m_BloomTexture, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA8);
glDispatchCompute(WorkGroupSizeX, WorkGroupSizeY, 1);
//blur result
m_BlurProgram->Render();
//add to final target
prog = g_ShaderBank.GetProgramFromHandle(m_BloomShader);
prog->Apply();
prog->SetUniformTextureHandle("g_BluredBloomTex", m_BlurProgram->GetBluredTexture(), 1);
prog->SetUniformTextureHandle("g_ColorBuffer", m_TargetTex, 2);
prog->SetUniformVec2("g_ScreenSize", glm::vec2(m_Width, m_Height));
glBindImageTexture(0, m_BloomTexture, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA8);
glDispatchCompute(WorkGroupSizeX, WorkGroupSizeY, 1);
}
开发者ID:toimelin,项目名称:gameenginecourse2015,代码行数:25,代码来源:BloomProgram.cpp
示例9: BindLocation
/**
* @see GetLocation
* @see QueryLocation
*
* @glsymbols
* @glfunref{BindFragDataLocation}
*/
static void BindLocation(
ProgramName program, FragDataSlot location, StrCRef identifier) {
OGLPLUS_GLFUNC(BindFragDataLocation)
(GetGLName(program), GLuint(location), identifier.c_str());
OGLPLUS_CHECK(
BindFragDataLocation,
ProgVarError,
Program(program).Identifier(identifier).Index(GLuint(location)));
}
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:16,代码来源:frag_data.hpp
示例10: GLuint
void Object::InternalInitialize()
{
this->vertex_array_handle = GLuint(-1);
this->vertex_data_handle = GLuint(-1);
this->vertex_indices_handle = GLuint(-1);
this->vertex_indices_wire_frame_handle = GLuint(-1);
/* TODO: Enable normals too */
this->normal_array_handle = this->normal_data_handle = this->normal_indices_handle = GLuint(-1);
}
开发者ID:acrlakshman,项目名称:BasicModelViewer,代码行数:11,代码来源:Object.cpp
示例11: glDeleteVertexArrays
void Object::takeDown() {
if (this->vertexArrayHandle != GLuint(-1)) {
glDeleteVertexArrays(1, &this->vertexArrayHandle);
}
if (this->vertexBufferHandle != GLuint(-1)) {
glDeleteBuffers(1, &this->vertexBufferHandle);
}
this->vertexArrayHandle = this->vertexBufferHandle = GLuint(-1);
}
开发者ID:beamery,项目名称:3D-Texture-Synthesis,代码行数:11,代码来源:Object.cpp
示例12: run_loop
void run_loop(
std::unique_ptr<Example>& example,
GLuint width,
GLuint height
)
{
GLuint mouse_x = width / 2;
GLuint mouse_y = height / 2;
os::steady_clock os_clock;
ExampleClock clock;
while(true)
{
clock.Update(os_clock.seconds());
if(!example->Continue(clock)) break;
example->Render(clock);
glfwSwapBuffers();
int new_x, new_y;
glfwGetWindowSize(&new_x, &new_y);
if((int(width) != new_x) || (int(height) != new_y))
{
if(new_x <= 0) new_x = 1;
if(new_y <= 0) new_y = 1;
width = GLuint(new_x);
height = GLuint(new_y);
example->Reshape(width, height);
}
glfwGetMousePos(&new_x, &new_y);
if((int(mouse_x) != new_x) || (int(mouse_y) != new_y))
{
if(new_x <= 0) new_x = 1;
if(new_y <= 0) new_y = 1;
mouse_x = GLuint(new_x);
mouse_y = GLuint(new_y);
example->MouseMove(
mouse_x,
height-
mouse_y,
width,
height
);
}
if(glfwGetKey(GLFW_KEY_ESC))
{
glfwCloseWindow();
break;
}
if(!glfwGetWindowParam(GLFW_OPENED))
break;
}
}
开发者ID:BrainlessLabsInc,项目名称:oglplus,代码行数:54,代码来源:glfw_main.cpp
示例13: GLuint
void ComputeShaderChunk::changeFrom(DrawEnv *pEnv,
StateChunk *pOther,
UInt32 uiIdx)
{
ComputeShaderChunk *pOld = dynamic_cast<ComputeShaderChunk *>(pOther);
// pOther can be a ShaderExecutableChunk, since we share the StateClass id
// with it
if(pOld != NULL)
{
Window *pWin = pEnv->getWindow();
GLuint uiProgId = GLuint(pWin->getGLObjectId(getGLId()));
UInt32 uiDep = ShaderProcVariable::SHDObject;
if(uiProgId != pEnv->getActiveShader())
{
UInt32 uiValRes = pWin->validateGLObject(getGLId(),
pEnv,
KeepProgActive);
uiProgId = GLuint(pWin->getGLObjectId(getGLId()));
if(uiProgId == 0)
return;
pEnv->setActiveShader(uiProgId);
if(0x0000 == (uiValRes & ProgActive))
{
OSGGETGLFUNCBYID_GL3_ES(glUseProgram,
osgGlUseProgram,
ShaderProgram::getFuncIdUseProgram(),
pWin);
osgGlUseProgram(uiProgId);
}
uiDep = ShaderProcVariable::SHDAll;
pEnv->incNumShaderChanges();
}
updateProceduralVariables(pEnv, uiDep);
}
else
{
pOther->deactivate(pEnv, uiIdx);
activate (pEnv, uiIdx);
pEnv->incNumShaderChanges();
}
}
开发者ID:jondo2010,项目名称:OpenSG,代码行数:53,代码来源:OSGComputeShaderChunk.cpp
示例14: InstructionsWithAdjacency
/// Returns the instructions for rendering
DrawingInstructions InstructionsWithAdjacency(void) const
{
const unsigned n = _divisions;
DrawOperation operation;
operation.method = DrawOperation::Method::DrawElements;
operation.mode = PrimitiveType::TrianglesAdjacency;
operation.first = GLuint(0);
operation.count = GLuint(n*n*n*6*6);
operation.restart_index = DrawOperation::NoRestartIndex();
operation.phase = 0;
return this->MakeInstructions(operation);
}
开发者ID:GLDRorg,项目名称:oglplus,代码行数:13,代码来源:tetrahedrons.hpp
示例15: update2DTexture
void update2DTexture(const graphics::Context::UpdateTextureDataParams & _params) override
{
glTextureSubImage2D(GLuint(_params.handle),
_params.mipMapLevel,
_params.x,
_params.y,
_params.width,
_params.height,
GLuint(_params.format),
GLenum(_params.dataType),
_params.data);
}
开发者ID:IlDucci,项目名称:GLideN64,代码行数:12,代码来源:opengl_TextureManipulationObjectFactory.cpp
示例16: ST_DEBUG_ASSERT
bool StGLMesh::computeNormals(size_t theDelta) {
ST_DEBUG_ASSERT(theDelta > 0);
myNormals.initArray(myVertices.size());
if(myVertices.isEmpty()) {
return false;
}
// iterate over each triangle
// for each node we compute summary of normals for all triangles where this node used
// normals are NOT normalized per triangle - this allows to interpolate result normal
// with respect to each triangle dimensions
GLuint aV1, aV2, aV3;
StGLVec3 aNorm;
if(myIndices.size() >= 3) {
size_t aLimit = myIndices.size() - 3;
for(size_t anIndexId = 0; anIndexId <= aLimit; anIndexId += theDelta) {
aV1 = myIndices[anIndexId];
aV2 = myIndices[anIndexId + 1];
aV3 = myIndices[anIndexId + 2];
const StGLVec3& aVert1 = myVertices[aV1];
const StGLVec3& aVert2 = myVertices[aV2];
const StGLVec3& aVert3 = myVertices[aV3];
aNorm = StGLVec3::cross(aVert2 - aVert1, aVert3 - aVert1);
myNormals.changeValue(aV1) += aNorm;
myNormals.changeValue(aV2) += aNorm;
myNormals.changeValue(aV3) += aNorm;
}
} else if(myVertices.size() >= 3) {
size_t aLimit = myVertices.size() - 3;
for(size_t aVertId = 0; aVertId <= aLimit; aVertId += theDelta) {
aV1 = GLuint(aVertId);
aV2 = GLuint(aVertId + 1);
aV3 = GLuint(aVertId + 2);
const StGLVec3& aVert1 = myVertices[aV1];
const StGLVec3& aVert2 = myVertices[aV2];
const StGLVec3& aVert3 = myVertices[aV3];
aNorm = StGLVec3::cross(aVert2 - aVert1, aVert3 - aVert1);
myNormals.changeValue(aV1) += aNorm;
myNormals.changeValue(aV2) += aNorm;
myNormals.changeValue(aV3) += aNorm;
}
} else {
return false;
}
// normalize normals (important for OpenGL)
for(size_t aNormId = 0; aNormId < myNormals.size(); ++aNormId) {
myNormals.changeValue(aNormId).normalize();
}
return true;
}
开发者ID:KindDragon,项目名称:sview,代码行数:51,代码来源:StGLMesh.cpp
示例17: drawOverWater
void Terrain::drawOverWater(){
// bind textures
material->use();
for (int i=0; i<TERRAIN_TEX_COUNT; i++){
textureManager->bindTexture(textureIds[i], GL_TEXTURE0+GLuint(i));
}
textureManager->bindTexture(textureManager->shadowMapID, GL_TEXTURE0+GLuint(7));
shader->use(true);
shader->setUniform4v(border_values_location, g_terrain_border_values);
shader->setUniform4v(border_widths_location, g_terrain_border_widths);
shader->setUniform2f(heightInterval_location, WATER_HEIGHT, 1000.f);
shader->setBoolean(fastModeLoc, g_fastMode);
shader->setBoolean(shadowMappingEnabledLoc, g_ShadowMappingEnabled);
shader->setUniformMatrix(LCmatrixLoc, g_LightMVPCameraVInverseMatrix );
shader->setUniformMatrix(LMV_CVImatrixLoc, g_LightMVCameraVInverseMatrix );
shader->setUniformMatrix(LPmatrixLoc, g_LightPMatrix );
// bind index buffer
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,eboId);
glBindBuffer(GL_ARRAY_BUFFER, vboId);
// enable states
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
// draw VBOs...
glVertexPointer(channels[VERTEX], glTypes[VERTEX], 0, BUFFER_OFFSET(offsets[VERTEX]));
glNormalPointer(glTypes[NORMAL], 0, BUFFER_OFFSET( offsets[NORMAL] ) );
glActiveTexture(GL_TEXTURE0);
glClientActiveTexture(GL_TEXTURE0);
glTexCoordPointer(channels[TEXCOORD0], glTypes[TEXCOORD0], 0, BUFFER_OFFSET(offsets[TEXCOORD0]));
glDrawElements(GL_TRIANGLE_STRIP, eboCount, GL_UNSIGNED_INT, BUFFER_OFFSET(offsets[INDEX]));
// disable
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
// unbind buffers
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
// unbind textures
for (int i=0; i<TERRAIN_TEX_COUNT; i++){
textureManager->unbindTexture(textureIds[i]);
}
// turn off shader
shader->use(false);
flip = false;
}
开发者ID:kidd32pg,项目名称:natureal,代码行数:51,代码来源:Terrain.cpp
示例18: Binding
/**
* @glsymbols
* @glfunref{UniformBlockBinding}
*/
void Binding(UniformBufferBindingPoint binding)
{
OGLPLUS_GLFUNC(UniformBlockBinding)(
this->_program,
this->_location,
GLuint(binding)
);
OGLPLUS_VERIFY(
UniformBlockBinding,
ProgVarError,
Program(ProgramName(this->_program)).
Index(GLuint(binding))
);
}
开发者ID:Simmesimme,项目名称:oglplus,代码行数:18,代码来源:uniform_block.hpp
示例19: DisableVertexAttrib
/**
* @glsymbols
* @glfunref{DisableVertexArrayAttribEXT}
*/
const ObjectOps& DisableVertexAttrib(VertexAttribSlot location)
{
OGLPLUS_GLFUNC(DisableVertexArrayAttribEXT)(
_name,
GLuint(location)
);
OGLPLUS_CHECK(
DisableVertexArrayAttribEXT,
ObjectError,
Object(*this).
Index(GLuint(location))
);
return *this;
}
开发者ID:zhengxiuyu,项目名称:PCISPH,代码行数:18,代码来源:vertex_array.hpp
示例20: glDepthMask
void SSAO::Update(const FrameBuffer *FBO, const Camera *camera) const
{
ssaoFBO.Bind();
glDepthMask(GL_FALSE);
glDisable(GL_DEPTH_TEST);
Shader *ssao = Manager::Shader->GetShader("ssao");
ssao->Use();
ssao->BindTexturesUnits();
ssaoFBO.SendResolution(ssao);
camera->BindViewMatrix(ssao->loc_view_matrix);
camera->BindProjectionMatrix(ssao->loc_projection_matrix);
camera->BindProjectionDistances(ssao);
glUniform1f(ssao->loc_u_rad, radius);
glUniform1i(ssao->loc_kernel_size, kernelSize);
glUniform3fv(ssao->loc_kernel, kernelSize * 3, glm::value_ptr(kernel[0]));
FBO->BindTexture(3, GL_TEXTURE0);
FBO->BindTexture(4, GL_TEXTURE1);
FBO->BindDepthTexture(GL_TEXTURE2);
RandomNoise1->BindToTextureUnit(GL_TEXTURE3);
RandomNoise2->BindToTextureUnit(GL_TEXTURE4);
ScreenQuad->Render(ssao);
// Finish TASK
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
FrameBuffer::Unbind();
// -- COMPUTE SHADER
int WORK_GROUP_SIZE = 16;
auto res = ssaoFBO.GetResolution();
Shader *S = Manager::Shader->GetShader("ssaoBlur");
S->Use();
// First Pass
ssaoFBO.BindTexture(0, GL_TEXTURE0);
glBindImageTexture(1, computeTexture->GetTextureID(), 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA16F);
glDispatchCompute(GLuint(UPPER_BOUND(res.x, WORK_GROUP_SIZE)), GLuint(UPPER_BOUND(res.y, WORK_GROUP_SIZE)), 1);
glMemoryBarrier(GL_ALL_BARRIER_BITS);
}
开发者ID:IHaveABoom,项目名称:OpenGL4.5-GameEngine,代码行数:48,代码来源:SSAO.cpp
注:本文中的GLuint函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论