当前位置: 首页>>代码示例>>C++>>正文


C++ SetViewport函数代码示例

本文整理汇总了C++中SetViewport函数的典型用法代码示例。如果您正苦于以下问题:C++ SetViewport函数的具体用法?C++ SetViewport怎么用?C++ SetViewport使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SetViewport函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LoadVertexShader

void OBS::DrawPreview(const Vect2 &renderFrameSize, const Vect2 &renderFrameOffset, const Vect2 &renderFrameCtrlSize, int curRenderTarget, PreviewDrawType type)
{
    LoadVertexShader(mainVertexShader);
    LoadPixelShader(mainPixelShader);

    Ortho(0.0f, renderFrameCtrlSize.x, renderFrameCtrlSize.y, 0.0f, -100.0f, 100.0f);
    if(type != Preview_Projector
       && (renderFrameCtrlSize.x != oldRenderFrameCtrlWidth
           || renderFrameCtrlSize.y != oldRenderFrameCtrlHeight))
    {
        // User is drag resizing the window. We don't recreate the swap chains so our coordinates are wrong
        SetViewport(0.0f, 0.0f, (float)oldRenderFrameCtrlWidth, (float)oldRenderFrameCtrlHeight);
    }
    else
        SetViewport(0.0f, 0.0f, renderFrameCtrlSize.x, renderFrameCtrlSize.y);

    // Draw background (Black if fullscreen/projector, window colour otherwise)
    if(type == Preview_Fullscreen || type == Preview_Projector)
        ClearColorBuffer(0x000000);
    else
        ClearColorBuffer(GetSysColor(COLOR_BTNFACE));

    if(bTransitioning)
    {
        BlendFunction(GS_BLEND_ONE, GS_BLEND_ZERO);
        DrawSprite(transitionTexture, 0xFFFFFFFF,
                renderFrameOffset.x, renderFrameOffset.y,
                renderFrameOffset.x + renderFrameSize.x, renderFrameOffset.y + renderFrameSize.y);
        BlendFunction(GS_BLEND_FACTOR, GS_BLEND_INVFACTOR, transitionAlpha);
    }

    DrawSprite(mainRenderTextures[curRenderTarget], 0xFFFFFFFF,
            renderFrameOffset.x, renderFrameOffset.y,
            renderFrameOffset.x + renderFrameSize.x, renderFrameOffset.y + renderFrameSize.y);
}
开发者ID:kusl,项目名称:OBS,代码行数:35,代码来源:OBSVideoCapture.cpp

示例2: UpdateKinectDepthData

	int KungFuPOC::ProcessApplication()
	{
		if (WaitForSingleObject(kinectController.DepthStreamEvent(), 0) == WAIT_OBJECT_0)
			UpdateKinectDepthData();

		if (WaitForSingleObject(kinectController.ColorStreamEvent(), 0) == WAIT_OBJECT_0)
			UpdateKinectColorData();

		deviceContext->OMSetRenderTargets(1, &backBufferView, depthStencilView);
		SetViewport(0, 0, (float)windowWidth, (float)windowHeight);

		deviceContext->ClearRenderTargetView(backBufferView, backgroundColor);
		deviceContext->ClearDepthStencilView(depthStencilView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0, 0);
		deviceContext->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

		if (WaitForSingleObject(kinectController.SkeletonStreamEvent(), 0) == WAIT_OBJECT_0)
			UpdateKinectSkeletonData();		

		deviceContext->OMSetRenderTargets(1, &backBufferView, depthStencilView);
		SetViewport(0, 0, (float)windowWidth, (float)windowHeight);

		jointMaterial->SetProjectionMatrix(projection);
		painting->SetProjectionMatrix(projection);

		colorDisplay->Draw();
		depthDisplay->Draw();
		painting->Render(deviceContext);		
		meshInstance->Render(deviceContext);

		swapChain->Present(0, 0);
	
		return 0;
	}
开发者ID:pagienet,项目名称:psyko-kinect-poc,代码行数:33,代码来源:KungFuPOC.cpp

示例3: RenderFrameDX10

