Re: Code for Peer Review
Posted by Pixelapp on
URL: https://forum.jogamp.org/Code-for-Peer-Review-tp4025708p4025713.html
Hello:
When I use the code below in the display() loop it crashes:
public Texture[] prepareTexture(GL2 gl, String[] fnm, Texture[] pTex )
{
String[] fileName = new String[fnm.length];
for (int count = 0; count < fnm.length; count++)
{
fileName[count] = folder + fnm[count];
try {
pTex[count] = TextureIO.newTexture(
cl.getResource(fileName[count]), false, null);
pTex[count].setTexParameterf(gl, GL2.GL_TEXTURE_MIN_FILTER,
GL2.GL_LINEAR);
pTex[count].setTexParameterf(gl, GL2.GL_TEXTURE_MAG_FILTER,
GL2.GL_LINEAR);
} catch (Exception e) {
System.out.println("Error loading texture " + fileName[count]);
}
}
return pTex;
}
public void deleteTextures(GL2 gl, Texture[] dTex)
{
for (int count = 0; count < dTex.length; count++)
{
dTex[count].destroy(gl);
}
}
If I use the code prepareTexture() and deleteTextures() only once in the display() loop, it does't crash.
Any ideas?