Package com.badlogic.gdx.utils

Examples of com.badlogic.gdx.utils.GdxRuntimeException


    else if (pixels instanceof IntBuffer)
      GL11.glReadPixels(x, y, width, height, format, type, (IntBuffer)pixels);
    else if (pixels instanceof FloatBuffer)
      GL11.glReadPixels(x, y, width, height, format, type, (FloatBuffer)pixels);
    else
      throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
        + " with this method. Use ByteBuffer, ShortBuffer, IntBuffer or FloatBuffer instead. Blame LWJGL");
  }
View Full Code Here


    else if (pixels instanceof FloatBuffer)
      GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (FloatBuffer)pixels);
    else if (pixels instanceof DoubleBuffer)
      GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (DoubleBuffer)pixels);
    else
      throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
        + " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL");
  }
View Full Code Here

    else if (pixels instanceof FloatBuffer)
      GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (FloatBuffer)pixels);
    else if (pixels instanceof DoubleBuffer)
      GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (DoubleBuffer)pixels);
    else
      throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
        + " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL");
  }
View Full Code Here

      else if (type == GL_UNSIGNED_SHORT)
        GL20.glVertexAttribPointer(indx, size, true, normalized, stride, ((ByteBuffer)buffer).asShortBuffer());
      else if (type == GL_FLOAT)
        GL20.glVertexAttribPointer(indx, size, normalized, stride, ((ByteBuffer)buffer).asFloatBuffer());
      else
        throw new GdxRuntimeException(
          "Can't use "
            + buffer.getClass().getName()
            + " with type "
            + type
            + " with this method. Use ByteBuffer and one of GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT or GL_FLOAT for type. Blame LWJGL");
    } else if (buffer instanceof FloatBuffer) {
      if (type == GL_FLOAT)
        GL20.glVertexAttribPointer(indx, size, normalized, stride, (FloatBuffer)buffer);
      else
        throw new GdxRuntimeException(
          "Can't use "
            + buffer.getClass().getName()
            + " with type "
            + type
            + " with this method.");
    } else
      throw new GdxRuntimeException("Can't use " + buffer.getClass().getName()
        + " with this method. Use ByteBuffer instead. Blame LWJGL");
  }
View Full Code Here

    this.input = input;
    try {
      total = input.available();
    } catch (IOException ex) {
      throw new GdxRuntimeException(ex);
    }

    init();
  }
View Full Code Here

    }

    try {
      bytes = input.read(buffer, index, BUFFER_SIZE);
    } catch (Exception e) {
      throw new GdxRuntimeException("Failure reading Vorbis.", e);
    }
    syncState.wrote(bytes);

    // Get the first page.
    if (syncState.pageout(page) != 1) {
      // have we simply run out of data? If so, we're done.
      if (bytes < BUFFER_SIZE) return false;

      // error case. Must not be Vorbis data
      throw new GdxRuntimeException("Input does not appear to be an Ogg bitstream.");
    }

    // Get the serial number and set up the rest of decode.
    // serialno first; use it to set up a logical stream
    streamState.init(page.serialno());

    // extract the initial header from the first page and verify that the
    // Ogg bitstream is in fact Vorbis data

    // I handle the initial header first instead of just having the code
    // read all three Vorbis headers at once because reading the initial
    // header is an easy way to identify a Vorbis bitstream and it's
    // useful to see that functionality seperated out.

    oggInfo.init();
    comment.init();
    if (streamState.pagein(page) < 0) {
      // error; stream version mismatch perhaps
      throw new GdxRuntimeException("Error reading first page of Ogg bitstream.");
    }

    if (streamState.packetout(packet) != 1) {
      // no page? must not be vorbis
      throw new GdxRuntimeException("Error reading initial header packet.");
    }

    if (oggInfo.synthesis_headerin(comment, packet) < 0) {
      // error case; not a vorbis header
      throw new GdxRuntimeException("Ogg bitstream does not contain Vorbis audio data.");
    }

    // At this point, we're sure we're Vorbis. We've set up the logical
    // (Ogg) bitstream decoder. Get the comment and codebook headers and
    // set up the Vorbis decoder

    // The next two packets in order are the comment and codebook headers.
    // They're likely large and may span multiple pages. Thus we reead
    // and submit data until we get our two pacakets, watching that no
    // pages are missing. If a page is missing, error out; losing a
    // header page is the only place where missing data is fatal. */

    int i = 0;
    while (i < 2) {
      while (i < 2) {
        int result = syncState.pageout(page);
        if (result == 0) break; // Need more data
        // Don't complain about missing or corrupt data yet. We'll
        // catch it at the packet output phase

        if (result == 1) {
          streamState.pagein(page); // we can ignore any errors here
          // as they'll also become apparent
          // at packetout
          while (i < 2) {
            result = streamState.packetout(packet);
            if (result == 0) break;
            if (result == -1) {
              // Uh oh; data at some point was corrupted or missing!
              // We can't tolerate that in a header. Die.
              throw new GdxRuntimeException("Corrupt secondary header.");
            }

            oggInfo.synthesis_headerin(comment, packet);
            i++;
          }
        }
      }
      // no harm in not checking before adding more
      index = syncState.buffer(BUFFER_SIZE);
      if (index == -1) return false;
      buffer = syncState.data;
      try {
        bytes = input.read(buffer, index, BUFFER_SIZE);
      } catch (Exception e) {
        throw new GdxRuntimeException("Failed to read Vorbis.", e);
      }
      if (bytes == 0 && i < 2) {
        throw new GdxRuntimeException("End of file before finding all Vorbis headers.");
      }
      syncState.wrote(bytes);
    }

    convsize = BUFFER_SIZE / oggInfo.channels;
