當前位置: 首頁>>代碼示例>>C++>>正文


C++ GLuint函數代碼示例

本文整理匯總了C++中GLuint函數的典型用法代碼示例。如果您正苦於以下問題:C++ GLuint函數的具體用法?C++ GLuint怎麽用?C++ GLuint使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GLuint函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的GLuint函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。