0

I never make a android project and i don't know java. I am trying to port my c++ sdl opengl project to android. I am using android studio. I opened sdl sample android project and now i can manage project from main.cpp . How do i know this because I changed the color of the window and it worked. But when i try to load shader.text file with ifstream program crashed. I understand that this will not happen. After this i searched but I couldn't find a complete code or an example.

When i put files in assets folder and build apk. apk size grows as files. Therefore I need to kepth files in assets folder ?

I think i need to use asset manager but of course i don't know.

What files should I write what code? I mean what i need to add main.cpp and I need to add code java side also ?

main.cpp :

int main()
{
    //lets say i have filePath like these
    char file_vert[100];
    snprintf(file_vert,100,"shaders/vertexShader.text");
    char file_Texture[100];
    snprintf(file_Texture,100,"textures/image.jpg");

    //i am using them in cpp project
    
    //shader text file like this
    std::ifstream vShaderFile;
    vShaderFile.open(file_vert);

    //and i am loading texture file with "stbi" library
    unsigned char *data = stbi_load(file_Texture, &width, &height, &nrComponents, 0);
}
luffy
  • 23
  • 4
  • Your tag "C++" is wrong. But you have to add the file to your project. https://stackoverflow.com/questions/26706843/adding-an-assets-folder-in-android-studio – cic Dec 13 '21 at 12:42
  • i already have assets folder and files that i want to use are in it. – luffy Dec 13 '21 at 14:42

0 Answers0