gpt4 book ai didi

com.google.gwt.webgl.client.WebGLRenderingContext.texImage2D()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-25 13:51:05 26 4
gpt4 key购买 nike

本文整理了Java中com.google.gwt.webgl.client.WebGLRenderingContext.texImage2D()方法的一些代码示例,展示了WebGLRenderingContext.texImage2D()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebGLRenderingContext.texImage2D()方法的具体详情如下:
包路径:com.google.gwt.webgl.client.WebGLRenderingContext
类名称:WebGLRenderingContext
方法名:texImage2D

WebGLRenderingContext.texImage2D介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

@Override
public void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type,
  Buffer pixels) {
  if (pixels == null) {
    gl.texImage2D(target, level, internalformat, width, height, border, format, type, null);
  } else {
    if (pixels.limit() > 1) {
      HasArrayBufferView arrayHolder = (HasArrayBufferView)pixels;
      ArrayBufferView webGLArray = arrayHolder.getTypedArray();
      ArrayBufferView buffer;
      if (pixels instanceof FloatBuffer) {
        buffer = webGLArray;
      } else {
        int remainingBytes = pixels.remaining() * 4;
        int byteOffset = webGLArray.byteOffset() + pixels.position() * 4;
        buffer = Uint8ArrayNative.create(webGLArray.buffer(), byteOffset, remainingBytes);
      }
      gl.texImage2D(target, level, internalformat, width, height, border, format, type, buffer);
    } else {
      Pixmap pixmap = Pixmap.pixmaps.get(((IntBuffer)pixels).get(0));
      // Prefer to use the HTMLImageElement when possible, since reading from the CanvasElement can be lossy.
      if (pixmap.canUseImageElement()) {
        gl.texImage2D(target, level, internalformat, format, type, pixmap.getImageElement());
      }
      else {
        gl.texImage2D(target, level, internalformat, format, type, pixmap.getCanvasElement());
      }
    }
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
public void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type,
  Buffer pixels) {
  if (pixels == null) {
    gl.texImage2D(target, level, internalformat, width, height, border, format, type, null);
  } else {
    if (pixels.limit() > 1) {
      HasArrayBufferView arrayHolder = (HasArrayBufferView)pixels;
      ArrayBufferView webGLArray = arrayHolder.getTypedArray();
      ArrayBufferView buffer;
      if (pixels instanceof FloatBuffer) {
        buffer = webGLArray;
      } else {
        int remainingBytes = pixels.remaining() * 4;
        int byteOffset = webGLArray.byteOffset() + pixels.position() * 4;
        buffer = Uint8ArrayNative.create(webGLArray.buffer(), byteOffset, remainingBytes);
      }
      gl.texImage2D(target, level, internalformat, width, height, border, format, type, buffer);
    } else {
      Pixmap pixmap = Pixmap.pixmaps.get(((IntBuffer)pixels).get(0));
      // Prefer to use the HTMLImageElement when possible, since reading from the CanvasElement can be lossy.
      if (pixmap.canUseImageElement()) {
        gl.texImage2D(target, level, internalformat, format, type, pixmap.getImageElement());
      }
      else {
        gl.texImage2D(target, level, internalformat, format, type, pixmap.getCanvasElement());
      }
    }
  }
}

代码示例来源:origin: threerings/playn

@Override
public void texImage2D(Image image, int target, int level, int internalformat, int format,
            int type) {
 // we can do this more efficiently by passing the image element right to WebGL
 glc.texImage2D(target, level, internalformat, format, type, ((HtmlImage) image).img);
}

代码示例来源:origin: thothbot/parallax

public void glTexImage2D(int target, int level, int internalformat, int format, int type, ImageData pixels) {
  gl.texImage2D(target, level, internalformat, format, type, pixels);
}

代码示例来源:origin: thothbot/parallax

public void glTexImage2D(int target, int level, int internalformat, int format, int type, Element pixels) {
  gl.texImage2D(target, level, internalformat, format, type, pixels);
}

代码示例来源:origin: threerings/playn

@Override
public void glTexImage2D(int target, int level, int internalformat, int width,
             int height, int border, int format, int type, Buffer pixels) {
 ArrayBufferView buffer = (pixels == null) ? null : getTypedArray(pixels, type, -1);
 gl.texImage2D(target, level, internalformat, width, height, border, format, type, buffer);
}

代码示例来源:origin: playn/playn

@Override
public void glTexImage2D(int target, int level, int internalformat, int width,
                  int height, int border, int format, int type, Buffer pixels) {
 ArrayBufferView buffer = (pixels == null) ? null : getTypedArray(pixels, type, -1);
 gl.texImage2D(target, level, internalformat, width, height, border, format, type, buffer);
}

代码示例来源:origin: io.playn/playn-html

@Override
public void glTexImage2D(int target, int level, int internalformat, int width,
                  int height, int border, int format, int type, Buffer pixels) {
 ArrayBufferView buffer = (pixels == null) ? null : getTypedArray(pixels, type, -1);
 gl.texImage2D(target, level, internalformat, width, height, border, format, type, buffer);
}

代码示例来源:origin: playn/playn

public void glTexImage2D(int target, int level, int internalformat, int format, int type, CanvasElement image) {
 gl.texImage2D(target, level, internalformat, format, type, image);
 checkError("texImage2D");
}

代码示例来源:origin: io.playn/playn-html

public void glTexImage2D(int target, int level, int internalformat, int format, int type, CanvasElement image) {
 gl.texImage2D(target, level, internalformat, format, type, image);
 checkError("texImage2D");
}

代码示例来源:origin: threerings/playn

void updateTexture(int tex, ImageElement img) {
 gl.glBindTexture(HtmlGL20.GL_TEXTURE_2D, tex);
 glc.texImage2D(TEXTURE_2D, 0, RGBA, RGBA, UNSIGNED_BYTE, img);
}

代码示例来源:origin: playn/playn

public void glTexImage2D(int target, int level, int internalformat, int format, int type, ImageElement image) {
 gl.texImage2D(target, level, internalformat, format, type, image);
 checkError("texImage2D");
}

代码示例来源:origin: io.playn/playn-html

public void glTexImage2D(int target, int level, int internalformat, int format, int type, ImageElement image) {
 gl.texImage2D(target, level, internalformat, format, type, image);
 checkError("texImage2D");
}

代码示例来源:origin: thothbot/parallax

@Override
public void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type,
  Buffer pixels) {
  if (pixels == null) {
    gl.texImage2D(target, level, internalformat, width, height, border, format, type, null);
  } else {
    if (pixels.limit() > 1) {
      HasArrayBufferView arrayHolder = (HasArrayBufferView)pixels;
      ArrayBufferView webGLArray = arrayHolder.getTypedArray();
      int remainingBytes = pixels.remaining() * 4;
      int byteOffset = webGLArray.byteOffset() + pixels.position() * 4;
      Uint8Array buffer = Uint8ArrayNative.create(webGLArray.buffer(), byteOffset, remainingBytes);
      gl.texImage2D(target, level, internalformat, width, height, border, format, type, buffer);
    }
  }
}

