nus-yam/ex-repair huggingface dataset:
Program: 163753
Project: 163753
Buggy source:
/** 
 * Add an ambient light based on the current color mode. This version includes an (x, y, z) position for situations where the falloff distance is used.
 */
public void ambientLight(float r,float g,float b,float x,float y,float z){
  if (lightCount == MAX_LIGHTS) {
    throw new RuntimeException("String_Node_Str" + MAX_LIGHTS + "String_Node_Str");
  }
  colorCalc(r,g,b);
  lightDiffuse[lightCount][0]=calcR;
  lightDiffuse[lightCount][1]=calcG;
  lightDiffuse[lightCount][2]=calcB;
  lightDiffuse[lightCount][3]=1.0f;
  lightType[lightCount]=AMBIENT;
  lightFalloffConstant[lightCount]=currentLightFalloffConstant;
  lightFalloffLinear[lightCount]=currentLightFalloffLinear;
  lightFalloffQuadratic[lightCount]=currentLightFalloffQuadratic;
  lightPosition[lightCount][0]=x;
  lightPosition[lightCount][1]=y;
  lightPosition[lightCount][2]=z;
  lightPosition[lightCount][3]=1.0f;
  glLightEnable(lightCount);
  glLightAmbient(lightCount);
  glLightPosition(lightCount);
  glLightFalloff(lightCount);
  glLightNoSpot(lightCount);
  lightCount++;
}

Fixed version (ground truth):
/** 
 * Add an ambient light based on the current color mode. This version includes an (x, y, z) position for situations where the falloff distance is used.
 */
public void ambientLight(float r,float g,float b,float x,float y,float z){
  if (!lights) {
    enableLights();
  }
  if (lightCount == MAX_LIGHTS) {
    throw new RuntimeException("String_Node_Str" + MAX_LIGHTS + "String_Node_Str");
  }
  colorCalc(r,g,b);
  lightDiffuse[lightCount][0]=calcR;
  lightDiffuse[lightCount][1]=calcG;
  lightDiffuse[lightCount][2]=calcB;
  lightDiffuse[lightCount][3]=1.0f;
  lightType[lightCount]=AMBIENT;
  lightFalloffConstant[lightCount]=currentLightFalloffConstant;
  lightFalloffLinear[lightCount]=currentLightFalloffLinear;
  lightFalloffQuadratic[lightCount]=currentLightFalloffQuadratic;
  lightPosition[lightCount][0]=x;
  lightPosition[lightCount][1]=y;
  lightPosition[lightCount][2]=z;
  lightPosition[lightCount][3]=1.0f;
  glLightEnable(lightCount);
  glLightAmbient(lightCount);
  glLightPosition(lightCount);
  glLightFalloff(lightCount);
  glLightNoSpot(lightCount);
  glLightNoDiffuse(lightCount);
  glLightNoSpecular(lightCount);
  lightCount++;
}
Program: 163754
Project: 163754
Buggy source:
protected PImage getImpl(int x,int y,int w,int h){
  PImage newbie=new PImage(w,h);
  IntBuffer newbieBuffer=IntBuffer.allocate(w * h);
  gl.glReadPixels(x,y,w,h,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,newbieBuffer);
  newbieBuffer.get(newbie.pixels);
  nativeToJavaARGB(newbie);
  return newbie;
}

Fixed version (ground truth):
protected PImage getImpl(int x,int y,int w,int h){
  PImage newbie=parent.createImage(w,h,ARGB);
  PTexture newbieTex=newbie.getTexture();
  IntBuffer newbieBuffer=IntBuffer.allocate(w * h);
  gl.glReadPixels(x,height - y,w,-h,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,newbieBuffer);
  copyToTexture(newbieTex,newbieBuffer,0,0,w,h);
  newbie.textureToPixels();
  return newbie;
}
Program: 163756
Project: 163756
Buggy source:
protected void drawTexture(PTexture tex,int[] crop,int x,int y,int w,int h){
  gl.glEnable(tex.getGLTarget());
  gl.glBindTexture(tex.getGLTarget(),tex.getGLTextureID());
  gl.glDepthMask(false);
  gl.glDisable(GL10.GL_BLEND);
  gl.glTexEnvf(GL10.GL_TEXTURE_ENV,GL10.GL_TEXTURE_ENV_MODE,GL10.GL_REPLACE);
  gl11.glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,crop,0);
  gl11x.glDrawTexiOES(0,x,y,w,h);
  gl.glTexEnvf(GL10.GL_TEXTURE_ENV,GL10.GL_TEXTURE_ENV_MODE,GL10.GL_MODULATE);
  gl.glDisable(tex.getGLTarget());
  if (hints[DISABLE_DEPTH_MASK]) {
    gl.glDepthMask(false);
  }
 else {
    gl.glDepthMask(true);
  }
  if (blend) {
    blend(blendMode);
  }
 else {
    noBlend();
  }
}

Fixed version (ground truth):
protected void drawTexture(PTexture tex,int[] crop,int x,int y,int w,int h){
  gl.glEnable(tex.getGLTarget());
  gl.glBindTexture(tex.getGLTarget(),tex.getGLTextureID());
  gl.glDepthMask(false);
  gl.glDisable(GL10.GL_BLEND);
  gl.glTexEnvf(GL10.GL_TEXTURE_ENV,GL10.GL_TEXTURE_ENV_MODE,GL10.GL_REPLACE);
  gl11.glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,crop,0);
  gl11x.glDrawTexiOES(x,y,0,w,h);
  gl.glTexEnvf(GL10.GL_TEXTURE_ENV,GL10.GL_TEXTURE_ENV_MODE,GL10.GL_MODULATE);
  gl.glDisable(tex.getGLTarget());
  if (hints[DISABLE_DEPTH_MASK]) {
    gl.glDepthMask(false);
  }
 else {
    gl.glDepthMask(true);
  }
  if (blend) {
    blend(blendMode);
  }
 else {
    noBlend();
  }
}
Program: 163757
Project: 163757
Buggy source:
public TextureInfo(int glid,int cropX,int cropY,int cropW,int cropH){
  this.glid=glid;
  crop=new int[4];
  crop[0]=cropX;
  crop[1]=cropY;
  crop[2]=cropW;
  crop[3]=cropH;
}

Fixed version (ground truth):
public TextureInfo(int glid,int cropX,int cropY,int cropW,int cropH){
  this.glid=glid;
  crop=new int[4];
  crop[0]=cropX;
  crop[1]=cropY;
  crop[2]=cropW;
  crop[3]=cropH;
  u0=(float)cropX / (float)texWidth;
  u1=u0 + (float)cropW / (float)texWidth;
  v0=(float)(cropY + cropH) / (float)texHeight;
  v1=(float)cropY / (float)texHeight;
}
Program: 163759
Project: 163759
Buggy source:
protected void textCharModelImpl(Glyph.TextureInfo tex,float x1,float y1,float x2,float y2){
  if (textFont.currentTexID != tex.glid) {
    gl.glBindTexture(GL10.GL_TEXTURE_2D,tex.glid);
    textFont.currentTexID=tex.glid;
  }
  gl11.glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,tex.crop,0);
  gl11x.glDrawTexfOES(x1,height - y2,0,x2 - x1,y2 - y1);
}