View Full Code Here

                    }
                  }

                  int bytesToWrite = 2 * oggInfo.channels * bout;
                  if (bytesToWrite > pcmBuffer.remaining()) {
                    throw new GdxRuntimeException("Ogg block too big to be buffered: " + bytesToWrite + " :: " + pcmBuffer.remaining());
                  } else {
                    pcmBuffer.put(convbuffer, 0, bytesToWrite);
                  }

                  wrote = true;
                  dspState.synthesis_read(bout); // tell libvorbis how
                  // many samples we
                  // actually consumed
                }
              }
            }
            if (page.eos() != 0) {
              endOfBitStream = true;
            }

            if ((!endOfBitStream) && (wrote)) {
              return;
            }
          }
        }

        if (!endOfBitStream) {
          bytes = 0;
          int index = syncState.buffer(BUFFER_SIZE);
          if (index >= 0) {
            buffer = syncState.data;
            try {
              bytes = input.read(buffer, index, BUFFER_SIZE);
            } catch (Exception e) {
              throw new GdxRuntimeException("Error during Vorbis decoding.", e);
            }
          } else {
            bytes = 0;
          }
          syncState.wrote(bytes);
View Full Code Here

    OutputStream out = null;
    try {
      out = new BufferedOutputStream(file.write(false));
      properties.storeToXML(out, null);
    } catch (Exception ex) {
      throw new GdxRuntimeException("Error writing preferences: " + file, ex);
    } finally {
      StreamUtils.closeQuietly(out);
    }
  }
View Full Code Here

          if (config != null) {
            displayCreated = setDisplayMode(config.width, config.height, config.fullscreen);
          }
        }
        if (!displayCreated) {
          throw new GdxRuntimeException("Couldn't set display mode " + config.width + "x" + config.height + ", fullscreen: "
              + config.fullscreen);
        }
      }
      if (config.iconPaths.size > 0) {
        ByteBuffer[] icons = new ByteBuffer[config.iconPaths.size];
View Full Code Here

              glInfo = ": " + GL11.glGetString(GL11.GL_VENDOR) + " " //
                + GL11.glGetString(GL11.GL_RENDERER) + " " //
                + GL11.glGetString(GL11.GL_VERSION);
            } catch (Throwable ignored) {
            }
            throw new GdxRuntimeException("OpenGL is not supported by the video driver" + glInfo, ex3);
          }
          throw new GdxRuntimeException("Unable to create OpenGL display.", ex3);
        }
        if (getDesktopDisplayMode().bitsPerPixel == 16) {
          bufferFormat = new BufferFormat(5, 6, 5, 0, 8, 0, 0, false);
        }
        if (getDesktopDisplayMode().bitsPerPixel == 24) {
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.utils.GdxRuntimeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.