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


C++ RenderFrame函数代码示例

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


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

示例1: XMMatrixMultiply

//--------------------------------------------------------------------------------------
// Name: RenderFrame()
// Desc: Renders a frame (save state, apply matrix, render children, restore)
//--------------------------------------------------------------------------------------
VOID Mesh::RenderFrame( const MESH_FRAME* pFrame, DWORD dwFlags )
{
    // Apply the frame's local transform
    XMMATRIX matSavedWorld = m_matWorld;
    m_matWorld = XMMatrixMultiply( pFrame->m_matTransform, m_matWorld );

    // Render the mesh data
    if( pFrame->m_pMeshData->m_dwNumSubsets )
    {
        // Call the callback, so the app can tweak state before rendering the mesh
        DWORD dwFrame = pFrame - m_pFrames;
        RenderMeshCallback( dwFrame, pFrame, dwFlags );

        RenderMesh( pFrame->m_pMeshData, dwFlags );
    }

    // Render any child frames
    if( pFrame->m_pChild )
        RenderFrame( pFrame->m_pChild, dwFlags );

    // Restore the transformation matrix
    m_matWorld = matSavedWorld;

    // Render any sibling frames
    if( pFrame->m_pNext )
        RenderFrame( pFrame->m_pNext, dwFlags );
}
开发者ID:CodeAsm,项目名称:ffplay360,代码行数:31,代码来源:AtgMesh.cpp

示例2: D3DXMatrixMultiply

//-----------------------------------------------------------------------------
// Renders the given frame's mesh containers, if it has any.
//-----------------------------------------------------------------------------
void Mesh::RenderFrame( Frame *frame )
{
	MeshContainer *meshContainer = (MeshContainer*)frame->pMeshContainer;

	// Render this frame's mesh, if it has one.
	if( frame->pMeshContainer != NULL )
	{
		// Check if this mesh is a skinned mesh.
		if( meshContainer->pSkinInfo != NULL )
		{
			// Create the bone transformations using the mesh's transformation matrices.
			for( unsigned long b = 0; b < meshContainer->pSkinInfo->GetNumBones(); ++b )
				D3DXMatrixMultiply( &m_boneMatrices[b], meshContainer->pSkinInfo->GetBoneOffsetMatrix( b ), meshContainer->boneMatrixPointers[b] );

			// Update the meshes vertices with the new bone transformation matrices.
			PBYTE sourceVertices, destinationVertices;
			meshContainer->originalMesh->LockVertexBuffer( D3DLOCK_READONLY, (void**)&sourceVertices );
			meshContainer->MeshData.pMesh->LockVertexBuffer( 0, (void**)&destinationVertices );
			meshContainer->pSkinInfo->UpdateSkinnedMesh( m_boneMatrices, NULL, sourceVertices, destinationVertices );
			meshContainer->originalMesh->UnlockVertexBuffer();
			meshContainer->MeshData.pMesh->UnlockVertexBuffer();

			// Render the mesh by atrtribute group.
			for( unsigned long a = 0; a < meshContainer->totalAttributeGroups; a++ )
			{
				Engine::GetInstance()->GetDevice()->SetMaterial( meshContainer->materials[meshContainer->attributeTable[a].AttribId]->GetLighting() );
				Engine::GetInstance()->GetDevice()->SetTexture( 0, meshContainer->materials[meshContainer->attributeTable[a].AttribId]->GetTexture() );
				meshContainer->MeshData.pMesh->DrawSubset( meshContainer->attributeTable[a].AttribId );
			}
		}
		else
		{
			// This is not a skinned mesh, so render it like a static mesh.
			for( unsigned long m = 0; m < meshContainer->NumMaterials; m++)
			{
				if( meshContainer->materials[m] )
				{
					Engine::GetInstance()->GetDevice()->SetMaterial( meshContainer->materials[m]->GetLighting() );
					Engine::GetInstance()->GetDevice()->SetTexture( 0, meshContainer->materials[m]->GetTexture() );
				}
				else
					Engine::GetInstance()->GetDevice()->SetTexture( 0, NULL );

				meshContainer->MeshData.pMesh->DrawSubset( m );
			}
		}
	}

	// Render the frame's siblings.
	if( frame->pFrameSibling != NULL )
		RenderFrame( (Frame*)frame->pFrameSibling );

	// Render the frame's children.
	if( frame->pFrameFirstChild != NULL )
		RenderFrame( (Frame*)frame->pFrameFirstChild );
}
开发者ID:helcl42,项目名称:Game-DX,代码行数:59,代码来源:Mesh.cpp

