Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/304.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在openGL中找不到用于纹理创建的文件路径_Java_Opengl_Png_Textures_Filepath - Fatal编程技术网

Java 在openGL中找不到用于纹理创建的文件路径

Java 在openGL中找不到用于纹理创建的文件路径,java,opengl,png,textures,filepath,Java,Opengl,Png,Textures,Filepath,我目前正在尝试使用JOGL创建一个带纹理的多边形,我想我已经准备好了。但是,当我尝试将png图像加载到TextureReader时,它告诉我找不到该文件。程序和图像都位于名为“视频”的项目中 texture = genTexture(gl); gl.glBindTexture(GL.GL_TEXTURE_2D, texture); TextureReader.Texture texture = null; try { texture = TextureRe

我目前正在尝试使用JOGL创建一个带纹理的多边形,我想我已经准备好了。但是,当我尝试将png图像加载到TextureReader时,它告诉我找不到该文件。程序和图像都位于名为“视频”的项目中

texture = genTexture(gl);
    gl.glBindTexture(GL.GL_TEXTURE_2D, texture);
    TextureReader.Texture texture = null;
    try {
        texture = TextureReader.readTexture("Videos/boy_reaching_up_for_goalpost_stencil.png");
    } catch (IOException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }

如果使用绝对路径(如
/home/user/some/folders/Videos/boy_reaching_bla_bla.png
),会发生什么情况?这可能与OpenGL无关,但指定的路径错误…解决了问题,谢谢。我的印象是,如果图片在项目文件夹中,那么绝对路径是不必要的。这是不对的吗?是的。但它是一个“工具”,用来找出是否存在真正的问题,或者路径是否有问题。也可以使用相对路径;)