Hi , this error has only just started appearing in my code:
Exception in thread "main" java.lang.RuntimeException: No OpenGL context found in the current thread.
at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124)
at org.lwjgl.opengl.GL11.glClear(GL11.java:585)
at com.Core.Gamecore.render(Gamecore.java:171)
at com.Core.Gamecore.start(Gamecore.java:118)
at com.Core.Gamecore.<init>(Gamecore.java:42)
at com.Core.Gamecore.main(Gamecore.java:46)
The class that is causing the issue is this one: please dont comment on how efficient it is.
public class Button {//Mostly complete
private vertex2d position,aposition;
private int type;
private GB graphicsp,graphicsd,textinf;
private boolean pressed;
private String text;
private int pos;
private text t;
private Gamecore core;
public Button(Gamecore core,int x, int y,String text, int type,int pos){
position = new vertex2d(x,y);
aposition = new vertex2d((core.width/2) + x,(core.height/2)+y);
this.text = text;
this.type = type;
pressed = false;
this.core = core;
this.pos = pos;
graphicsp = new GB(core);
graphicsd = new GB(core);
graphicsd.createobject(core.world.shape.rect(core.button.getcoords(0, 0, 143, 28), 143, 28), core.button.gettexture(),1);
graphicsp.createobject(core.world.shape.rect(core.button.getcoords(0, 30, 143, 58), 143, 28), core.button.gettexture(),1);
graphicsd.translate(x, y);
graphicsp.translate(x,y);
t = new text(core);
textinf = t.getfontbatch(text);
}
public vertex2d getposition(){
return position;
}
public void setposition(vertex2d vert){
position = vert;
}
public void press(){
if(type == 0){
pressed = true;
}
if(type == 1){
if(pressed){
pressed = false;
return;
}
else{
pressed = true;
return;
}
}
}
public void unpress(){//only use on non toggle butons
pressed = false;
}
public boolean checkpress(){
//if(core.mx>= aposition.getx() && core.mx <= aposition.getx() +128){
//if(core.my >= aposition.gety() && core.my <= aposition.gety() + 26){
//press();
return true;
// }
//}
//unpress();
//return false;
}
public void render(){
if(!pressed){
graphicsd.render();
}
else{
graphicsp.render();
}
textinf.render();
}
public int getpos(){//returns stored array position if defined
return pos;
}
public void destroy(){
graphicsp.destroy();
graphicsd.destroy();
textinf.destroy();
}
}