示例3: display

// Генерация и отображение изображения
void display() 
{
	// Вызов пользователем генерации изображения
	RenderFrame();

	// Копирования текстур изображения в память
	glBindTexture(GL_TEXTURE_2D, texture);
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);

	// Очистка буфера
	glClear(GL_COLOR_BUFFER_BIT);

	// Рендер
	glBegin(GL_QUADS);
	glTexCoord2f(1, 0); glVertex2f(1, -1);
	glTexCoord2f(1, 1); glVertex2f(1, 1);
	glTexCoord2f(0, 1); glVertex2f(-1, 1);
	glTexCoord2f(0, 0); glVertex2f(-1, -1);
	glEnd();

	// Отображение результатат
	glFlush();
	glutSwapBuffers();

}
开发者ID:DrSkytium,项目名称:Mandelbrot-Set,代码行数:26,代码来源:main.cpp

示例4: CE

void DirectXInterop::DrawFrame() {
	static float t = 0.0f;

	// Map the resources
	cudaGraphicsResource *resource = m_hdrTextureCuda->GetCurrentGraphicsResource();
	CE(cudaGraphicsMapResources(1, &resource));

	// Run the kernel 
	RenderFrame(m_hdrTextureCuda->GetTextureData(), m_clientWidth, m_clientHeight, m_hdrTextureCuda->GetTexturePitch(), t);

	// Copy the frame over to the d3d texture
	m_hdrTextureCuda->CopyTextureDataToRegisteredResource();

	// Unmap the resources
	CE(cudaGraphicsUnmapResources(1, &resource));


	// Draw the frame to the screen
	m_immediateContext->VSSetShader(m_fullscreenTriangleVS, nullptr, 0u);
	m_immediateContext->PSSetShader(m_copyCudaOutputToBackbufferPS, nullptr, 0u);

	ID3D11ShaderResourceView *hdrSRV = m_hdrTextureD3D->GetShaderResource();
	m_immediateContext->PSSetShaderResources(0, 1, &hdrSRV);

	m_immediateContext->Draw(3u, 0u);

	m_swapChain->Present(1u, 0u);

	t += 0.1f;
}
开发者ID:wyrover,项目名称:rapt,代码行数:30,代码来源:directx_interop.draw.cpp

示例5: GetHwBuffer

OMX_ERRORTYPE IpulibRender::StartDeviceInPause()
{
	OMX_ERRORTYPE ret = OMX_ErrorNone;

	if(bInitDev != OMX_FALSE)
		return OMX_ErrorNone;

	if(pShowFrame == NULL)
		return OMX_ErrorBadParameter;

	OMX_PTR pFrame = NULL;
	GetHwBuffer(pShowFrame, &pFrame);

	ret = Init();
	if(ret != OMX_ErrorNone)
		return ret;

	bInitDev = OMX_TRUE;

	ret = RenderFrame(pFrame);
	if(ret != OMX_ErrorNone)
		return ret;

	return OMX_ErrorNone;
}
开发者ID:hicks0074,项目名称:freescale_omx_framework,代码行数:25,代码来源:IpulibRender_mx6x.cpp

示例6: CycleVIF

/* ============================================================================
 *  CycleVIF: Lets the VI know we are cycling the machine.
 * ========================================================================= */
void
CycleVIF(struct VIFController *controller) {
  if (unlikely(controller->cyclesUntilIntr == 0)) {
    char buffer[4096];
    double vis, hz;

    if (++(controller->frameCount) == 10) {
      vis = (double) 10 / (glfwGetTime() - controller->startTime);
      hz = ((double) 6250000 / 60) / (glfwGetTime() - controller->startTime);
      sprintf(buffer, "CEN64 [%.2f VI/s] [RCP: %.2f MHz]", vis, hz / 10000);
      glfwSetWindowTitle(buffer);

      controller->startTime = glfwGetTime();
      controller->frameCount = 0;
    }

    RenderFrame(controller);

    /* Raise an interrupt. */
    BusRaiseRCPInterrupt(controller->bus, MI_INTR_VI);
    controller->cyclesUntilIntr = (62500000 / 60) + 1;
  }

  controller->cyclesUntilIntr--;
}
开发者ID:Durza007,项目名称:cen64-video,代码行数:28,代码来源:Controller.c

示例7: RenderFrame

