本文整理汇总了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 );
}
示例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 );
}
示例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();
}
示例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;
}
示例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;
}
示例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--;
}
示例7: RenderFrame
//--------------------------------------------------------------------------------------
void CMultiDeviceContextDXUTMesh::Render(ID3D11DeviceContext* pd3dDeviceContext,
UINT iDiffuseSlot,
UINT iNormalSlot,
UINT iSpecularSlot)
{
RenderFrame(0, false, pd3dDeviceContext, iDiffuseSlot, iNormalSlot, iSpecularSlot);
}
示例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;
}
示例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");
}
示例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);
}
示例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);
}
示例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;
}
示例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");
}
示例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;
}
示例15: dc
void DemoEntityManager::OnIdle(wxIdleEvent& event)
{
wxClientDC dc(this);
RenderFrame ();
dTimeTrackerUpdate();
event.RequestMore(); // render continuously, not only once on idle
}