Я пытаюсь загрузить файл с приложением какао, но приложение не может найти файл
Я использую SDL_image, код:
SDL_Surface * surface = IMG_Load (file);
файл: "/Resources/cursor.png"
Я пытался использовать некоторые строки в Objective-C, но приложение не запускается, так как оно написано на c ++
Спасибо, Даниэль
Обновление:
Код загрузки текстуры:
GLuint CGLTexture::load_texture(const char* file, bool wrap)
{
SDL_Surface* surface = IMG_Load(file);
if (!surface) {
printf("Error, probably the file isn't there :S");
return 0;
}
GLuint texture;
glPixelStorei(GL_UNPACK_ALIGNMENT,4);
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
SDL_PixelFormat *format = surface->format;
// select modulate to mix texture with color for shading
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
// when texture area is small, bilinear filter the closest mipmap
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_NEAREST );
// when texture area is large, bilinear filter the first mipmap
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
// if wrap is true, the texture wraps over at the edges (repeat)
// ... false, the texture ends at the edges (clamp)
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
wrap ? GL_REPEAT : GL_CLAMP );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
wrap ? GL_REPEAT : GL_CLAMP );
if (format->Amask)
{
gluBuild2DMipmaps(GL_TEXTURE_2D, 4,
surface->w, surface->h, GL_RGBA,GL_UNSIGNED_BYTE, surface->pixels);
}
else
{
gluBuild2DMipmaps(GL_TEXTURE_2D, 3,
surface->w, surface->h, GL_RGB, GL_UNSIGNED_BYTE, surface->pixels);
}
SDL_FreeSurface(surface);
return texture;
}
Я вызываю эту функцию так:
cursorTexture = CGLTexture::load_texture("/Resources/cursor.png",false);
Файлне найден, я думаю, что это где-то в комплекте приложения, но как я могу получить к нему доступ с помощью c ++?