int main() { // construct the viewer. osgViewer::Viewer viewer; //создать класс с динамической текстурой DynamicTexture dynTexture; //назначить данные просмотрщику viewer.setSceneData( dynTexture.getRootNode().get() ); return viewer.run(); }
bool WebcamData::getFrame(DynamicTexture& texture) { if (m_state != WebcamState::Active) { return false; } { std::lock_guard<std::mutex> lock(m_imageMutex); return texture.fill(m_image); } }
void draw()const override{ texture.draw(); TextureAsset(L"Window").scale(Min(frameCount,10)/10.,Min(frameCount,10)/10.).drawAt(240, 320); double Zoom = -2.5 * Max(0., 10. - frameCount); (RetryButton.stretched(Zoom))(TextureAsset(L"Button")).draw(); (TweetButton.stretched(Zoom))(TextureAsset(L"Button")).draw(); (TitleButton.stretched(Zoom))(TextureAsset(L"Button")).draw(); if (frameCount > 10) { (FontAsset(L"Font"))(L"Score"+Format(m_data->score)).draw(100,100); } }
void init()override{ texture.fill(m_data->Result_Back); RetryButton = Rect(140, 200, 200, 50); TweetButton = Rect(140,295,200,50); TitleButton = Rect(140,400,200,50); }