//--------------------------------------------------------------------------------------
void CMultiDeviceContextDXUTMesh::Render(ID3D11DeviceContext* pd3dDeviceContext,
    UINT iDiffuseSlot,
    UINT iNormalSlot,
    UINT iSpecularSlot)
{
    RenderFrame(0, false, pd3dDeviceContext, iDiffuseSlot, iNormalSlot, iSpecularSlot);
}
开发者ID:marselas,项目名称:Zombie-Direct3D-Samples,代码行数:8,代码来源:MultiDeviceContextDXUTMesh.cpp

示例8: OMX_INIT_STRUCT

OMX_ERRORTYPE VideoRender::ProcessDataBuffer()
{
    OMX_ERRORTYPE ret = OMX_ErrorNone;
    OMX_BUFFERHEADERTYPE *pBufferHdr = NULL;

    if(ports[IN_PORT]->BufferNum() == 0)
        return OMX_ErrorNoMore;

    if(pSyncFrame != NULL)
        return OMX_ErrorNoMore;

    ports[IN_PORT]->GetBuffer(&pBufferHdr);

    if(nFrameCnt == 0 && ports[CLK_PORT]->IsEnabled() == OMX_TRUE) {
        OMX_TIME_CONFIG_CLOCKSTATETYPE sState;
        OMX_INIT_STRUCT(&sState, OMX_TIME_CONFIG_CLOCKSTATETYPE);
        ports[CLK_PORT]->GetTunneledInfo(&hClock);
        OMX_GetConfig(hClock.hTunneledComp, OMX_IndexConfigTimeClockState, &sState);
        ClockState = sState.eState;
    }

    nFrameCnt ++;

    LOG_DEBUG("VideoRender get bufer: %p:%lld:%x\n", 
            pBufferHdr->pBuffer, pBufferHdr->nTimeStamp, pBufferHdr->nFlags);

    if(ports[CLK_PORT]->IsEnabled() == OMX_TRUE)
        ret = SyncFrame(pBufferHdr);
    else
        ret = RenderFrame(pBufferHdr);

    return ret;
}
开发者ID:primiano,项目名称:udoo_external_fsl_imx_omx,代码行数:33,代码来源:VideoRender.cpp

示例9: assert

void
CTest5Section::Reaction( long in_SrcSectionID, const CRenderSection_CreateVertexBuffer_Response& in_rCmd )
{
	CLog::Print("CTest5Section::Reaction( const CRenderSection_CreateVertexBuffer_Response& in_rCmd )\n");
	CLog::Print("  VB handle = %lu\n",in_rCmd.m_VBHandle);
	assert( in_rCmd.m_VBHandle > 0 );
	m_VBHandle = in_rCmd.m_VBHandle;
	// set lights
	CTCommandSender<CRenderSection_SetAmbient>::SendCommand(
		m_RenderSectionID,
		CRenderSection_SetAmbient( 0x404040 )
	);
	CTCommandSender<CRenderSection_SetDirectionalLight>::SendCommand(
		m_RenderSectionID,
		CRenderSection_SetDirectionalLight( CVector(-1.0f,-1.0f,-1.0f), 1.0f, 1.0f, 1.0f )
	);
	// set object positions
	m_M0.ConstructScaling( CVector(2,2,2) );
	m_M1.ConstructRotationY( 0 );
	m_M1 *= CMatrix().ConstructTranslation( CVector(4,0,0) );
	m_M2.ConstructRotationY( CONST_PI_2 );
	m_M2 *= CMatrix().ConstructTranslation( CVector(0,0,4) );
	m_M3.ConstructRotationY( CONST_PI_2*2 );
	m_M3 *= CMatrix().ConstructTranslation( CVector(-4,0,0) );
	m_M4.ConstructRotationY( CONST_PI_2*3 );
	m_M4 *= CMatrix().ConstructTranslation( CVector(0,0,-4) );
	// start rendering
	m_NFramesToRender = 2;
	RenderFrame();
	CTCommandSender<CTest5Section_Render>::SendCommand(
		GetThisID(),
		CTest5Section_Render()
	);
	CLog::Print("CTest5Section::Reaction( const CRenderSection_CreateVertexBuffer_Response& in_rCmd ) end\n");
}
开发者ID:vpa1977,项目名称:lock_free_mt,代码行数:35,代码来源:test5_section.cpp

示例10: MessageLoop

