com.jogamp.common.nio.Buffers.newDirectIntBuffer()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(116)

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

Buffers.newDirectIntBuffer介绍

[英]Allocates a new direct IntBuffer with the specified number of elements. The returned buffer will have its byte order set to the host platform's native byte order.
[中]使用指定数量的元素分配新的直接IntBuffer。返回的缓冲区将其字节顺序设置为主机平台的本机字节顺序。

代码示例

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

/**
 * Constructs an nio integer-based {@link DataBuffer} with a single bank
 * and the specified size.
 *
 * @param size The size of the {@link DataBuffer}.
 */
public DirectDataBufferInt(final int size) {
  super(TYPE_INT, size);
  data = Buffers.newDirectIntBuffer(size);
  bankdata = new IntBuffer[1];
  bankdata[0] = data;
}

代码示例来源:origin: nifty-gui/nifty-gui

@Nonnull
 @Override
 public IntBuffer createNativeOrderedIntBuffer(final int numInts) {
  return Buffers.newDirectIntBuffer(numInts);
 }
}

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

@Override
public boolean setSwapInterval(final int interval) {
  final IntBuffer lval = Buffers.newDirectIntBuffer(1);
  lval.put(0, interval);
  CGL.CGLSetParameter(contextHandle, CGL.kCGLCPSwapInterval, lval);
  return true;
}
@Override

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

static int glXFBConfig2FBConfigID(final long display, final long cfg) {
  final IntBuffer tmpID = Buffers.newDirectIntBuffer(1);
  if( glXGetFBConfig(display, cfg, GLX.GLX_FBCONFIG_ID, tmpID) ) {
    return tmpID.get(0);
  } else {
    return VisualIDHolder.VID_UNDEFINED; // error
  }
}

代码示例来源:origin: org.jogamp.jocl/jocl

/**
 * Creates a CLBuffer with the specified flags and element count. No flags creates a MEM.READ_WRITE buffer.
 */
public final CLBuffer<IntBuffer> createIntBuffer(final int size, final Mem... flags) {
  return createBuffer(Buffers.newDirectIntBuffer(size), flags);
}

代码示例来源:origin: org.jogamp.jogl/jogl-all-noawt

static boolean GLXFBConfigValid(final long display, final long fbcfg) {
 final IntBuffer tmp = Buffers.newDirectIntBuffer(1);
 if(GLX.GLX_BAD_ATTRIBUTE == GLX.glXGetFBConfigAttrib(display, fbcfg, GLX.GLX_RENDER_TYPE, tmp)) {
  return false;
 }
 return true;
}

代码示例来源:origin: org.jogamp.jogl/jogl-all-noawt

static int glXFBConfig2FBConfigID(final long display, final long cfg) {
  final IntBuffer tmpID = Buffers.newDirectIntBuffer(1);
  if( glXGetFBConfig(display, cfg, GLX.GLX_FBCONFIG_ID, tmpID) ) {
    return tmpID.get(0);
  } else {
    return VisualIDHolder.VID_UNDEFINED; // error
  }
}

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

static boolean GLXFBConfigValid(final long display, final long fbcfg) {
 final IntBuffer tmp = Buffers.newDirectIntBuffer(1);
 if(GLX.GLX_BAD_ATTRIBUTE == GLX.glXGetFBConfigAttrib(display, fbcfg, GLX.GLX_RENDER_TYPE, tmp)) {
  return false;
 }
 return true;
}

代码示例来源:origin: org.jogamp.jogl/jogl-all-noawt

static boolean wglARBPFIDValid(final WindowsWGLContext sharedCtx, final long hdc, final int pfdID) {
  final IntBuffer out = Buffers.newDirectIntBuffer(1);
  final IntBuffer in = Buffers.newDirectIntBuffer(1);
  in.put(0, WGLExt.WGL_COLOR_BITS_ARB);
  if (!sharedCtx.getWGLExt().wglGetPixelFormatAttribivARB(hdc, pfdID, 0, 1, in, out)) {
    // Some GPU's falsely fails with a zero error code (success)
    return GDI.GetLastError() == GDI.ERROR_SUCCESS ;
  }
  return true;
}

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

static boolean wglARBPFIDValid(final WindowsWGLContext sharedCtx, final long hdc, final int pfdID) {
  final IntBuffer out = Buffers.newDirectIntBuffer(1);
  final IntBuffer in = Buffers.newDirectIntBuffer(1);
  in.put(0, WGLExt.WGL_COLOR_BITS_ARB);
  if (!sharedCtx.getWGLExt().wglGetPixelFormatAttribivARB(hdc, pfdID, 0, 1, in, out)) {
    // Some GPU's falsely fails with a zero error code (success)
    return GDI.GetLastError() == GDI.ERROR_SUCCESS ;
  }
  return true;
}

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

static long glXFBConfigID2FBConfig(final long display, final int screen, final int id) {
  final IntBuffer attribs = Buffers.newDirectIntBuffer(new int[] { GLX.GLX_FBCONFIG_ID, id, 0 });
  final IntBuffer count = Buffers.newDirectIntBuffer(1);
  count.put(0, -1);
  final PointerBuffer fbcfgsL = GLX.glXChooseFBConfig(display, screen, attribs, count);
  if (fbcfgsL == null || fbcfgsL.limit()<1) {
    return 0;
  }
  return fbcfgsL.get(0);
}

代码示例来源:origin: org.jogamp.jogl/jogl-all-noawt

