Ive got this excepiton when I run my little game:
Exception in thread "main" org.lwjgl.opengl.OpenGLException: Stack overflow (1283)
at org.lwjgl.opengl.Util.checkGLError(Util.java:56)
at org.lwjgl.opengl.Display.swapBuffers(Display.java:567)
at org.lwjgl.opengl.Display.update(Display.java:583)
at know.Okno.cyklusHry(Okno.java:156)
at know.Okno.main(Okno.java:268)
It happend since I have tested loading of flag map from txt file.... Iam adding my code:(its in my language..)
This is loading of the map
ublic DlazdicovaMapa nahrajMapu(String subor) throws IOException
{
ArrayList riadky = new ArrayList();
int sirka = 0;
int vyska = 0;
ClassLoader classLoader = getClass().getClassLoader();
URL url = classLoader.getResource(subor);
if (url == null) {
throw new IOException("No such map: " + subor);
}
// read every line in the text file into the list
BufferedReader reader = new BufferedReader(
new InputStreamReader(url.openStream()));
while (true) {
String riadok = reader.readLine();
// no more lines to read
if (riadok == null) {
reader.close();
break;
}
riadky.add(riadok);
sirka = Math.max(sirka, riadok.length());
}
// parse the lines to create a TileEngine
vyska = riadky.size();
DlazdicovaMapa mapa = new DlazdicovaMapa(sirka, vyska);
for (int y=0; y<vyska; y++)
{
String riadok = (String)riadky.get(y);
for (int x=0; x<riadok.length(); x++)
{
char ch = riadok.charAt(x);
mapa.setDlazdica(x, y, dlazdica);
}
}
return mapa;
}
This is code when exception is thrown
public void setDlazdica(int x, int y, Dlazdica dlazdica)
{
dlazdice[x][y] = dlazdica;
}
That code shouldn't throw OpenGLException. Are you sure about the trace? This exception looks more like you're pushing to deep on matrix stack or similar (glPushMatrix?).
Nicolai de Haan Brøgger
I finnaly found out the problem ..the problem wassnt here as you said i just didnt pop the matrix..thank you