I want to create a sprite with my personal image. But when I load the project, I have this error:OpenGL error 0x0501 in C:UsersPCDesktopQuizcocos2dcocosrendererbackendopenglTextureGL.cpp cocos2d::backend::Texture2DGL::updateData 207
cocos2d: fullPathForFilename: No file found at /cc_2x2_white_image. Possible missing file.
I tried to reduce the size of my image and I hoped that the image would start the program. But the problem didn’t solve. My image is stored at the folder Resources and this is the code I used to create my sprite:
#include "GraphicScene.hpp"
USING_NS_CC;
Scene *GraphicScene::createScene()
{
auto scene = Scene::create();
auto layer = GraphicScene::create();
scene->addChild(layer);
return scene;
}
bool GraphicScene::init()
{
if (!Layer::init())
{
return false;
}
auto sprite = Sprite::create("quiz.png");
sprite->setPosition(12, 12);
this->addChild(sprite, 0);
return true;
}
Seke Amayene is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.