INT MessageLoop(HWND hwnd)
{
    MSG msg = {0};

    while (msg.message != WM_QUIT)
    {
        if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);

            continue;

        }

        // Wait until the timer expires or any message is posted.
        if (WAIT_OBJECT_0 == MsgWaitForMultipleObjects(
                1,
                &g_Timer.Handle(),
                FALSE,
                INFINITE,
                QS_ALLINPUT
                ))
        {
            RenderFrame(hwnd);  
        }
    }

    DestroyWindow(hwnd);

    return INT(msg.wParam);
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:32,代码来源:winmain.cpp

示例11: QueryPerformanceCounter

void DXApp::Frame()
{
    UINT64 CurrentTime;
    UINT64 DeltaCount;
    QueryPerformanceCounter((LARGE_INTEGER*)&CurrentTime);
    DeltaCount = CurrentTime - OldCount;
    OldCount = CurrentTime;

    DeltaTime = (double)DeltaCount/(double)Frequency;

    {
        NxVec3 Temp;
        Cam.location+=Cam.ViewDir*40*fFoward;

        Temp = Cam.ViewDir;
        Temp.y = 0;
        Temp.normalize();
        Temp = Temp.cross(NxVec3(0.0f, 1.0f, 0.0f));
        Cam.location+=Temp*40*fStrafe;;
    }

    if(!bPaused)
    {
        DoParticles();
        _p_scene->simulate(_time_step);
        _p_scene->flushStream();
    }
    RenderFrame();
    if(!bPaused)
        _p_scene->fetchResults(NX_RIGID_BODY_FINISHED, true);

}
开发者ID:Arelius,项目名称:TestMotionBlur,代码行数:32,代码来源:DXApp.cpp

示例12: main

int main(int argc, char* argv[])
{
	SDL_Init(SDL_INIT_EVERYTHING);
	atexit(SDL_Quit);

	debugLogFile = fopen("stderr.txt", "wb");
	{
		char buffer[128];
		const time_t raw(time(NULL));
		const struct tm* local(localtime(&raw));
		strftime(buffer, sizeof(buffer)-1, "%c\n", local);
		LOG("%s", buffer);
	}

	if (!Initialise()) { exit(EXIT_FAILURE); }

	unsigned int lastUpdate = 0;
	while (!quit)
	{
		HandleEvents();

		unsigned int now = SDL_GetTicks();
		unsigned int elapsedMS = now - lastUpdate;
		lastUpdate = now;
		UpdateGame(elapsedMS);

		RenderFrame();

		Device::SwapBuffers();
	}

	return 0;
}
开发者ID:geoff-wode,项目名称:strumpfaffen,代码行数:33,代码来源:main.cpp

示例13: Error

void GLApplication::RunMainLoop(){
    if(!fWindow)
        Error(__FUNCTION__, "Window not created");
    
    CreateApplication();
    /**
     * OpenGL does not have depth test switched on by default, so if you want to 
     * enable depth testing, call glEnable(GL_DEPTH_TEST) at CreateApplication().
     *
     */
    //glEnable(GL_DEPTH_TEST);
    OpenGLShouldHaveNoError("InitializeApplication");
    
    while ((!glfwWindowShouldClose(fWindow))) {
        RenderFrame();
        
        glfwSwapBuffers(fWindow);
        glfwPollEvents();
        
        OpenGLShouldHaveNoError(__FUNCTION__);
    }
    
    ShutdownApplication();
    glfwDestroyWindow(fWindow);
	is_exit = true;
    OpenGLShouldHaveNoError("ShutdownApplication");
}
开发者ID:Grillnov,项目名称:OpenGLUtil,代码行数:27,代码来源:GLApplication.cpp

示例14: KW_CreateFrame

KW_Widget * KW_CreateFrame(KW_GUI * gui, KW_Widget * parent, const KW_Rect * geometry) {
  KW_Frame * frame = AllocFrame();
  KW_Widget * widget = KW_CreateWidget(gui, parent, KW_WIDGETTYPE_FRAME, geometry, PaintFrame, DestroyFrame, frame);
  KW_AddWidgetGeometryChangeHandler(widget, FrameGeometryChanged);
  RenderFrame(widget);
  return widget;
}
开发者ID:ckeen,项目名称:KiWi,代码行数:7,代码来源:KW_frame.c

示例15: dc

void DemoEntityManager::OnIdle(wxIdleEvent& event)
{
	wxClientDC dc(this);
	RenderFrame ();
	dTimeTrackerUpdate();
	event.RequestMore(); // render continuously, not only once on idle
}
开发者ID:shybovycha,项目名称:newton-dynamics,代码行数:7,代码来源:DemoEntityManager.cpp


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