1
\$\begingroup\$

I'm trying to obtain information about the GPU that is running the game in order to use the correct texture compression for that GPU:

std::string GPUInfo::getTC()
{
    std::string TC;
    cocos2d::Configuration::getInstance()->gatherGPUInfo();
    if(cocos2d::Configuration::getInstance()->supportsPVRTC())
        TC = ".pvr.ccz";
    else if(cocos2d::Configuration::getInstance()->supportsATITC())
        TC = ".dds";
    else
        TC = ".png";
    CCLOG("Texture compression format -> %s", TC.c_str());
    return TC;
}

But this keeps causing this error:

call to OpenGL ES API with no current context (logged once per thread)

Is there another way to obtain details about supporting GPU features on the current device?

\$\endgroup\$
  • 1
    \$\begingroup\$ It sounds like you're calling without a context ;) Have you initialized an OpenGL ES context, are you running in the thread that initialized it? \$\endgroup\$ – MickLH Dec 17 '14 at 3:39
2
\$\begingroup\$

If you take a look at your AppDelegate::applicationFinishedLaunching function, it begins with these lines of code:

auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
    glview = GLView::create("My Game");
    director->setOpenGLView(glview);
}

You should check for supported compression after those lines are executed.

\$\endgroup\$
  • \$\begingroup\$ That worked! :D, it seems that the problem was that i was trying to call that in the scene code. \$\endgroup\$ – DGomez Dec 17 '14 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.