Jump to content

[SOLVED] how to create Unigine::App with any custom video resolution


photo

Recommended Posts

I want to embed Unigine into my own application, I've also looked the source of source\samples\App\, but I have a question, all these App are set to default using standard resolution, It seems there is no way to create a custom resolution. the App::setVideoMode is automatically called by engine with it's own standard resolution.

 

Then only way to do this was using Unigine::Engine::init(UNIGINE_VERSION, app, argc, argv); and set video_mode to -1 then add width and height to argv.

 

So I'm wondering if there is some other way to set the custom resolution without using argc and argv.

Link to comment

You can skip width and height arguments which you receive inside the App::setVideoMode() function. Engine uses App::getWidth() and App::getHeight() functions to get the real resolution.

Link to comment

seems this won't work, my setVideoMode function:

int WinApp::setVideoMode(int width,int height,int flags,int)
{
RECT win_rect;

   ::GetWindowRect(window, &win_rect);
   window_width = win_rect.right - win_rect.left;
   window_height = win_rect.bottom - win_rect.top;

   return create_context();
}

 

And I already passed -video_mode -1 to argv, the actual render window are streched.

Link to comment

thanks, it seems the RESIZABLE flag must be set within setVideoMode function, there is the correct setVideoMode function in app.

 

setVideoMode(int width,int height,int flags,int)
{
   RECT win_rect;

   ::GetClientRect(window, &win_rect);
   window_width = win_rect.right - win_rect.left;
   window_height = win_rect.bottom - win_rect.top;
   window_flags = flags | Unigine::App::RESIZABLE;

   return create_context();
}

Link to comment
×
×
  • Create New...