代码示例来源:origin: threerings/playn

@Override
 public void onEvent(NativeEvent e) {
  // Load image data into the texture object once it's loaded.
  gl.bindTexture(TEXTURE_2D, tex);
  gl.texImage2D(TEXTURE_2D, 0, RGBA, RGBA, UNSIGNED_BYTE, img);
  gl.texParameteri(TEXTURE_2D, TEXTURE_MAG_FILTER, LINEAR);
  gl.texParameteri(TEXTURE_2D, TEXTURE_MIN_FILTER, LINEAR);
  gl.texParameteri(TEXTURE_2D, TEXTURE_WRAP_S, CLAMP_TO_EDGE);
  gl.texParameteri(TEXTURE_2D, TEXTURE_WRAP_T, CLAMP_TO_EDGE);
  gl.bindTexture(TEXTURE_2D, null);
 }
});

代码示例来源:origin: playn/playn

@Override
 public void onEvent(NativeEvent e) {
  // Load image data into the texture object once it's loaded.
  gl.bindTexture(TEXTURE_2D, tex);
  gl.texImage2D(TEXTURE_2D, 0, RGBA, RGBA, UNSIGNED_BYTE, img);
  gl.texParameteri(TEXTURE_2D, TEXTURE_MAG_FILTER, LINEAR);
  gl.texParameteri(TEXTURE_2D, TEXTURE_MIN_FILTER, LINEAR);
  gl.texParameteri(TEXTURE_2D, TEXTURE_WRAP_S, CLAMP_TO_EDGE);
  gl.texParameteri(TEXTURE_2D, TEXTURE_WRAP_T, CLAMP_TO_EDGE);
  gl.bindTexture(TEXTURE_2D, null);
 }
});