void RenderFrameDX10(void)
{
	Matrix4x4 view_matrix = g_Control.GetViewMatrix();
	Matrix4x4 world_matrix = g_Control.GetObjectMatrix();

	Vector4 vClearColor(0.0f, 0.0f, 0.0f, 0.0f);

	UINT stride = sizeof(Vertex_VT);
	UINT offset = 0;

	ID3D10RenderTargetView *pRenderTargetView = GutGetDX10RenderTargetView();
	ID3D10DepthStencilView *pDepthStencilView = GutGetDX10DepthStencilView();

	g_pDevice->OMSetRenderTargets(1, &g_pRTView[FULLSIZE], pDepthStencilView);
	g_pDevice->ClearRenderTargetView(g_pRTView[FULLSIZE], &vClearColor[0]);
	g_pDevice->ClearDepthStencilView(pDepthStencilView, D3D10_CLEAR_DEPTH|D3D10_CLEAR_STENCIL, 1.0f, 0);

	SetViewport(FULLSIZE);

	CGutModel_DX10::SetViewMatrix(view_matrix);
	CGutModel_DX10::SetWorldMatrix(world_matrix);
	CGutModel_DX10::SetProjectionMatrix(g_proj_matrix);
	CGutModel_DX10::UpdateMatrix();

	g_Model_DX10.Render();

	ConvertToLuminance();
	Average();

	AdaptiveLuminance();
	AutoExposure();

	if ( g_iMode & 0x01 )
	{
		g_pDevice->OMSetRenderTargets(1, &pRenderTargetView, pDepthStencilView);
		SetViewport(FULLSIZE);

		float x = -1.0f;
		float y = -1.0f;
		float w = 0.2f;
		float h = 0.2f;

		DrawImage(g_pSRView[LUMINANCE_CURRENT], x, y, w, h);
		x+=w;
		DrawImage(g_pSRView[LUMINANCE_PREVIOUS], x, y, w, h);
		x+=w;
	}

	// 等待硬體掃結束, 然後才更新畫面
	IDXGISwapChain *pSwapChain = GutGetDX10SwapChain();
	pSwapChain->Present(1, 0);
}
开发者ID:chenbk85,项目名称:3dlearn,代码行数:52,代码来源:render_dx10.cpp

示例4: RenderDynamic

void RenderDynamic()
{
	static float t = 0.0;
	SetWindow(-1.0,1.0,-1.0,1.0);
	/*SetViewport(0,100,0,100);
	RenderPoly(Tree,11);
	SetViewport(500,600,0,100);
	RenderPoly(F,11);*/
	/*for(float t = 0.0; t<= 1.0; t+= 0.1)
	{
	SetViewport(t*1000,(t+0.1)*1000,0,100);
	RenderTween(Tree,F,11,t);
	}*/
	SetViewport(0,480,0,480);
	RenderTween(Tree,F,11,t);
	static bool down = false;
	if(t>=1.0)
	{
		down = true;

	}else if(t<=0.0)
	{
		down = false;
	}
	if(down)
		t -= 0.001;
	else 
		t += 0.001;
}
开发者ID:pythonxy,项目名称:Computer-Graphics,代码行数:29,代码来源:main.cpp

示例5: RenderInOrOuter

void RenderInOrOuter()
{
	SetWindow(-2.0,2.0,-2.0,2.0);
	SetViewport(0,480,0,480);
	DrawPolygon();
	testQ();
}
开发者ID:pythonxy,项目名称:Computer-Graphics,代码行数:7,代码来源:main.cpp

示例6: SetViewport

void ShaderPass::BeginGraphics()
{
    if (Viewport.Width == 0 || Viewport.Height == 0)
    {
        // Reset based on RenderTarget
        SetViewport(nullptr);
    }

    Context->OMSetRenderTargets(_countof(RenderTargets), RenderTargets, DepthBuffer.Get());

    Context->OMSetDepthStencilState(DepthState.Get(), 0);
    Context->RSSetViewports(1, &Viewport);

    Context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
    Context->IASetInputLayout(InputLayouts[(uint32_t)CurrentInputBinding].Get());

    Context->VSSetShader(VertexShader.Get(), nullptr, 0);
    Context->VSSetConstantBuffers(0, _countof(VSCSConstants), VSCSConstants);
    Context->VSSetShaderResources(0, _countof(VSCSResources), VSCSResources);
    Context->VSSetSamplers(0, _countof(VSSamplers), VSSamplers);

    Context->PSSetShader(PixelShader.Get(), nullptr, 0);
    if (PixelShader)
    {
        Context->PSSetConstantBuffers(0, _countof(PSConstants), PSConstants);
        Context->PSSetShaderResources(0, _countof(PSResources), PSResources);
        Context->PSSetSamplers(0, _countof(PSSamplers), PSSamplers);
    }

    Context->CSSetShader(nullptr, nullptr, 0);
}
开发者ID:rezanour,项目名称:rendering,代码行数:31,代码来源:ShaderPass.cpp

