Antoine.YVAN Posted July 22, 2020 Share Posted July 22, 2020 (edited) HI! I don't understand why when I use the functions App:getWidth() and App:getHeight() it does not return what I expect. I changed both of those values but it does not help in any way. I am using Unigine 2.10.0 and am working on Linux. Here is the fragment of code that I use : App::setWidth(1280); App::setHeight(720); RenderState::setViewport(0,0,1280,720); fprintf(stderr, "PosX = %f, PosY = %f, Width = %d, Height = %d\n", App::getPositionX(), App::getPositionY(), App::getWidth(), App::getHeight()); I expect width = 1280 and height = 720. But this is the return values : PosX = 0.000000, PosY = 0.000000, Width = 1, Height = 78 I am working on a plugin, can it be the origin of the problem ? Thanks for your time, Antoine Edited July 22, 2020 by Antoine.YVAN Link to comment
morbid Posted July 22, 2020 Share Posted July 22, 2020 Hello Antoine, Could you please check which video mode you're using? I suggest trying following startup arguments: -video_mode -1 -video_resizable 0 And running your code again. If it's not the reason for the strange output I'd like to ask you for a reproducer (scene content if necessary and code). Thanks. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Antoine.YVAN Posted July 22, 2020 Author Share Posted July 22, 2020 (edited) Hello Morbid, I tried to use those arguments but got the same output (1w & 78h). Well to reproduce it I guess you just need to create a plugin, link it to a project and then place the previous code I sent in the init function of the plugin just as : int PluginLogic::init() { App::setWidth(1280); App::setHeight(720); RenderState::setViewport(0,0,1280,720); int width = RenderState::get()->getWidth(); fprintf(stderr, "PosX = %f, PosY = %f, Width = %d, Height = %d\n", App::getPositionX(), App::getPositionY(), width, App::getHeight()); Log::message("PluginLogic::init(): called\n"); return 1; } The expected output is : "PosX = 0, PosY = 0, Width = 1280, Height = 720" This is all the setup that is needed I think... I don't have much things to add. Thanks, Antoine Edited July 22, 2020 by Antoine.YVAN Link to comment
Recommended Posts