static long glXFBConfigID2FBConfig(final long display, final int screen, final int id) {
  final IntBuffer attribs = Buffers.newDirectIntBuffer(new int[] { GLX.GLX_FBCONFIG_ID, id, 0 });
  final IntBuffer count = Buffers.newDirectIntBuffer(1);
  count.put(0, -1);
  final PointerBuffer fbcfgsL = GLX.glXChooseFBConfig(display, screen, attribs, count);
  if (fbcfgsL == null || fbcfgsL.limit()<1) {
    return 0;
  }
  return fbcfgsL.get(0);
}

代码示例来源:origin: org.jogamp.jocl/jocl

/**
 * Returns the number of buffer mappings. The map count returned should be considered immediately stale.
 * It is unsuitable for general use in applications. This feature is provided for debugging.
 */
public int getMapCount() {
  final IntBuffer value = Buffers.newDirectIntBuffer(1);
  final int ret = binding.clGetMemObjectInfo(ID, CL_MEM_MAP_COUNT, 4, value, null);
  checkForError(ret, "can not obtain buffer map count.");
  return value.get();
}

代码示例来源:origin: com.github.danny02/Renderer

public synchronized static void initializeFormats(GraphicContext gc) {
  GL gl = gc.getGL();
  IntBuffer c = Buffers.newDirectIntBuffer(1);
  gl.glGetIntegerv(GL2ES2.GL_NUM_PROGRAM_BINARY_FORMATS, c);
  c = Buffers.newDirectIntBuffer(c.get(0));
  gl.glGetIntegerv(GL2ES2.GL_PROGRAM_BINARY_FORMATS, c);
  formats = c.array();
}

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

static X11GLCapabilities GLXFBConfig2GLCapabilities(final X11GraphicsDevice device, final GLProfile glp, final long fbcfg,
                          final int winattrmask, final boolean isMultisampleAvailable) {
 final IntBuffer tmp = Buffers.newDirectIntBuffer(1);
 final XRenderPictFormat xRenderPictFormat= XRenderPictFormat.create();
 return GLXFBConfig2GLCapabilities(device, glp, fbcfg, winattrmask, isMultisampleAvailable, tmp, xRenderPictFormat);
}

代码示例来源:origin: org.jogamp.jogl/jogl-all-noawt

static X11GLCapabilities GLXFBConfig2GLCapabilities(final X11GraphicsDevice device, final GLProfile glp, final long fbcfg,
                          final int winattrmask, final boolean isMultisampleAvailable) {
 final IntBuffer tmp = Buffers.newDirectIntBuffer(1);
 final XRenderPictFormat xRenderPictFormat= XRenderPictFormat.create();
 return GLXFBConfig2GLCapabilities(device, glp, fbcfg, winattrmask, isMultisampleAvailable, tmp, xRenderPictFormat);
}

代码示例来源:origin: eu.mihosoft.vrl.vrljogl/vrl-jogl

public void allocate(int[] data) {
  this.size = data.length;
  Buffer buffer = Buffers.newDirectIntBuffer(data);
  int bufferByteSize = buffer.capacity() * Buffers.SIZEOF_INT;
  gl.glBufferData(gl.GL_ELEMENT_ARRAY_BUFFER, bufferByteSize, buffer, gl.GL_STATIC_DRAW);
}

代码示例来源:origin: org.jogamp.jocl/jocl

protected static long createContextFromType(final CLPlatform platform, final CLErrorHandler handler, final PointerBuffer properties, final long deviceType) {
  final IntBuffer status = Buffers.newDirectIntBuffer(1);
  final CLContextBinding cl = platform.getContextBinding();
  final long context = cl.clCreateContextFromType(properties, deviceType, handler, status);
  CLException.checkForError(status.get(), "can not create CL context");
  return context;
}

代码示例来源:origin: org.jogamp.jocl/jocl

static <B extends Buffer> CLImage3d<B> createImage(final CLContext context, final B directBuffer,
    final int width, final int height, final int depth, final int rowPitch, final int slicePitch, final CLImageFormat format, final int flags) {
  final CLImageBinding cl = context.getPlatform().getImageBinding();
  final IntBuffer err = Buffers.newDirectIntBuffer(1);
  B host_ptr = null;
  if(isHostPointerFlag(flags)) {
    host_ptr = directBuffer;
  }
  final long id = cl.clCreateImage3D(context.ID, flags, format.getFormatImpl(), width, height, depth, rowPitch, slicePitch, host_ptr, err);
  checkForError(err.get(), "can not create 2d image");
  return new CLImage3d<B>(context, directBuffer, format, width, height, depth, id, flags);
}

代码示例来源:origin: org.jogamp.jocl/jocl

static <B extends Buffer> CLImage2d<B> createImage(final CLContext context, final B directBuffer,
    final int width, final int height, final int rowPitch, final CLImageFormat format, final int flags) {
  final CLImageBinding cl = context.getPlatform().getImageBinding();
  final IntBuffer err = Buffers.newDirectIntBuffer(1);
  B host_ptr = null;
  if(isHostPointerFlag(flags)) {
    host_ptr = directBuffer;
  }
  final long id = cl.clCreateImage2D(context.ID, flags, format.getFormatImpl(), width, height, rowPitch, host_ptr, err);
  checkForError(err.get(), "can not create 2d image");
  return new CLImage2d<B>(context, directBuffer, format, width, height, id, flags);
}

相关文章