示例7: RenderDynamic

void RenderDynamic()
{
    static float t = 0.0;
    SetWindow(-1.0,1.0,-1.0,1.0);
    SetViewport(0,480,0,480);

}
开发者ID:pythonxy,项目名称:Computer-Graphics,代码行数:7,代码来源:main.cpp

示例8: SetViewport

void RenderSystem_GL30::UpdateViewport()
{
	DisplayManager *dm = DisplayManager::GetSingleton();
	SetViewport(dm->GetViewport());
	glm::vec4 view = GetViewport();
	glViewport((GLsizei)view.x, (GLsizei)view.y, (GLsizei)view.z, (GLsizei)view.w);
}
开发者ID:spigwitmer,项目名称:opengrind,代码行数:7,代码来源:render_system_gl30.cpp

示例9: offset

	void KungFuPOC::UpdateKinectSkeletonData()
	{
		float3 offset(0.0, 0.0, 0.0);
		
		SkeletonData data;
		kinectController.GetSkeletonData(&data);
		int skeletonIndex = GetActiveSkeleton(data.skeletonData);
		if (skeletonIndex < 0) return;

		NUI_SKELETON_DATA skeleton = data.skeletonData[skeletonIndex];
		Vector4* positions = skeleton.SkeletonPositions;
		
		float dz = 0.0;
		for (int i = 0; i != NUI_SKELETON_POSITION_COUNT; ++i) {			
			Vector4& pos = positions[i];
			pos.z = -pos.z;
			// don't let player come too close to the painting!
			if (i == 0) {
				if (pos.z > PAINTING_Z - MINIMUM_PLAYER_DISTANCE) {
					dz = pos.z - (PAINTING_Z - MINIMUM_PLAYER_DISTANCE);
				}
			}
			pos.z -= dz;
		}

		stickFigureMesh->Update(deviceContext, positions);

		matrix4x4 projectionMtx = XMLoadFloat4x4(&projection);
		for (auto it = paintLogics.begin(); it != paintLogics.end(); ++it) {
			deviceContext->OMSetRenderTargets(1, &backBufferView, depthStencilView);
			SetViewport(0, 0, (float)windowWidth, (float)windowHeight);
			(*it)->Update(projectionMtx, deviceContext, positions);
		}
	}
开发者ID:pagienet,项目名称:psyko-kinect-poc,代码行数:34,代码来源:KungFuPOC.cpp

示例10: BeginSession

void nuiGLPainter::StartRendering()
{
  BeginSession();
  //NUI_RETURN_IF_RENDERING_DISABLED;
  nuiCheckForGLErrors();

  mScissorX = -1;
  mScissorY = -1;
  mScissorW = -1;
  mScissorH = -1;
  mScissorOn = false;
  
  nuiPainter::StartRendering();
  
  SetViewport();
  glLoadIdentity();

  glDisable(GL_DEPTH_TEST);
  glDisable(GL_SCISSOR_TEST);
  glDisable(GL_TEXTURE_2D);

#ifndef _OPENGL_ES_
  if (mCanRectangleTexture == 2)
  {
    glDisable(GL_TEXTURE_RECTANGLE_ARB);
  }
#endif

  glDisable(GL_STENCIL_TEST);
  glDisable(GL_BLEND);
  glDisable(GL_ALPHA_TEST);
  glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
  BlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
  nuiCheckForGLErrors();
}
开发者ID:jpastuszek,项目名称:nui3,代码行数:35,代码来源:nuiGLPainter.cpp

示例11: SetViewport

void nuiGLPainter::PopProjectionMatrix()
{
  NUI_RETURN_IF_RENDERING_DISABLED;
  
  nuiPainter::PopProjectionMatrix();
  SetViewport();
}
开发者ID:jpastuszek,项目名称:nui3,代码行数:7,代码来源:nuiGLPainter.cpp

