nullcheck to fix #106
This commit is contained in:
parent
48d742bbc5
commit
176de19745
|
@ -105,15 +105,23 @@ public class CurveRenderState {
|
||||||
public CurveRenderState(HitObject hitObject, Vec2f[] curve) {
|
public CurveRenderState(HitObject hitObject, Vec2f[] curve) {
|
||||||
this.hitObject = hitObject;
|
this.hitObject = hitObject;
|
||||||
this.curve = curve;
|
this.curve = curve;
|
||||||
|
initFBO();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initFBO() {
|
||||||
FrameBufferCache cache = FrameBufferCache.getInstance();
|
FrameBufferCache cache = FrameBufferCache.getInstance();
|
||||||
Rendertarget mapping = cache.get(hitObject);
|
Rendertarget mapping = cache.get(hitObject);
|
||||||
if (mapping == null)
|
if(mapping==null)
|
||||||
mapping = cache.insert(hitObject);
|
mapping=cache.insert(hitObject);
|
||||||
fbo = mapping;
|
fbo=mapping;
|
||||||
createVertexBuffer(fbo.getVbo());
|
|
||||||
|
createVertexBuffer(fbo.getVbo()
|
||||||
|
|
||||||
|
);
|
||||||
//write impossible value to make sure the fbo is cleared
|
//write impossible value to make sure the fbo is cleared
|
||||||
lastPointDrawn = -1;
|
lastPointDrawn=-1;
|
||||||
spliceFrom = spliceTo = -1;
|
spliceFrom=spliceTo=-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void splice(int from, int to) {
|
public void splice(int from, int to) {
|
||||||
|
@ -135,6 +143,12 @@ public class CurveRenderState {
|
||||||
public void draw(Color color, Color borderColor, int from, int to) {
|
public void draw(Color color, Color borderColor, int from, int to) {
|
||||||
float alpha = color.a;
|
float alpha = color.a;
|
||||||
|
|
||||||
|
if (fbo == null) {
|
||||||
|
// this should not be null, but issue #106 claims it is possible, at least 3 people had this...
|
||||||
|
// debugging shows that the draw was called after discardGeometry was, which does not really make sense
|
||||||
|
initFBO();
|
||||||
|
}
|
||||||
|
|
||||||
if (lastPointDrawn != to || firstPointDrawn != from) {
|
if (lastPointDrawn != to || firstPointDrawn != from) {
|
||||||
int oldFb = GL11.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT);
|
int oldFb = GL11.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT);
|
||||||
int oldTex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
int oldTex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user