Sto lavorando a un gioco di carte e attualmente ho una buona base, ma sto correndo un errore quando lo eseguo in eclissi. Sto anche usando sdrucciolevole 2d.Nessun contesto OpenGL trovato nel thread corrente, come posso risolvere questo errore?
Ecco l'errore dalla console.
Exception in thread "main" java.lang.RuntimeException: No OpenGL contesto trovato nel thread corrente. a org.lwjgl.opengl.GLContext.getCapabilities (GLContext.java:124) a org.lwjgl.opengl.GL11.glGetError (GL11.java:1277) a org.newdawn.slick.opengl.renderer.ImmediateModeOGLRenderer. glGetError (ImmediateModeOGLRenderer.java:387) a org.newdawn.slick.opengl.InternalTextureLoader.getTexture (InternalTextureLoader.java:337) a org.newdawn.slick.opengl.InternalTextureLoader.getTexture (InternalTextureLoader.java:275) a org.newdawn.slick.Image. (Image.java:270) a org.newdawn.slick.Image. (Image.java:244) a org.newdawn.slick.Image. (Image.java:232) a org.newdawn.slick.Image. (Image.java:198) a Cards.Card. (Card.java: 18)
codice in cui credo che l'origine dell'errore da accadendo (classe carta)
package Cards;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
public class Card
{
final int numCards = 52;
Image[] card = new Image [numCards];
Card (int c)
{
String fileLocation = new String();
for (int i = 1 ; i <= 52 ; i++)
{
fileLocation = "res/cards/" + i + ".png";
try
{
card [i] = new Image (fileLocation); //line
}
catch (SlickException e)
{
e.printStackTrace();
}
}
}
public Image getImage (int cardlocation)
{
return card [cardlocation];
}
}
Qualcuno ha visto questo tipo di problema prima? Come posso risolverlo?
Risposta chiara e concisa. Grazie! +1 –