示例12: SetViewport

HRESULT CBRenderer::SetViewport(RECT* Rect)
{
    return SetViewport(	Rect->left + m_DrawOffsetX,
                        Rect->top + m_DrawOffsetY,
                        Rect->right + m_DrawOffsetX,
                        Rect->bottom + m_DrawOffsetY);
}
开发者ID:segafan,项目名称:wmelite_hcdaniel-repo,代码行数:7,代码来源:BRenderer.cpp

示例13: SetViewport

void wxGLCanvas::MacUpdateView()
{
    if (m_glContext)
    {
        SetViewport();
    }
}
开发者ID:EdgarTx,项目名称:wx,代码行数:7,代码来源:glcanvas.cpp

示例14: gld_Viewport_DX7

void gld_Viewport_DX7(
	struct gl_context *ctx,
	GLint x,
	GLint y,
	GLsizei w,
	GLsizei h)
{
	GLD_context		*gldCtx	= GLD_GET_CONTEXT(ctx);
	GLD_driver_dx7	*gld	= GLD_GET_DX7_DRIVER(gldCtx);

	D3DVIEWPORT7	d3dvp;

	if (!gld || !gld->pDev)
		return;

	// This is a hack. When the app is minimized, Mesa passes
	// w=1 and h=1 for viewport dimensions. Without this test
	// we get a GPF in gld_wgl_resize_buffers().
	if ((w==1) && (h==1))
		return;

	// Call ResizeBuffersMESA. This function will early-out
	// if no resize is needed.
	//ctx->Driver.ResizeBuffersMESA(ctx);
	// Mesa 5: Changed parameters
	ctx->Driver.ResizeBuffers(gldCtx->glBuffer);

#if 0
	ddlogPrintf(GLDLOG_SYSTEM, ">> Viewport x=%d y=%d w=%d h=%d", x,y,w,h);
#endif

	// ** D3D viewport must not be outside the render target surface **
	// Sanity check the GL viewport dimensions
	if (x < 0) x = 0;
	if (y < 0) y = 0;
	if (w > gldCtx->dwWidth) 		w = gldCtx->dwWidth;
	if (h > gldCtx->dwHeight) 		h = gldCtx->dwHeight;
	// Ditto for D3D viewport dimensions
	if (w+x > gldCtx->dwWidth) 		w = gldCtx->dwWidth-x;
	if (h+y > gldCtx->dwHeight) 	h = gldCtx->dwHeight-y;

	d3dvp.dwX		= x;
	d3dvp.dwY		= gldCtx->dwHeight - (y + h);
	d3dvp.dwWidth	= w;
	d3dvp.dwHeight	= h;
	if (ctx->Viewport.Near <= ctx->Viewport.Far) {
		d3dvp.dvMinZ	= ctx->Viewport.Near;
		d3dvp.dvMaxZ	= ctx->Viewport.Far;
	} else {
		d3dvp.dvMinZ	= ctx->Viewport.Far;
		d3dvp.dvMaxZ	= ctx->Viewport.Near;
	}

	// TODO: DEBUGGING
//	d3dvp.MinZ		= 0.0f;
//	d3dvp.MaxZ		= 1.0f;

	_GLD_DX7_DEV(SetViewport(gld->pDev, &d3dvp));

}
开发者ID:nikai3d,项目名称:mesa,代码行数:60,代码来源:gld_driver_dx7.c

示例15: guard

void UOpenALAudioSubsystem::Destroy()
{
	guard(UOpenALAudioSubsystem::Destroy);

	if( Initialized )
	{
		// Unhook.
		USound::Audio = NULL;
		UMusic::Audio = NULL;

		// Shut down viewport.
		SetViewport( NULL );

		// Cleanup.
		MikMod_Exit();
		alDeleteSources( 1, &MusicSource );
		for( INT i=0; i<NumSources; i++ )
			alDeleteSources( 1, &Sources[i].Id );
		alureShutdownDevice();
	}

	Super::Destroy();

	unguard;
}
开发者ID:MaddTheSane,项目名称:surreal,代码行数:25,代码来源:ALAudioSubsystem.cpp


注:本文中的SetViewport函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。