本文整理汇总了C++中MyWindow::reshape方法的典型用法代码示例。如果您正苦于以下问题:C++ MyWindow::reshape方法的具体用法?C++ MyWindow::reshape怎么用?C++ MyWindow::reshape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyWindow
的用法示例。
在下文中一共展示了MyWindow::reshape方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ComboSelectionChanged
void ComboSelectionChanged(IControlCombo *pWin, unsigned int selectedidx)
{
if(!strcmp(pWin->GetID(), "RENDER"))
{
MyWindow* p = reinterpret_cast<MyWindow*>(pWin->GetUserData());
s_pCurRenderer->terminateGraphics();
s_pCurRenderer = g_renderers[selectedidx];
s_curRenderer = selectedidx;
s_pCurRenderer->initGraphics(p->m_winSz[0], p->m_winSz[1], g_Supersampling, g_MSAA);
g_profiler.setDefaultGPUInterface(s_pCurRenderer->getTimerInterface());
s_pCurRenderer->setDownSamplingMode(g_downSamplingMode);
p->reshape(p->m_winSz[0], p->m_winSz[1]);
}
else if(!strcmp(pWin->GetID(), "DS"))
{
g_downSamplingMode = pWin->GetItemData(selectedidx);
s_pCurRenderer->setDownSamplingMode( g_downSamplingMode );
}
else if(!strcmp(pWin->GetID(), "SS"))
{
g_Supersampling = 0.1f * (float)pWin->GetItemData(selectedidx);
MyWindow* p = reinterpret_cast<MyWindow*>(pWin->GetUserData());
//
// update the token buffer in which the viewport setup happens for token rendering
//
s_pCurRenderer->updateViewport(0, 0, p->getWidth(), p->getHeight(), g_Supersampling);
}
else if(!strcmp(pWin->GetID(), "MSAA"))
{
g_MSAA = pWin->GetItemData(selectedidx);
// involves some changes at the source of initialization... re-create all
MyWindow* p = reinterpret_cast<MyWindow*>(pWin->GetUserData());
g_profiler.reset(1);
s_pCurRenderer->terminateGraphics();
s_pCurRenderer->initGraphics(p->m_winSz[0], p->m_winSz[1], g_Supersampling, g_MSAA);
}
}
示例2: sample_main
//------------------------------------------------------------------------------
// Main initialization point
//------------------------------------------------------------------------------
int sample_main(int argc, const char** argv)
{
// you can create more than only one
static MyWindow myWindow;
// -------------------------------
// Basic OpenGL settings
//
NVPWindow::ContextFlags context(
4, //major;
3, //minor;
false, //core;
1, //MSAA;
24, //depth bits
8, //stencil bits
false, //debug;
false, //robust;
false, //forward;
NULL //share;
);
// -------------------------------
// Create the window
//
if(!myWindow.create("gl_vk_supersampled", &context, 1280,720))
{
LOGE("Failed to initialize the sample\n");
return false;
}
// -------------------------------
// Parse arguments/options
//
for(int i=1; i<argc; i++)
{
if(strlen(argv[i]) <= 1)
continue;
switch(argv[i][1])
{
case 's':
s_bStats = atoi(argv[++i]) ? true : false;
LOGI("s_bStats set to %s\n", s_bStats ? "true":"false");
break;
case 'q':
g_MSAA = atoi(argv[++i]);
#ifdef USESVCUI
if(g_pWinHandler) g_pWinHandler->GetCombo("MSAA")->SetSelectedByData(g_MSAA);
#endif
LOGI("g_MSAA set to %d\n", g_MSAA);
break;
case 'r':
g_Supersampling = atof(argv[++i]);
#ifdef USESVCUI
if(g_pWinHandler) g_pWinHandler->GetCombo("SS")->SetSelectedByData(g_Supersampling*10);
#endif
LOGI("g_Supersampling set to %.2f\n", g_Supersampling);
break;
case 'd':
#ifdef USESVCUI
if(g_pTweakContainer) g_pTweakContainer->SetVisible(atoi(argv[++i]) ? 1 : 0);
#endif
break;
default:
LOGE("Wrong command-line\n");
case 'h':
LOGI(s_sampleHelpCmdLine);
break;
}
}
s_pCurRenderer = g_renderers[s_curRenderer];
s_pCurRenderer->initGraphics(myWindow.getWidth(), myWindow.getHeight(), g_Supersampling, g_MSAA);
g_profiler.init();
g_profiler.setDefaultGPUInterface(s_pCurRenderer->getTimerInterface());
s_pCurRenderer->setDownSamplingMode(g_downSamplingMode);
// -------------------------------
// Message pump loop
//
myWindow.makeContextCurrent();
myWindow.swapInterval(0);
myWindow.reshape();
while(MyWindow::sysPollEvents(false) )
{
myWindow.idle();
}
return true;
}