0

我正在尝试制作一个处理程序,但如果我使用 P2D、P3D 或 OPENGL 模式,我会收到错误消息:

com.sun.jdi.VMDisconnectedException
    at com.sun.tools.jdi.TargetVM.waitForReply(TargetVM.java:285)
    at com.sun.tools.jdi.VirtualMachineImpl.waitForTargetReply(VirtualMachineImpl.java:1015)
    at com.sun.tools.jdi.PacketStream.waitForReply(PacketStream.java:51)
    at com.sun.tools.jdi.JDWP$ObjectReference$InvokeMethod.waitForReply(JDWP.java:4589)
    at com.sun.tools.jdi.ObjectReferenceImpl.invokeMethod(ObjectReferenceImpl.java:374)
    at processing.mode.java.runner.Runner.findException(Runner.java:701)
    at processing.mode.java.runner.Runner.reportException(Runner.java:652)
    at processing.mode.java.runner.Runner.exception(Runner.java:595)
    at processing.mode.java.runner.EventThread.exceptionEvent(EventThread.java:367)
    at processing.mode.java.runner.EventThread.handleEvent(EventThread.java:255)
    at processing.mode.java.runner.EventThread.run(EventThread.java:89)

错误消息本身在 P2D 和 P3D 之间有所不同,但它们都得到 no framebuffer objects available 错误。我正在使用处理 2.0b7,如果您需要更多信息,请帮助并告诉我。注意:我不知道这是否是一个单独的问题,但我也收到了 GLSL 着色器错误。现在,这是我的代码:

Cell[][] Cells = new Cell[50][50];
byte Direction = 1;
byte Times = 1;
int oldwidth = 500;
int oldheight = 500;
void setup() {
  size(oldwidth, oldheight, OPENGL);
  background(255);
  colorMode(HSB,250);
  for (int x = 0; x < 50; x++) {
    for (int y = 0; y < 50; y++) {
      Cells[x][y] = new Cell(x * 5, y * 5, 255, x * (width / 50), y * (height / 50), width / 50, height / 50);
    }
  }
}
void draw() {
  for (int x = 0; x < 50; x++) {
    for (int y = 0; y < 50; y++) {
      if (width == oldwidth) Cells[x][y].Width = width / 50;
      if (height == oldheight) Cells[x][y].Height = height / 50;
      if (Direction == 1){
        Cells[x][y].Hue += 5;
        if (Cells[x][y].Hue > 250) Cells[x][y].Hue -= 250;
      }
      if (Direction == 2){
        Cells[x][y].Saturation -= 5;
        if (Cells[x][y].Saturation < 0) Cells[x][y].Saturation += 500;
      }
      if (Direction == 3){
        Cells[x][y].Hue -= 5;
        if (Cells[x][y].Hue < 0) Cells[x][y].Hue += 250;
      }
      if (Direction == 4){
        Cells[x][y].Saturation += 5;
        if (Cells[x][y].Saturation > 500) Cells[x][y].Saturation -= 500;
      }
      Cells[x][y].Draw();
    }
  }
  if (Times == 50){
    Times = 1;
    if (Direction == 4) Direction = 1; else Direction += 1;
  } else Times += 1;
  delay(10);
}
class Cell {
  int X;
  int Y;
  int Width;
  int Height;
  float Hue;
  float Saturation;
  float Brightness;
  Cell(color parC, int parX, int parY, int parWidth, int parHeight) {
    Hue = hue(parC);
    Saturation = saturation(parC);
    Brightness = brightness(parC);
    X = parX;
    Y = parY;
    Width = parWidth;
    Height = parHeight;
  }
  Cell(float parHue, float parSaturation, float parBrightness, int parX, int parY, int parWidth, int parHeight) {
    Hue = parHue;
    Saturation = parSaturation;
    Brightness = parBrightness;
    X = parX;
    Y = parY;
    Width = parWidth;
    Height = parHeight;
  }
  void Draw() {
    if (Saturation > 250) if (Saturation > 500) stroke(color(Hue,0,Brightness)); else stroke(color(Hue,Saturation - (Saturation - 250) * 2,Brightness)); else stroke(color(Hue,Saturation,Brightness));
    if (Saturation > 250) if (Saturation > 500) fill(color(Hue,0,Brightness)); else fill(color(Hue,Saturation - (Saturation - 250) * 2,Brightness)); else fill(color(Hue,Saturation,Brightness));
    rect(X, Y, Width, Height);
  }
}
4

1 回答 1

0

我才发现只是我的显卡不支持 OPENGL 2.0

于 2013-01-25T13:30:51.823 回答