Fixed version (ground truth):
protected void textCharModelImpl(Glyph.TextureInfo tex,float x1,float y1,float x2,float y2){
  if (textFont.currentTexID != tex.glid) {
    if (0 < textVertexCount) {
      renderTextModel();
      textVertexCount=0;
    }
    gl.glBindTexture(GL10.GL_TEXTURE_2D,tex.glid);
    textFont.currentTexID=tex.glid;
  }
  if (textVertexBuffer.capacity() < textVertexCount + 6) {
    expandTextBuffers();
  }
  int n=textVertexCount;
  textVertexArray[3 * n + 0]=toFixed32(x1);
  textVertexArray[3 * n + 1]=toFixed32(y1);
  textVertexArray[3 * n + 2]=toFixed32(0);
  textTexCoordArray[2 * n + 0]=toFixed32(tex.u0);
  textTexCoordArray[2 * n + 1]=toFixed32(tex.v0);
  n++;
  textVertexArray[3 * n + 0]=toFixed32(x2);
  textVertexArray[3 * n + 1]=toFixed32(y2);
  textVertexArray[3 * n + 2]=toFixed32(0);
  textTexCoordArray[2 * n + 0]=toFixed32(tex.u1);
  textTexCoordArray[2 * n + 1]=toFixed32(tex.v1);
  n++;
  textVertexArray[3 * n + 0]=toFixed32(x1);
  textVertexArray[3 * n + 1]=toFixed32(y2);
  textVertexArray[3 * n + 2]=toFixed32(0);
  textTexCoordArray[2 * n + 0]=toFixed32(tex.u0);
  textTexCoordArray[2 * n + 1]=toFixed32(tex.v1);
  n++;
  textVertexArray[3 * n + 0]=toFixed32(x1);
  textVertexArray[3 * n + 1]=toFixed32(y1);
  textVertexArray[3 * n + 2]=toFixed32(0);
  textTexCoordArray[2 * n + 0]=toFixed32(tex.u0);
  textTexCoordArray[2 * n + 1]=toFixed32(tex.v0);
  n++;
  textVertexArray[3 * n + 0]=toFixed32(x2);
  textVertexArray[3 * n + 1]=toFixed32(y1);
  textVertexArray[3 * n + 2]=toFixed32(0);
  textTexCoordArray[2 * n + 0]=toFixed32(tex.u1);
  textTexCoordArray[2 * n + 1]=toFixed32(tex.v0);
  n++;
  textVertexArray[3 * n + 0]=toFixed32(x2);
  textVertexArray[3 * n + 1]=toFixed32(y2);
  textVertexArray[3 * n + 2]=toFixed32(0);
  textTexCoordArray[2 * n + 0]=toFixed32(tex.u1);
  textTexCoordArray[2 * n + 1]=toFixed32(tex.v1);
  n++;
  textVertexCount=n;
}
Program: 163760
Project: 163760
Buggy source:
/** 
 * Implementation of actual drawing for a line of text.
 */
protected void textLineImpl(char buffer[],int start,int stop,float x,float y){
  if (gl11 == null || gl11x == null) {
    throw new RuntimeException("String_Node_Str");
  }
  gl.glEnable(GL10.GL_TEXTURE_2D);
  if (!blend || blendMode != BLEND) {
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA,GL10.GL_ONE_MINUS_SRC_ALPHA);
  }
  if (textFont.texIDList == null) {
    textFont.initTexture(gl,maxTextureSize,maxTextureSize);
    textFont.addAllGlyphsToTexture(gl);
  }
  gl.glEnable(GL10.GL_TEXTURE_2D);
  textFont.currentTexID=textFont.texIDList[0];
  gl.glBindTexture(GL10.GL_TEXTURE_2D,textFont.currentTexID);
  gl.glColor4f(colorFloats[0],colorFloats[1],colorFloats[2],colorFloats[3]);
  super.textLineImpl(buffer,start,stop,x,y);
  if (blend) {
    blend(blendMode);
  }
 else {
    noBlend();
  }
  gl.glDisable(GL10.GL_TEXTURE_2D);
}

Fixed version (ground truth):
/** 
 * Implementation of actual drawing for a line of text.
 */
protected void textLineImpl(char buffer[],int start,int stop,float x,float y){
  if (gl11 == null || gl11x == null) {
    throw new RuntimeException("String_Node_Str");
  }
  gl.glEnable(GL10.GL_TEXTURE_2D);
  if (!blend || blendMode != BLEND) {
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA,GL10.GL_ONE_MINUS_SRC_ALPHA);
  }
  if (textFont.texIDList == null) {
    textFont.initTexture(gl,maxTextureSize,maxTextureSize);
    textFont.addAllGlyphsToTexture(gl);
  }
  gl.glEnable(GL10.GL_TEXTURE_2D);
  textFont.currentTexID=textFont.texIDList[0];
  gl.glBindTexture(GL10.GL_TEXTURE_2D,textFont.currentTexID);
  gl.glColor4f(colorFloats[0],colorFloats[1],colorFloats[2],colorFloats[3]);
  if (textMode == MODEL) {
    if (textVertexBuffer == null) {
      allocateTextModel();
    }
    gl.glNormal3f(0,0,1);
    textVertexCount=0;
  }
  super.textLineImpl(buffer,start,stop,x,y);
  if (textMode == MODEL && 0 < textVertexCount) {
    renderTextModel();
  }
  if (blend) {
    blend(blendMode);
  }
 else {
    noBlend();
  }
  gl.glDisable(GL10.GL_TEXTURE_2D);
}
Program: 163761
Project: 163761
Buggy source:
/** 
 * Implementation of actual drawing for a line of text.
 */
protected void textLineImpl(char buffer[],int start,int stop,float x,float y){
  if (gl11 == null || gl11x == null) {
    throw new RuntimeException("String_Node_Str");
  }
  gl.glEnable(GL10.GL_TEXTURE_2D);
  if (!blend || blendMode != BLEND) {
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA,GL10.GL_ONE_MINUS_SRC_ALPHA);
  }
  if (textFont.texIDList == null) {
    textFont.initTexture(gl,maxTextureSize,maxTextureSize);
    textFont.addAllGlyphsToTexture(gl);
  }
  gl.glEnable(GL10.GL_TEXTURE_2D);
  textFont.currentTexID=textFont.texIDList[0];
  gl.glBindTexture(GL10.GL_TEXTURE_2D,textFont.currentTexID);
  gl.glColor4f(colorFloats[0],colorFloats[1],colorFloats[2],colorFloats[3]);
  if (textMode == MODEL) {
    if (textVertexBuffer == null) {
      allocateTextModel();
    }
    gl.glNormal3f(0,0,1);
    textVertexCount=0;
  }
  super.textLineImpl(buffer,start,stop,x,y);
  if (textMode == MODEL && 0 < textVertexCount) {
    renderTextModel();
  }
  if (blend) {
    blend(blendMode);
  }
 else {
    noBlend();
  }
  gl.glDisable(GL10.GL_TEXTURE_2D);
}

Fixed version (ground truth):
/** 
 * Implementation of actual drawing for a line of text.
 */
protected void textLineImpl(char buffer[],int start,int stop,float x,float y){
  if (gl11 == null || gl11x == null) {
    throw new RuntimeException("String_Node_Str");
  }
  gl.glEnable(GL10.GL_TEXTURE_2D);
  if (!blend || blendMode != BLEND) {
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA,GL10.GL_ONE_MINUS_SRC_ALPHA);
  }
  if (textFont.texIDList == null) {
    textFont.initTexture(gl,maxTextureSize,maxTextureSize);
    textFont.addAllGlyphsToTexture(gl);
  }
  gl.glEnable(GL10.GL_TEXTURE_2D);
  textFont.currentTexID=textFont.texIDList[0];
  gl.glBindTexture(GL10.GL_TEXTURE_2D,textFont.currentTexID);
  gl.glColor4f(fillR,fillG,fillB,fillA);
  if (textMode == MODEL) {
    if (textVertexBuffer == null) {
      allocateTextModel();
    }
    gl.glNormal3f(0,0,1);
    textVertexCount=0;
  }
  super.textLineImpl(buffer,start,stop,x,y);
  if (textMode == MODEL && 0 < textVertexCount) {
    renderTextModel();
  }
  if (blend) {
    blend(blendMode);
  }
 else {
    noBlend();
  }
  gl.glDisable(GL10.GL_TEXTURE_2D);
}
Program: 163763
Project: 163763
Buggy source:
synchronized public void noClear(){
  if (g instanceof PGraphicsAndroid3D) {
    ((PGraphicsAndroid3D)g).noClear();
  }
}

Fixed version (ground truth):
synchronized public void noClear(){
  if (g instanceof PGraphicsAndroid3D) {
    ((PGraphicsAndroid3D)g).noClear();
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 163764
Project: 163764
Buggy source:
synchronized public void clear(){
  if (g instanceof PGraphicsAndroid3D) {
    ((PGraphicsAndroid3D)g).clear();
  }
}

Fixed version (ground truth):
synchronized public void clear(){
  if (g instanceof PGraphicsAndroid3D) {
    ((PGraphicsAndroid3D)g).clear();
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 163765
Project: 163765
Buggy source:
protected void defaultSettings(){
  super.defaultSettings();
  manipulatingCamera=false;
  perspective();
  textureMode(IMAGE);
}

Fixed version (ground truth):
protected void defaultSettings(){
  super.defaultSettings();
  manipulatingCamera=false;
  textureMode(IMAGE);
}
Program: 163766
Project: 163766
Buggy source:
protected void drawScreenTexture(){
  gl.glEnable(GL10.GL_TEXTURE_2D);
  gl.glBindTexture(GL10.GL_TEXTURE_2D,screenTexID[0]);
  gl.glDepthMask(false);
  gl.glDisable(GL10.GL_BLEND);
  gl11.glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,screenTexCrop,0);
  gl11x.glDrawTexiOES(0,0,0,width,height);
  gl.glDisable(GL10.GL_TEXTURE_2D);
  gl.glDepthMask(true);
  gl.glEnable(GL10.GL_BLEND);
}

Fixed version (ground truth):
protected void drawScreenTexture(){
  gl.glEnable(GL10.GL_TEXTURE_2D);
  gl.glBindTexture(GL10.GL_TEXTURE_2D,screenTexID[0]);
  gl.glDepthMask(false);
  gl.glDisable(GL10.GL_BLEND);
  gl11.glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,screenTexCrop,0);
  gl11x.glDrawTexiOES(0,0,0,width,height);
  gl.glDisable(GL10.GL_TEXTURE_2D);
  gl.glDepthMask(true);
  if (blend) {
    blend(blendMode);
  }
 else {
    noBlend();
  }
}
Program: 163767
Project: 163767
Buggy source:
void createDrawFramebuffer(){
  drawTexCrop=new int[4];
  drawTexCrop[0]=0;
  drawTexCrop[1]=0;
  drawTexCrop[2]=width;
  drawTexCrop[3]=height;
  drawImages=new PImage[2];
  drawImages[0]=parent.createImage(width,height,ARGB,NEAREST);
  drawImages[1]=parent.createImage(width,height,ARGB,NEAREST);
  drawTextures=new PTexture[2];
  drawTextures[0]=drawImages[0].getTexture();
  drawTextures[1]=drawImages[1].getTexture();
  drawIndex=0;
  drawFramebuffer=new PFramebuffer(parent,drawTextures[0].getGLWidth(),drawTextures[0].getGLHeight(),false);
  drawFramebuffer.addDepthBuffer(DEPTH_BITS);
  if (0 < STENCIL_BITS) {
    drawFramebuffer.addStencilBuffer(STENCIL_BITS);
  }
}

Fixed version (ground truth):
void createDrawFramebuffer(){
  drawTexCrop=new int[4];
  drawTexCrop[0]=0;
  drawTexCrop[1]=0;
  drawTexCrop[2]=width;
  drawTexCrop[3]=height;
  drawImages=new PImage[2];
  drawImages[0]=parent.createImage(width,height,ARGB,NEAREST);
  drawImages[1]=parent.createImage(width,height,ARGB,NEAREST);
  drawTextures=new PTexture[2];
  drawTextures[0]=drawImages[0].getTexture();
  drawTextures[1]=drawImages[1].getTexture();
  drawTextures[0].setFlippedY(true);
  drawTextures[1].setFlippedY(true);
  drawIndex=0;
  drawFramebuffer=new PFramebuffer(parent,drawTextures[0].getGLWidth(),drawTextures[0].getGLHeight(),false);
  drawFramebuffer.addDepthBuffer(DEPTH_BITS);
  if (0 < STENCIL_BITS) {
    drawFramebuffer.addStencilBuffer(STENCIL_BITS);
  }
}
Program: 163768
Project: 163768
Buggy source:
public void renderDrawTexture(int idx){
  PTexture tex=drawTextures[idx];
  gl.glEnable(tex.getGLTarget());
  gl.glBindTexture(tex.getGLTarget(),tex.getGLTextureID());
  gl.glDepthMask(false);
  gl.glDisable(GL10.GL_BLEND);
  gl.glTexEnvf(GL10.GL_TEXTURE_ENV,GL10.GL_TEXTURE_ENV_MODE,GL10.GL_REPLACE);
  gl11.glTexParameteriv(tex.getGLTarget(),GL11Ext.GL_TEXTURE_CROP_RECT_OES,drawTexCrop,0);
  gl11x.glDrawTexiOES(0,0,0,width,height);
  gl.glDisable(tex.getGLTarget());
  gl.glDepthMask(true);
  gl.glEnable(GL10.GL_BLEND);
}

Fixed version (ground truth):
public void renderDrawTexture(int idx){
  PTexture tex=drawTextures[idx];
  gl.glEnable(tex.getGLTarget());
  gl.glBindTexture(tex.getGLTarget(),tex.getGLTextureID());
  gl.glDepthMask(false);
  gl.glDisable(GL10.GL_BLEND);
  gl.glTexEnvf(GL10.GL_TEXTURE_ENV,GL10.GL_TEXTURE_ENV_MODE,GL10.GL_REPLACE);
  gl11.glTexParameteriv(tex.getGLTarget(),GL11Ext.GL_TEXTURE_CROP_RECT_OES,drawTexCrop,0);
  gl11x.glDrawTexiOES(0,0,0,width,height);
  gl.glDisable(tex.getGLTarget());
  gl.glDepthMask(true);
  if (blend) {
    blend(blendMode);
  }
 else {
    noBlend();
  }
}
Program: 163770
Project: 163770
Buggy source:
public void endDraw(){
  if (!clear || !primarySurface) {
    if (fboSupported) {
      if (drawFramebuffer != null) {
        popFramebuffer();
        if (primarySurface) {
          gl.glClearColor(0,0,0,0);
          gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
          renderDrawTexture(drawIndex);
        }
        swapDrawIndex();
      }
    }
 else {
      if (screenTexID[0] != 0) {
        copyFrameToScreenTexture();
      }
    }
  }
  gl.glFlush();
  if (!primarySurface) {
    ((PGraphicsAndroid3D)parent.g).restoreGLState();
  }
  report("String_Node_Str");
}

Fixed version (ground truth):
public void endDraw(){
  if (!clear || !primarySurface) {
    if (fboSupported) {
      if (drawFramebuffer != null) {
        popFramebuffer();
        if (primarySurface) {
          gl.glClearColor(0,0,0,0);
          gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
          renderDrawTexture(drawIndex);
        }
        swapDrawIndex();
      }
    }
 else {
      if (screenTexID[0] != 0) {
        copyFrameToScreenTexture();
      }
    }
  }
  if (primarySurface) {
    gl.glFlush();
  }
 else {
    ((PGraphicsAndroid3D)parent.g).restoreGLState();
  }
  report("String_Node_Str");
}
Program: 163771
Project: 163771
Buggy source:
public void mult(float[] m){
}

Fixed version (ground truth):
public void mult(float n0,float n4,float n8,float n12,float n1,float n5,float n9,float n13,float n2,float n6,float n10,float n14,float n3,float n7,float n11,float n15){
  float r0=current[0] * n0 + current[4] * n1 + current[8] * n2 + current[12] * n3;
  float r4=current[0] * n4 + current[4] * n5 + current[8] * n6 + current[12] * n7;
  float r8=current[0] * n8 + current[4] * n9 + current[8] * n10 + current[12] * n11;
  float r12=current[0] * n12 + current[4] * n13 + current[8] * n14 + current[12] * n15;
  float r1=current[1] * n0 + current[5] * n1 + current[9] * n2 + current[13] * n3;
  float r5=current[1] * n4 + current[5] * n5 + current[9] * n6 + current[13] * n7;
  float r9=current[1] * n8 + current[5] * n8 + current[9] * n10 + current[13] * n11;
  float r13=current[1] * n12 + current[5] * n13 + current[9] * n14 + current[13] * n15;
  float r2=current[2] * n0 + current[6] * n1 + current[10] * n2 + current[14] * n3;
  float r6=current[2] * n4 + current[6] * n5 + current[10] * n6 + current[14] * n7;
  float r10=current[2] * n8 + current[6] * n9 + current[10] * n10 + current[14] * n11;
  float r14=current[2] * n12 + current[6] * n13 + current[10] * n14 + current[14] * n15;
  float r3=current[3] * n0 + current[7] * n1 + current[11] * n2 + current[15] * n3;
  float r7=current[3] * n4 + current[7] * n5 + current[11] * n6 + current[15] * n7;
  float r11=current[3] * n8 + current[7] * n9 + current[11] * n10 + current[15] * n11;
  float r15=current[3] * n12 + current[7] * n13 + current[11] * n14 + current[15] * n15;
  current[0]=r0;
  current[4]=r4;
  current[8]=r8;
  current[12]=r12;
  current[1]=r1;
  current[5]=r5;
  current[9]=r9;
  current[13]=r13;
  current[2]=r2;
  current[6]=r6;
  current[10]=r10;
  current[14]=r14;
  current[3]=r3;
  current[7]=r7;
  current[11]=r11;
  current[15]=r15;
}
Program: 163772
Project: 163772
Buggy source:
public A3DMatrixStack(){
}

Fixed version (ground truth):
public A3DMatrixStack(){
  matrixStack=new Stack<float[]>();
  current=new float[16];
  set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);
}
Program: 163773
Project: 163773
Buggy source:
public void push(){
}

Fixed version (ground truth):
public void push(){
  float[] mat=new float[16];
  PApplet.arrayCopy(current,mat);
  matrixStack.push(mat);
}
Program: 163774
Project: 163774
Buggy source:
public void pop(){
}

Fixed version (ground truth):
public void pop(){
  try {
    float[] mat=matrixStack.pop();
    PApplet.arrayCopy(mat,current);
  }
 catch (  EmptyStackException e) {
    PGraphics.showWarning("String_Node_Str");
  }
}
Program: 163775
Project: 163775
Buggy source:
public void get(float[] m){
}

Fixed version (ground truth):
public void get(float[] mat){
  PApplet.arrayCopy(current,mat);
}
Program: 163776
Project: 163776
Buggy source:
public void set(float[] m){
}

Fixed version (ground truth):
public void set(float n0,float n4,float n8,float n12,float n1,float n5,float n9,float n13,float n2,float n6,float n10,float n14,float n3,float n7,float n11,float n15){
  current[0]=n0;
  current[4]=n4;
  current[8]=n8;
  current[12]=n12;
  current[1]=n1;
  current[5]=n5;
  current[9]=n9;
  current[13]=n13;
  current[2]=n2;
  current[6]=n6;
  current[10]=n10;
  current[14]=n14;
  current[3]=n3;
  current[7]=n7;
  current[11]=n11;
  current[15]=n15;
}
Program: 163777
Project: 163777
Buggy source:
public void rotate(float a,float rx,float ry,float rz){
}

Fixed version (ground truth):
public void rotate(float angle,float rx,float ry,float rz){
  float c=PApplet.cos(angle);
  float s=PApplet.sin(angle);
  float t=1.0f - c;
  mult((t * rx * rx) + c,(t * rx * ry) - (s * rz),(t * rx * rz) + (s * ry),0,(t * rx * ry) + (s * rz),(t * ry * ry) + c,(t * ry * rz) - (s * rx),0,(t * rx * rz) - (s * ry),(t * ry * rz) + (s * rx),(t * rz * rz) + c,0,0,0,0,1);
}
Program: 163778
Project: 163778
Buggy source:
public void translate(float tx,float ty,float tz){
}

Fixed version (ground truth):
public void translate(float tx,float ty,float tz){
  current[12]+=tx * current[0] + ty * current[4] + tz * current[8];
  current[13]+=tx * current[1] + ty * current[5] + tz * current[9];
  current[14]+=tx * current[2] + ty * current[6] + tz * current[10];
  current[15]+=tx * current[3] + ty * current[7] + tz * current[11];
}
Program: 163779
Project: 163779
Buggy source:
public void scale(float sx,float sy,float sz){
}

Fixed version (ground truth):
public void scale(float sx,float sy,float sz){
  current[0]*=sx;
  current[4]*=sy;
  current[8]*=sz;
  current[1]*=sx;
  current[5]*=sy;
  current[9]*=sz;
  current[2]*=sx;
  current[6]*=sy;
  current[10]*=sz;
  current[3]*=sx;
  current[7]*=sy;
  current[11]*=sz;
}
Program: 163780
Project: 163780
Buggy source:
protected void defaultSettings(){
  super.defaultSettings();
  manipulatingCamera=false;
  scalingDuringCamManip=false;
  if (usingModelviewStack) {
    modelviewStack=new A3DMatrixStack();
  }
  textureMode(IMAGE);
  if (!primarySurface) {
    PGraphicsAndroid3D a3d=(PGraphicsAndroid3D)parent.g;
    try {
      Method meth=this.getClass().getMethod("String_Node_Str",new Class[]{PGraphicsAndroid3D.class});
      recreateResourceIdx=a3d.addRecreateResourceMethod(this,meth);
    }
 catch (    Exception e) {
      recreateResourceIdx=-1;
    }
  }
}

Fixed version (ground truth):
protected void defaultSettings(){
  super.defaultSettings();
  manipulatingCamera=false;
  scalingDuringCamManip=false;
  clearColorBuffer=false;
  if (fbStack == null) {
    fbStack=new Stack<PFramebuffer>();
    screenFramebuffer=new PFramebuffer(parent,width,height,true);
    setFramebuffer(screenFramebuffer);
  }
  if (usingModelviewStack && modelviewStack == null) {
    modelviewStack=new A3DMatrixStack();
  }
  textureMode(IMAGE);
  if (!primarySurface) {
    PGraphicsAndroid3D a3d=(PGraphicsAndroid3D)parent.g;
    try {
      Method meth=this.getClass().getMethod("String_Node_Str",new Class[]{PGraphicsAndroid3D.class});
      recreateResourceIdx=a3d.addRecreateResourceMethod(this,meth);
    }
 catch (    Exception e) {
      recreateResourceIdx=-1;
    }
  }
}
Program: 163781
Project: 163781
Buggy source:
protected void backgroundImpl(){
  gl.glClearColor(backgroundR,backgroundG,backgroundB,1);
  gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
}

Fixed version (ground truth):
protected void backgroundImpl(){
  gl.glClearColor(backgroundR,backgroundG,backgroundB,1);
  gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
  if (0 < parent.frameCount) {
    clearColorBuffer=true;
  }
}
Program: 163783
Project: 163783
Buggy source:
public void endDraw(){
  if (!clear || !primarySurface) {
    if (fboSupported) {
      if (drawFramebuffer != null) {
        popFramebuffer();
        if (primarySurface) {
          gl.glClearColor(0,0,0,0);
          gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
          renderDrawTexture(drawIndex);
        }
        swapDrawIndex();
      }
    }
 else {
      if (screenTexID[0] != 0) {
        copyFrameToScreenTexture();
      }
    }
  }
  if (primarySurface) {
    gl.glFlush();
  }
 else {
    ((PGraphicsAndroid3D)parent.g).restoreGLState();
  }
  report("String_Node_Str");
}

Fixed version (ground truth):
public void endDraw(){
  if (primarySurface) {
    if (!clearColorBuffer0) {
      if (fboSupported) {
        if (drawFramebuffer != null) {
          popFramebuffer();
          gl.glClearColor(0,0,0,0);
          gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
          renderDrawTexture(drawIndex);
          swapDrawIndex();
        }
      }
 else {
        if (screenTexID[0] != 0) {
          copyFrameToScreenTexture();
        }
      }
    }
  }
 else {
    if (drawFramebuffer != null) {
      popFramebuffer();
      swapDrawIndex();
    }
  }
  if (primarySurface) {
    gl.glFlush();
  }
 else {
    ((PGraphicsAndroid3D)parent.g).restoreGLState();
  }
  report("String_Node_Str");
}
Program: 163784
Project: 163784
Buggy source:
/** 
 * Copy texture to pixels. Involves video memory to main memory transfer (slow).
 */
public void get(int[] pixels){
  if ((pixels == null) || (pixels.length != width * height)) {
    pixels=new int[width * height];
  }
  int size=glWidth * glHeight;
  int[] tmp=new int[size];
  IntBuffer pixelBuffer=BufferUtil.newIntBuffer(size);
  PFramebuffer fbo=new PFramebuffer(parent,glWidth,glHeight);
  fbo.addColorBuffer(this);
  a3d.pushFramebuffer();
  a3d.setFramebuffer(fbo);
  gl.glReadPixels(0,0,glWidth,glHeight,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,pixelBuffer);
  a3d.popFramebuffer();
  pixelBuffer.get(tmp);
  pixelBuffer.rewind();
  convertToARGB(tmp,pixels);
  if (flippedX)   flipArrayOnX(pixels,1);
  if (flippedY)   flipArrayOnY(pixels,1);
}

Fixed version (ground truth):
/** 
 * Copy texture to pixels. Involves video memory to main memory transfer (slow).
 */
public void get(int[] pixels){
  if ((pixels == null) || (pixels.length != width * height)) {
    pixels=new int[width * height];
  }
  int size=glWidth * glHeight;
  int[] tmp=new int[size];
  IntBuffer pixelBuffer=BufferUtil.newIntBuffer(size);
  PFramebuffer fbo=new PFramebuffer(parent,glWidth,glHeight);
  fbo.setColorBuffer(this);
  a3d.pushFramebuffer();
  a3d.setFramebuffer(fbo);
  gl.glReadPixels(0,0,glWidth,glHeight,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,pixelBuffer);
  a3d.popFramebuffer();
  pixelBuffer.get(tmp);
  pixelBuffer.rewind();
  convertToARGB(tmp,pixels);
  if (flippedX)   flipArrayOnX(pixels,1);
  if (flippedY)   flipArrayOnY(pixels,1);
}
Program: 163785
Project: 163785
Buggy source:
protected void addToTexture(GL10 gl){
  if (offsetX + width > texWidth) {
    offsetX=0;
    offsetY+=lineHeight;
    lineHeight=0;
  }
  lineHeight=Math.max(lineHeight,height);
  if (offsetY + lineHeight > texHeight) {
    addTexture(gl);
    offsetX=0;
    offsetY=0;
    lineHeight=0;
  }
  int[] rgba=new int[width * height];
  int t=0;
  int p=0;
  if (PGraphicsAndroid3D.BIG_ENDIAN) {
    for (int y=0; y < height; y++) {
      for (int x=0; x < width; x++) {
        rgba[t++]=255 << 24 | 255 << 16 | 0 << 8 | 0;
      }
    }
  }
 else {
    for (int y=0; y < height; y++) {
      for (int x=0; x < width; x++) {
        rgba[t++]=255 << 24 | 0 << 16 | 0 << 8 | 0;
      }
    }
  }
  gl.glTexSubImage2D(GL10.GL_TEXTURE_2D,0,offsetX,offsetY,width,height,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,IntBuffer.wrap(rgba));
  texture=new TextureInfo(currentID,offsetX,offsetY,width,height);
  offsetX+=width;
}

Fixed version (ground truth):
protected void addToTexture(GL10 gl){
  if (offsetX + width > texWidth) {
    offsetX=0;
    offsetY+=lineHeight;
    lineHeight=0;
  }
  lineHeight=Math.max(lineHeight,height);
  if (offsetY + lineHeight > texHeight) {
    addTexture(gl);
    offsetX=0;
    offsetY=0;
    lineHeight=0;
  }
  int[] rgba=new int[width * height];
  int t=0;
  int p=0;
  if (PGraphicsAndroid3D.BIG_ENDIAN) {
    for (int y=0; y < height; y++) {
      for (int x=0; x < width; x++) {
        rgba[t++]=0xFFFFFF00 | image.pixels[p++];
      }
    }
  }
 else {
    for (int y=0; y < height; y++) {
      for (int x=0; x < width; x++) {
        rgba[t++]=(image.pixels[p++] << 24) | 0x00FFFFFF;
      }
    }
  }
  gl.glTexSubImage2D(GL10.GL_TEXTURE_2D,0,offsetX,offsetY,width,height,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,IntBuffer.wrap(rgba));
  texture=new TextureInfo(currentID,offsetX,offsetY,width,height);
  offsetX+=width;
}
Program: 163786
Project: 163786
Buggy source:
protected void textCharModelImpl(Glyph.TextureInfo tex,float x1,float y1,float x2,float y2,int u2,int v2){
  if (textFontTexID != textFont.currentID) {
    textFontTexID=textFont.currentID;
    gl.glBindTexture(GL10.GL_TEXTURE_2D,textFontTexID);
  }
  ((GL11)gl).glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,tex.crop,0);
  ((GL11Ext)gl).glDrawTexiOES((int)x1,height - (int)y1,0,(int)(x2 - x1),(int)(y2 - y1));
}

Fixed version (ground truth):
protected void textCharModelImpl(Glyph.TextureInfo tex,float x1,float y1,float x2,float y2,int u2,int v2){
  if (textFontTexID != tex.glid) {
    textFontTexID=tex.glid;
    gl.glBindTexture(GL10.GL_TEXTURE_2D,textFontTexID);
  }
  ((GL11)gl).glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,tex.crop,0);
  ((GL11Ext)gl).glDrawTexiOES((int)x1,height - (int)y1,0,(int)(x2 - x1),(int)(y2 - y1));
}
Program: 163787
Project: 163787
Buggy source:
/** 
 * Implementation of actual drawing for a line of text.
 */
protected void textLineImpl(char buffer[],int start,int stop,float x,float y){
  if (textFont.mTextureID == -1) {
    textFont.initialize(gl,maxTextureSize,maxTextureSize);
    textFont.addToTexture(gl);
  }
  textFontTexID=textFont.currentID;
  gl.glBindTexture(GL10.GL_TEXTURE_2D,textFontTexID);
  gl.glEnable(GL10.GL_TEXTURE_2D);
  gl.glShadeModel(GL10.GL_FLAT);
  gl.glMatrixMode(GL10.GL_PROJECTION);
  gl.glPushMatrix();
  gl.glLoadIdentity();
  gl.glOrthof(0.0f,width,0.0f,height,0.0f,1.0f);
  gl.glMatrixMode(GL10.GL_MODELVIEW);
  gl.glPushMatrix();
  gl.glLoadIdentity();
  super.textLineImpl(buffer,start,stop,x,y);
  gl.glMatrixMode(GL10.GL_PROJECTION);
  gl.glPopMatrix();
  gl.glMatrixMode(GL10.GL_MODELVIEW);
  gl.glPopMatrix();
}

Fixed version (ground truth):
/** 
 * Implementation of actual drawing for a line of text.
 */
protected void textLineImpl(char buffer[],int start,int stop,float x,float y){
  if (textFont.mTextureID == -1) {
    textFont.initialize(gl,maxTextureSize,maxTextureSize);
    textFont.addToTexture(gl);
  }
  textFontTexID=textFont.currentID;
  gl.glBindTexture(GL10.GL_TEXTURE_2D,textFontTexID);
  gl.glEnable(GL10.GL_TEXTURE_2D);
  gl.glMatrixMode(GL10.GL_PROJECTION);
  gl.glPushMatrix();
  gl.glLoadIdentity();
  gl.glOrthof(0.0f,width,0.0f,height,0.0f,1.0f);
  gl.glMatrixMode(GL10.GL_MODELVIEW);
  gl.glPushMatrix();
  gl.glLoadIdentity();
  super.textLineImpl(buffer,start,stop,x,y);
  gl.glMatrixMode(GL10.GL_PROJECTION);
  gl.glPopMatrix();
  gl.glMatrixMode(GL10.GL_MODELVIEW);
  gl.glPopMatrix();
}
Program: 163788
Project: 163788
Buggy source:
protected void textCharScreenImpl(Glyph.TextureInfo tex,int xx,int yy,int w0,int h0){
  if (textFontTexID != textFont.currentID) {
    textFontTexID=textFont.currentID;
    gl.glBindTexture(GL10.GL_TEXTURE_2D,textFontTexID);
  }
  ((GL11)gl).glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,tex.crop,0);
  ((GL11Ext)gl).glDrawTexiOES((int)xx,(int)yy,0,(int)w0,(int)h0);
}

Fixed version (ground truth):
protected void textCharScreenImpl(Glyph.TextureInfo tex,int xx,int yy,int w0,int h0){
  if (textFontTexID != tex.glid) {
    textFontTexID=tex.glid;
    gl.glBindTexture(GL10.GL_TEXTURE_2D,textFontTexID);
  }
  ((GL11)gl).glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,tex.crop,0);
  ((GL11Ext)gl).glDrawTexiOES((int)xx,(int)yy,0,(int)w0,(int)h0);
}
Program: 163789
Project: 163789
Buggy source:
public void render(int gr0,int gr1){
  int texTarget=GL11.GL_TEXTURE_2D;
  GLTexture tex;
  float pointSize;
  gl.glLineWidth(a3d.strokeWeight);
  pointSize=PApplet.min(a3d.strokeWeight,a3d.maxPointSize);
  gl.glPointSize(pointSize);
  gl.glEnableClientState(GL11.GL_NORMAL_ARRAY);
  gl.glBindBuffer(GL11.GL_ARRAY_BUFFER,glNormalBufferID[0]);
  gl.glNormalPointer(GL11.GL_FLOAT,0,0);
  gl.glEnableClientState(GL11.GL_COLOR_ARRAY);
  gl.glBindBuffer(GL11.GL_ARRAY_BUFFER,glColorBufferID[0]);
  gl.glColorPointer(4,GL11.GL_FLOAT,0,0);
  gl.glEnableClientState(GL11.GL_VERTEX_ARRAY);
  gl.glBindBuffer(GL11.GL_ARRAY_BUFFER,glVertexBufferID[0]);
  gl.glVertexPointer(3,GL11.GL_FLOAT,0,0);
  VertexGroup group;
  for (int i=gr0; i <= gr1; i++) {
    group=(VertexGroup)groups.get(i);
    tex=group.texture;
    if (tex != null) {
      texTarget=group.texture.getGLTarget();
      gl.glEnable(texTarget);
      gl.glActiveTexture(GL11.GL_TEXTURE0);
      gl.glBindTexture(GL11.GL_TEXTURE_2D,group.texture.getGLTextureID());
      if (pointSprites) {
        float quadratic[]={1.0f,0.0f,0.01f,1};
        ByteBuffer temp=ByteBuffer.allocateDirect(16);
        temp.order(ByteOrder.nativeOrder());
        gl.glPointParameterfv(GL11.GL_POINT_DISTANCE_ATTENUATION,(FloatBuffer)temp.asFloatBuffer().put(quadratic).flip());
        gl.glPointParameterf(GL11.GL_POINT_FADE_THRESHOLD_SIZE,0.6f * pointSize);
        gl.glPointParameterf(GL11.GL_POINT_SIZE_MIN,1.0f);
        gl.glPointParameterf(GL11.GL_POINT_SIZE_MAX,a3d.maxPointSize);
        gl.glTexEnvf(GL11.GL_POINT_SPRITE_OES,GL11.GL_COORD_REPLACE_OES,GL11.GL_TRUE);
        gl.glEnable(GL11.GL_POINT_SPRITE_OES);
      }
 else {
        gl.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
        gl.glClientActiveTexture(GL11.GL_TEXTURE0);
        gl.glBindBuffer(GL11.GL_ARRAY_BUFFER,glTexCoordBufferID[0]);
        gl.glTexCoordPointer(2,GL11.GL_FLOAT,0,0);
      }
    }
    gl.glPushMatrix();
    gl.glScalef(1,-1,1);
    gl.glDrawArrays(glMode,group.first,group.last - group.first + 1);
    gl.glPopMatrix();
    if (tex != null) {
      if (pointSprites) {
        gl.glDisable(GL11.GL_POINT_SPRITE_OES);
      }
 else {
        gl.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
      }
      gl.glDisable(texTarget);
    }
  }
  gl.glDisableClientState(GL11.GL_VERTEX_ARRAY);
  gl.glDisableClientState(GL11.GL_COLOR_ARRAY);
  gl.glDisableClientState(GL11.GL_NORMAL_ARRAY);
}

Fixed version (ground truth):
public void render(int gr0,int gr1){
  int texTarget=GL11.GL_TEXTURE_2D;
  GLTexture tex;
  float pointSize;
  gl.glLineWidth(a3d.strokeWeight);
  pointSize=PApplet.min(a3d.strokeWeight,a3d.maxPointSize);
  gl.glPointSize(pointSize);
  gl.glEnableClientState(GL11.GL_NORMAL_ARRAY);
  gl.glBindBuffer(GL11.GL_ARRAY_BUFFER,glNormalBufferID[0]);
  gl.glNormalPointer(GL11.GL_FLOAT,0,0);
  gl.glDisableClientState(GL11.GL_NORMAL_ARRAY);
  System.out.println("String_Node_Str");
}
Program: 163791
Project: 163791
Buggy source:
protected void renderPoints(int start,int stop){
  gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
  if (vertexBuffer.capacity() == stop - start) {
    expandBuffers();
  }
  vertexBuffer.rewind();
  colorBuffer.rewind();
  float sw=vertices[lines[start][VERTEX1]][SW];
  if (sw > 0) {
    gl.glPointSize(sw);
    for (int i=start; i < stop; i++) {
      float[] a=vertices[points[i][VERTEX1]];
      colorBuffer.put(toFixed16(a[SR]));
      colorBuffer.put(toFixed16(a[SG]));
      colorBuffer.put(toFixed16(a[SB]));
      colorBuffer.put(toFixed16(a[SA]));
      vertexBuffer.put(toFixed32(a[VX]));
      vertexBuffer.put(toFixed32(a[VY]));
      vertexBuffer.put(toFixed32(a[VZ]));
    }
    gl.glVertexPointer(3,GL10.GL_FIXED,0,vertexBuffer);
    gl.glColorPointer(4,GL10.GL_FIXED,0,colorBuffer);
    gl.glDrawArrays(GL10.GL_POINTS,start,stop - start);
  }
  gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
}

Fixed version (ground truth):
protected void renderPoints(int start,int stop){
  gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
  if (vertexBuffer.capacity() / 3 < 3 * (stop - start)) {
    expandBuffers();
  }
  vertexBuffer.rewind();
  colorBuffer.rewind();
  float sw=vertices[lines[start][VERTEX1]][SW];
  if (sw > 0) {
    gl.glPointSize(sw);
    for (int i=start; i < stop; i++) {
      float[] a=vertices[points[i][VERTEX1]];
      colorBuffer.put(toFixed16(a[SR]));
      colorBuffer.put(toFixed16(a[SG]));
      colorBuffer.put(toFixed16(a[SB]));
      colorBuffer.put(toFixed16(a[SA]));
      vertexBuffer.put(toFixed32(a[VX]));
      vertexBuffer.put(toFixed32(a[VY]));
      vertexBuffer.put(toFixed32(a[VZ]));
    }
    gl.glVertexPointer(3,GL10.GL_FIXED,0,vertexBuffer);
    gl.glColorPointer(4,GL10.GL_FIXED,0,colorBuffer);
    gl.glDrawArrays(GL10.GL_POINTS,start,stop - start);
  }
  gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
}
Program: 163793
Project: 163793
Buggy source:
public void skewX(float angle){
  apply(1,0,1,angle,0,0);
}

Fixed version (ground truth):
public void skewX(float angle){
  apply(1,0,1,tan(angle),0,0);
}
Program: 163794
Project: 163794
Buggy source:
public void skewY(float angle){
  apply(1,0,1,0,angle,0);
}

Fixed version (ground truth):
public void skewY(float angle){
  apply(1,0,1,0,tan(angle),0);
}
Program: 163795
Project: 163795
Buggy source:
protected boolean isWarped(){
  return ((m00 != 1) || (m01 != 0) && (m10 != 0) || (m11 != 1));
}

Fixed version (ground truth):
protected boolean isWarped(){
  return ((m00 != 1) || (m01 != 0) || (m10 != 0)|| (m11 != 1));
}
Program: 163796
Project: 163796
Buggy source:
/** 
 * Preferred method of creating new PImage objects, ensures that a reference to the parent PApplet is included, which makes save() work without needing an absolute path.
 */
public PImage createImage(int wide,int high,int format){
  PImage image=new PImage(wide,high,format);
  image.parent=this;
  if (g instanceof PGraphicsAndroid3D) {
    image.format=ARGB;
    image.initTexture();
  }
  return image;
}

Fixed version (ground truth):
public PImage createImage(int wide,int high,GLTexture.Parameters params){
  PImage image=new PImage(wide,high,params.format);
  image.parent=this;
  if (g instanceof PGraphicsAndroid3D) {
    image.format=params.format;
    image.initTexture(params);
  }
  return image;
}
Program: 163797
Project: 163797
Buggy source:
protected void drawScreenTexture(){
  screenVertBuffer.position(0);
  screenTexCoordBuffer.position(0);
  gl.glColor4f(1.0f,1.0f,1.0f,1.0f);
  gl.glEnable(GL10.GL_TEXTURE_2D);
  gl.glBindTexture(GL10.GL_TEXTURE_2D,screenTexID[0]);
  gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
  gl.glVertexPointer(3,GL10.GL_FIXED,0,screenVertBuffer);
  gl.glTexCoordPointer(2,GL10.GL_FIXED,0,screenTexCoordBuffer);
  gl.glDrawArrays(GL10.GL_TRIANGLES,0,3 * 2);
  gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
  gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}

Fixed version (ground truth):
protected void drawScreenTexture(){
  beginShape(QUADS);
  texture(screenTex);
  vertex(0,0,0,screenTex.height);
  vertex(width,0,screenTex.width,screenTex.height);
  vertex(width,height,screenTex.width,0);
  vertex(0,height,0,0);
  endShape();
}
Program: 163799
Project: 163799
Buggy source:
/** 
 * OpenGL cannot draw until a proper native peer is available, so this returns the value of PApplet.isDisplayable() (inherited from Component).
 */
public void beginDraw(){
  if (!settingsInited)   defaultSettings();
  resetMatrix();
  report("String_Node_Str");
  vertexBuffer.rewind();
  colorBuffer.rewind();
  texCoordBuffer.rewind();
  normalBuffer.rewind();
  textureImage=null;
  textureImagePrev=null;
  gl.glEnable(GL10.GL_BLEND);
  gl.glBlendFunc(GL10.GL_SRC_ALPHA,GL10.GL_ONE_MINUS_SRC_ALPHA);
  if (hints[DISABLE_DEPTH_TEST]) {
    gl.glDisable(GL10.GL_DEPTH_TEST);
  }
 else {
    gl.glEnable(GL10.GL_DEPTH_TEST);
  }
  gl.glDepthFunc(GL10.GL_LEQUAL);
  gl.glFrontFace(GL10.GL_CW);
  gl.glViewport(0,0,width,height);
  camera();
  perspective();
  lightCount=0;
  lightFalloff(1,0,0);
  lightSpecular(0,0,0);
  gl.glEnable(GL10.GL_COLOR_MATERIAL);
  gl.glEnable(GL10.GL_NORMALIZE);
  gl.glEnable(GL10.GL_RESCALE_NORMAL);
  shapeFirst=0;
  if (screenTexID[0] == 0) {
    createScreenTexture();
  }
  tint(255);
  beginShape(QUADS);
  texture(screenTex);
  vertex(0,0,0,screenTex.height);
  vertex(width,0,screenTex.width,screenTex.height);
  vertex(width,height,screenTex.width,0);
  vertex(0,height,0,0);
  endShape();
  report("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * OpenGL cannot draw until a proper native peer is available, so this returns the value of PApplet.isDisplayable() (inherited from Component).
 */
public void beginDraw(){
  if (!settingsInited)   defaultSettings();
  resetMatrix();
  report("String_Node_Str");
  vertexBuffer.rewind();
  colorBuffer.rewind();
  texCoordBuffer.rewind();
  normalBuffer.rewind();
  textureImage=null;
  textureImagePrev=null;
  gl.glEnable(GL10.GL_BLEND);
  gl.glBlendFunc(GL10.GL_SRC_ALPHA,GL10.GL_ONE_MINUS_SRC_ALPHA);
  if (hints[DISABLE_DEPTH_TEST]) {
    gl.glDisable(GL10.GL_DEPTH_TEST);
  }
 else {
    gl.glEnable(GL10.GL_DEPTH_TEST);
  }
  gl.glDepthFunc(GL10.GL_LEQUAL);
  gl.glFrontFace(GL10.GL_CW);
  gl.glViewport(0,0,width,height);
  camera();
  perspective();
  lightCount=0;
  lightFalloff(1,0,0);
  lightSpecular(0,0,0);
  gl.glEnable(GL10.GL_COLOR_MATERIAL);
  gl.glEnable(GL10.GL_NORMALIZE);
  gl.glEnable(GL10.GL_RESCALE_NORMAL);
  shapeFirst=0;
  if (clear) {
    gl.glClearColor(0,0,0,0);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
  }
 else {
    if (screenTex == null || screenTex.width != width || screenTex.height != height) {
      createScreenTexture();
    }
    drawScreenTexture();
  }
  report("String_Node_Str");
}
Program: 163800
Project: 163800
Buggy source:
public void endDraw(){
  copyFrameToScreenTexture();
  gl.glFlush();
  report("String_Node_Str");
}

Fixed version (ground truth):
public void endDraw(){
  if (!clear && screenTex != null) {
    copyFrameToScreenTexture();
  }
  gl.glFlush();
  report("String_Node_Str");
}
Program: 163801
Project: 163801
Buggy source:
public void setSize(int iwidth,int iheight){
  width=iwidth;
  height=iheight;
  width1=width - 1;
  height1=height - 1;
  allocate();
  reapplySettings();
  deleteScreenTexture();
  vertexCheck();
  cameraFOV=60 * DEG_TO_RAD;
  cameraX=width / 2.0f;
  cameraY=height / 2.0f;
  cameraZ=cameraY / ((float)Math.tan(cameraFOV / 2.0f));
  cameraNear=cameraZ / 10.0f;
  cameraFar=cameraZ * 10.0f;
  cameraAspect=(float)width / (float)height;
}

Fixed version (ground truth):
public void setSize(int iwidth,int iheight){
  width=iwidth;
  height=iheight;
  width1=width - 1;
  height1=height - 1;
  allocate();
  reapplySettings();
  vertexCheck();
  cameraFOV=60 * DEG_TO_RAD;
  cameraX=width / 2.0f;
  cameraY=height / 2.0f;
  cameraZ=cameraY / ((float)Math.tan(cameraFOV / 2.0f));
  cameraNear=cameraZ / 10.0f;
  cameraFar=cameraZ * 10.0f;
  cameraAspect=(float)width / (float)height;
}
Program: 163802
Project: 163802
Buggy source:
protected void createScreenTexture(){
  int[] pix=new int[width * height];
  for (int i=0; i < width * height; i++)   pix[i]=0xFF000000;
  gl.glGenTextures(1,screenTexID,0);
  gl.glBindTexture(GL10.GL_TEXTURE_2D,screenTexID[0]);
  gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_MIN_FILTER,GL10.GL_LINEAR);
  gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_MAG_FILTER,GL10.GL_LINEAR);
  gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_WRAP_S,GL10.GL_CLAMP_TO_EDGE);
  gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_WRAP_T,GL10.GL_CLAMP_TO_EDGE);
  gl.glTexImage2D(GL10.GL_TEXTURE_2D,0,GL10.GL_RGBA,width,height,0,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,IntBuffer.wrap(pix));
  gl.glBindTexture(GL10.GL_TEXTURE_2D,0);
  int fw=toFixed32(width);
  int fh=toFixed32(height);
  int one=toFixed32(1.0f);
  int[] quadCoords={0,fh,0,0,0,0,fw,0,0,0,fh,0,fw,0,0,fw,fh,0};
  int[] quadTexCoords={0,one,0,0,one,0,0,one,one,0,one,one};
  screenVertBuffer.position(0);
  screenTexCoordBuffer.position(0);
  screenVertBuffer.put(quadCoords);
  screenTexCoordBuffer.put(quadTexCoords);
  screenTex=parent.createImage(width,height,ARGB);
  screenTex.getTexture().set(pix);
}

Fixed version (ground truth):
protected void createScreenTexture(){
  int[] pix=new int[width * height];
  for (int i=0; i < width * height; i++)   pix[i]=0xFF0000;
  screenTex=parent.createImage(width,height,ARGB,GLConstants.NEAREST);
  screenTex.getTexture().set(pix);
}
Program: 163803
Project: 163803
Buggy source:
public void initTexture(){
  texture=new GLTexture(parent,width,height,new GLTexture.Parameters(format));
  updateTexture();
}

Fixed version (ground truth):
public void initTexture(GLTexture.Parameters params){
  texture=new GLTexture(parent,width,height,params);
  updateTexture();
}
Program: 163804
Project: 163804
Buggy source:
public AndroidSDK(final String sdkPath) throws BadSDKException, IOException {
  sdk=new File(sdkPath);
  if (!sdk.exists()) {
    throw new BadSDKException(sdk + "String_Node_Str");
  }
  tools=new File(sdk,"String_Node_Str");
  if (!tools.exists()) {
    throw new BadSDKException("String_Node_Str" + sdk);
  }
  androidTool=findAndroidTool(tools);
  final Platform p=Base.getPlatform();
  p.setenv("String_Node_Str",sdk.getCanonicalPath());
  p.setenv("String_Node_Str",tools.getCanonicalPath() + File.pathSeparator + p.getenv("String_Node_Str"));
}

Fixed version (ground truth):
public AndroidSDK(final String sdkPath) throws BadSDKException, IOException {
  sdk=new File(sdkPath);
  if (!sdk.exists()) {
    throw new BadSDKException(sdk + "String_Node_Str");
  }
  tools=new File(sdk,"String_Node_Str");
  if (!tools.exists()) {
    throw new BadSDKException("String_Node_Str" + sdk);
  }
  androidTool=findAndroidTool(tools);
  final Platform p=Base.getPlatform();
  String path=p.getenv("String_Node_Str");
  p.setenv("String_Node_Str",sdk.getCanonicalPath());
  path=tools.getCanonicalPath() + File.pathSeparator + path;
  final String javaHomeProp=System.getProperty("String_Node_Str");
  if (javaHomeProp == null) {
    throw new RuntimeException("String_Node_Str");
  }
  final File javaHome=new File(javaHomeProp).getCanonicalFile();
  p.setenv("String_Node_Str",javaHome.getCanonicalPath());
  path=new File(javaHome,"String_Node_Str").getCanonicalPath() + File.pathSeparator + path;
  p.setenv("String_Node_Str",path);
}
Program: 163805
Project: 163805
Buggy source:
public void requestDraw(){
  ((GLSurfaceView)parent.surfaceView).requestRender();
}

Fixed version (ground truth):
public void requestDraw(){
  if (parent.looping) {
    ((GLSurfaceView)parent.surfaceView).requestRender();
  }
}