代码示例来源:origin: com.googlecode.playn/playn-webgl

@Override
 public void onEvent(NativeEvent e) {
  // Load image data into the texture object once it's loaded.
  gl.bindTexture(TEXTURE_2D, tex);
  gl.texImage2D(TEXTURE_2D, 0, RGBA, RGBA, UNSIGNED_BYTE, img);
  gl.texParameteri(TEXTURE_2D, TEXTURE_MAG_FILTER, LINEAR);
  gl.texParameteri(TEXTURE_2D, TEXTURE_MIN_FILTER, LINEAR);
  gl.texParameteri(TEXTURE_2D, TEXTURE_WRAP_S, CLAMP_TO_EDGE);
  gl.texParameteri(TEXTURE_2D, TEXTURE_WRAP_T, CLAMP_TO_EDGE);
  gl.bindTexture(TEXTURE_2D, null);
 }
});

代码示例来源:origin: playn/playn

private WebGLFramebuffer createFramebuffer(int width, int height) {
 WebGLTexture tex = createTexture();
 fbuf = gl.createFramebuffer();
 gl.texImage2D(TEXTURE_2D, 0, RGBA, width, height, 0, RGBA, UNSIGNED_BYTE, null);
 WebGLRenderbuffer rbuf = gl.createRenderbuffer();
 gl.bindRenderbuffer(RENDERBUFFER, rbuf);
 gl.renderbufferStorage(RENDERBUFFER, RGBA4, width, height);
 gl.framebufferTexture2D(FRAMEBUFFER, COLOR_ATTACHMENT0, TEXTURE_2D, tex, 0);
 gl.framebufferRenderbuffer(FRAMEBUFFER, DEPTH_ATTACHMENT, RENDERBUFFER, rbuf);
 gl.bindTexture(TEXTURE_2D, null);
 gl.bindRenderbuffer(RENDERBUFFER, null);
 gl.bindFramebuffer(FRAMEBUFFER, null);
 return fbuf;
}

代码示例来源:origin: com.googlecode.playn/playn-webgl

private WebGLFramebuffer createFramebuffer(int width, int height) {
 WebGLTexture tex = createTexture();
 fbuf = gl.createFramebuffer();
 gl.texImage2D(TEXTURE_2D, 0, RGBA, width, height, 0, RGBA, UNSIGNED_BYTE, null);
 WebGLRenderbuffer rbuf = gl.createRenderbuffer();
 gl.bindRenderbuffer(RENDERBUFFER, rbuf);
 gl.renderbufferStorage(RENDERBUFFER, RGBA4, width, height);
 gl.framebufferTexture2D(FRAMEBUFFER, COLOR_ATTACHMENT0, TEXTURE_2D, tex, 0);
 gl.framebufferRenderbuffer(FRAMEBUFFER, DEPTH_ATTACHMENT, RENDERBUFFER, rbuf);
 gl.bindTexture(TEXTURE_2D, null);
 gl.bindRenderbuffer(RENDERBUFFER, null);
 gl.bindFramebuffer(FRAMEBUFFER, null);
 return fbuf;
}

代码示例来源:origin: threerings/playn

private WebGLFramebuffer createFramebuffer(int width, int height) {
 WebGLTexture tex = createTexture();
 fbuf = gl.createFramebuffer();
 gl.texImage2D(TEXTURE_2D, 0, RGBA, width, height, 0, RGBA, UNSIGNED_BYTE, null);
 WebGLRenderbuffer rbuf = gl.createRenderbuffer();
 gl.bindRenderbuffer(RENDERBUFFER, rbuf);
 gl.renderbufferStorage(RENDERBUFFER, RGBA4, width, height);
 gl.framebufferTexture2D(FRAMEBUFFER, COLOR_ATTACHMENT0, TEXTURE_2D, tex, 0);
 gl.framebufferRenderbuffer(FRAMEBUFFER, DEPTH_ATTACHMENT, RENDERBUFFER, rbuf);
 gl.bindTexture(TEXTURE_2D, null);
 gl.bindRenderbuffer(RENDERBUFFER, null);
 gl.bindFramebuffer(FRAMEBUFFER, null);
 return fbuf;
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com