New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

after Director::restart(), convertToGL's result become error #19136

Open
denghe opened this Issue Oct 27, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@denghe
Copy link

denghe commented Oct 27, 2018

  • cocos2d-x version: 3.17
  • devices test on: win10, gtx1060
  • developing environments
    • VS version: 2017
      Steps to Reproduce:
  1. create a new cpp project by wizard
  2. edit AppDelegate.cpp -- applicationDidFinishLaunching()

bool AppDelegate::applicationDidFinishLaunching()
{
// ...... init gl

auto v = cocos2d::Director::getInstance()->convertToGL({ 500,500 });
std::cout << v.x << std::endl;

cocos2d::Director::getInstance()->restartCallback = []
{
	auto v = cocos2d::Director::getInstance()->convertToGL({ 500,500 });
	std::cout << v.x << std::endl;
};
director->restart();

return true;

the console output:

500
-0.2xxxxx

btw: restartCallback is insert a std::function at the end of restartDirector()

@stevetranby

This comment has been minimized.

Copy link
Contributor

stevetranby commented Oct 28, 2018

Try a breakpoint inside convertToGL and check what the transform and glSize are during both calls to that function. It works fine on my Mac ("500" "500").

@denghe

This comment has been minimized.

Copy link

denghe commented Nov 1, 2018

i fixed it by myself. add setGLDefaultValues(); to void Director::restartDirector() is ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment