當前位置: 首頁>>代碼示例>>Java>>正文


Java FloatBuffer.position方法代碼示例

本文整理匯總了Java中java.nio.FloatBuffer.position方法的典型用法代碼示例。如果您正苦於以下問題:Java FloatBuffer.position方法的具體用法?Java FloatBuffer.position怎麽用?Java FloatBuffer.position使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.nio.FloatBuffer的用法示例。


在下文中一共展示了FloatBuffer.position方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isSupported

import java.nio.FloatBuffer; //導入方法依賴的package包/類
/**
 * @return Whether the device supports anisotropic filtering.
 */
public static boolean isSupported () {
    GL20 gl = Gdx.gl;
    if (gl != null) {
        if (Gdx.graphics.supportsExtension("GL_EXT_texture_filter_anisotropic")) {
            anisotropySupported = true;
            FloatBuffer buffer = BufferUtils.newFloatBuffer(16);
            buffer.position(0);
            buffer.limit(buffer.capacity());
            Gdx.gl20.glGetFloatv(GL20.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, buffer);
            maxAnisotropySupported = buffer.get(0);
        }
        checkComplete = true;
    }
    return anisotropySupported;
}
 
開發者ID:CypherCove,項目名稱:gdx-cclibs,代碼行數:19,代碼來源:Anisotropy.java

示例2: makeFloatBuffer

import java.nio.FloatBuffer; //導入方法依賴的package包/類
static FloatBuffer makeFloatBuffer(int size) {
    ByteBuffer vbb = ByteBuffer.allocateDirect(size * 4);
    vbb.order(ByteOrder.nativeOrder());
    FloatBuffer texBuffer = vbb.asFloatBuffer();
    texBuffer.position(0);
    return texBuffer;
}
 
開發者ID:StringMon,項目名稱:homescreenarcade,代碼行數:8,代碼來源:GLVertexList.java

示例3: getBuffers

import java.nio.FloatBuffer; //導入方法依賴的package包/類
FloatBuffer[] getBuffers(
        float[] cubePositions,
        float[] cubeNormals,
        float[] cubeTextureCoordinates, int generatedCubeFactor) {

    // First, copy cube information into client-side floating point buffers.
    final FloatBuffer cubePositionsBuffer;
    final FloatBuffer cubeNormalsBuffer;
    final FloatBuffer cubeTextureCoordinatesBuffer;

    cubePositionsBuffer = ByteBuffer.allocateDirect(cubePositions.length * BYTES_PER_FLOAT)
            .order(ByteOrder.nativeOrder()).asFloatBuffer();
    cubePositionsBuffer.put(cubePositions).position(0);

    cubeNormalsBuffer = ByteBuffer.allocateDirect(cubeNormals.length * BYTES_PER_FLOAT * generatedCubeFactor * generatedCubeFactor * generatedCubeFactor)
            .order(ByteOrder.nativeOrder()).asFloatBuffer();

    for (int i = 0; i < (generatedCubeFactor * generatedCubeFactor * generatedCubeFactor); i++) {
        cubeNormalsBuffer.put(cubeNormals);
    }

    cubeNormalsBuffer.position(0);

    cubeTextureCoordinatesBuffer = ByteBuffer.allocateDirect(cubeTextureCoordinates.length * BYTES_PER_FLOAT * generatedCubeFactor * generatedCubeFactor * generatedCubeFactor)
            .order(ByteOrder.nativeOrder()).asFloatBuffer();

    for (int i = 0; i < (generatedCubeFactor * generatedCubeFactor * generatedCubeFactor); i++) {
        cubeTextureCoordinatesBuffer.put(cubeTextureCoordinates);
    }

    cubeTextureCoordinatesBuffer.position(0);

    return new FloatBuffer[]{cubePositionsBuffer, cubeNormalsBuffer, cubeTextureCoordinatesBuffer};
}
 
開發者ID:biezhihua,項目名稱:Android_OpenGL_Demo,代碼行數:35,代碼來源:LessonSevenRenderer.java

示例4: getFloatBufferFromList

import java.nio.FloatBuffer; //導入方法依賴的package包/類
private FloatBuffer getFloatBufferFromList(List<Float> vertexList) {
	ByteBuffer vbb = ByteBuffer.allocateDirect(vertexList.size() * 4);
	vbb.order(ByteOrder.nativeOrder());
	FloatBuffer triangleBuffer = vbb.asFloatBuffer();
	float[] array = new float[vertexList.size()];
	for (int i = 0; i < vertexList.size(); i++) {
		array[i] = vertexList.get(i);
	}
	triangleBuffer.put(array);
	triangleBuffer.position(0);
	return triangleBuffer;
}
 
開發者ID:xhd-Git,項目名稱:3DPrint-Controller,代碼行數:13,代碼來源:STLRenderer.java

示例5: getFloatBufferFromArray

import java.nio.FloatBuffer; //導入方法依賴的package包/類
private FloatBuffer getFloatBufferFromArray(float[] vertexArray) {
	ByteBuffer vbb = ByteBuffer.allocateDirect(vertexArray.length * 4);
	vbb.order(ByteOrder.nativeOrder());
	FloatBuffer triangleBuffer = vbb.asFloatBuffer();
	triangleBuffer.put(vertexArray);
	triangleBuffer.position(0);
	return triangleBuffer;
}
 
開發者ID:xhd-Git,項目名稱:3DPrint-Controller,代碼行數:9,代碼來源:STLRenderer.java

示例6: createTexCoordBuffer

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public static FloatBuffer createTexCoordBuffer() {
    final float vtx[] = {
            // UV
            0f, 1f,
            0f, 0f,
            1f, 1f,
            1f, 0f,
    };
    ByteBuffer bb = ByteBuffer.allocateDirect(4 * vtx.length);
    bb.order(ByteOrder.nativeOrder());
    FloatBuffer fb = bb.asFloatBuffer();
    fb.put(vtx);
    fb.position(0);
    return fb;
}
 
開發者ID:wuyisheng,項目名稱:libRtmp,代碼行數:16,代碼來源:AndroidUntil.java

示例7: glMultMatrixf

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public void glMultMatrixf(FloatBuffer m) {
	int position = m.position();
	mCurrent.glMultMatrixf(m);
	m.position(position);
	mgl.glMultMatrixf(m);
	if ( _check) check();
}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:8,代碼來源:MatrixTrackingGL.java

示例8: createFloatBuffer

import java.nio.FloatBuffer; //導入方法依賴的package包/類
/**
 * Allocates a direct float buffer, and populates it with the float array data.
 */
public static FloatBuffer createFloatBuffer(float[] coords) {
    // Allocate a direct ByteBuffer, using 4 bytes per float, and copy coords into it.
    ByteBuffer bb = ByteBuffer.allocateDirect(coords.length * SIZEOF_FLOAT);
    bb.order(ByteOrder.nativeOrder());
    FloatBuffer fb = bb.asFloatBuffer();
    fb.put(coords);
    fb.position(0);
    return fb;
}
 
開發者ID:AndyZhu1991,項目名稱:grafika,代碼行數:13,代碼來源:GlUtil.java

示例9: createFloatBuffer

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public static FloatBuffer createFloatBuffer(float[] coords) {
  // Allocate a direct ByteBuffer, using 4 bytes per float, and copy coords into it.
  ByteBuffer bb = ByteBuffer.allocateDirect(coords.length * 4);
  bb.order(ByteOrder.nativeOrder());
  FloatBuffer fb = bb.asFloatBuffer();
  fb.put(coords);
  fb.position(0);
  return fb;
}
 
開發者ID:Piasy,項目名稱:AppRTC-Android,代碼行數:10,代碼來源:GlUtil.java

示例10: draw

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public void draw(final int textureId, final FloatBuffer cubeBuffer,
                   final FloatBuffer textureBuffer) {
    GLES20.glUseProgram(mGLProgId);
    runPendingOnDrawTasks();
    if (!mIsInitialized) {
        return;
    }
    cubeBuffer.position(0);
    GLES20.glVertexAttribPointer(mGLAttribPosition, 3, GLES20.GL_FLOAT, false, 0, cubeBuffer);
    GLES20.glEnableVertexAttribArray(mGLAttribPosition);

    textureBuffer.position(0);
    GLES20.glVertexAttribPointer(mGLAttribTextureCoordinate, 2, GLES20.GL_FLOAT, false, 0,
            textureBuffer);
    GLES20.glEnableVertexAttribArray(mGLAttribTextureCoordinate);

    if (textureId != OpenGlUtils.NO_TEXTURE) {
        GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
        GLES20.glBindTexture(mTextureTarget, textureId);
        GLES20.glUniform1i(mGLUniformTexture, 0);
    }
    onDrawArraysPre();
    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 6);
    GLES20.glDisableVertexAttribArray(mGLAttribPosition);
    GLES20.glDisableVertexAttribArray(mGLAttribTextureCoordinate);
    GLES20.glBindTexture(mTextureTarget, 0);

    Log.i(TAG,"java filter draw textureId = " + textureId);

    if(mInputSurface != null){
        mInputSurface.swapBuffers();
        GLES20.glFlush();
    }

}
 
開發者ID:lzmlsfe,項目名稱:19porn,代碼行數:36,代碼來源:GPUImageFilter.java

示例11: snapshotToBuffer

import java.nio.FloatBuffer; //導入方法依賴的package包/類
/**
 * Convert the timeseries snapshot into a run of (x, y, z) bytes.
 */
private FloatBuffer snapshotToBuffer(TimeSeriesSnapshot snapshot) {
  float[] asFloats = snapshotToFloat(snapshot);

  // Create buffer to store result.
  ByteBuffer bb = ByteBuffer.allocateDirect(snapshot.length * VERTEX_STRIDE);
  bb.order(ByteOrder.nativeOrder());

  // Write to buffer usign floats:
  FloatBuffer vertexBuffer = bb.asFloatBuffer();
  vertexBuffer.put(asFloats);
  vertexBuffer.position(0);
  return vertexBuffer;
}
 
開發者ID:padster,項目名稱:Muse-EEG-Toolkit,代碼行數:17,代碼來源:GraphGLLine.java

示例12: renderTexture

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public int renderTexture(int textureId){
	if(mGpuImageFilter == null){
		mGpuImageFilter = new GPUImageFilter(null);
		mGpuImageFilter.init();
	}


	int vertexNum = 6;

	float[] vertexCoordinate  = {1.0f, -1.0f,  0.0f,
			1.0f,  1.0f,  0.0f,
			-1.0f,  1.0f,  0.0f,
			-1.0f,  1.0f,  0.0f,
			-1.0f, -1.0f,  0.0f,
			1.0f, -1.0f,  0.0f};

	ByteBuffer bbVertices = ByteBuffer.allocateDirect(vertexNum * 3 * 4);
	bbVertices.order(ByteOrder.nativeOrder());
	FloatBuffer vertexBuf = bbVertices.asFloatBuffer();
	vertexBuf.put(vertexCoordinate);
	vertexBuf.position(0);

	float[] textureCoordinate1  = {1.0f, 1.0f,
			1.0f, 0.0f,
			0.0f, 0.0f,
			0.0f, 0.0f,
			0.0f, 1.0f,
			1.0f, 1.0f};


	ByteBuffer bbColors1 = ByteBuffer.allocateDirect(vertexNum * 2 * 4);
	bbColors1.order(ByteOrder.nativeOrder());
	FloatBuffer textureCoordinateBuf = bbColors1.asFloatBuffer();
	textureCoordinateBuf.put(textureCoordinate1);
	textureCoordinateBuf.position(0);


	mGpuImageFilter.draw(textureId,vertexBuf,textureCoordinateBuf);
	return 1;
}
 
開發者ID:lzmlsfe,項目名稱:19porn,代碼行數:41,代碼來源:APlayerAndroid.java

示例13: createVbo

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public static int createVbo(FloatBuffer data) {
  int[] vbos = new int[1];
  data.position(0);
  GLES20.glGenBuffers(1, vbos, 0);
  GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, vbos[0]);
  GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, data.capacity() * MyGLUtils.FLOAT_SIZE, data,
      GLES20.GL_STATIC_DRAW);
  GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
  return vbos[0];
}
 
開發者ID:googlevr,項目名稱:poly-sample-android,代碼行數:11,代碼來源:MyGLUtils.java

示例14: uploadVerticesBuffer

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public void uploadVerticesBuffer(int positionHandle){
    FloatBuffer vertexBuffer = getVerticesBuffer();
    if (vertexBuffer == null) return;
    vertexBuffer.position(0);

    GLES20.glVertexAttribPointer(positionHandle, 3, GLES20.GL_FLOAT, false, 0, vertexBuffer);
    ShaderUtils.checkGlError("glVertexAttribPointer maPosition");
    GLES20.glEnableVertexAttribArray(positionHandle);
    ShaderUtils.checkGlError("glEnableVertexAttribArray maPositionHandle");
}
 
開發者ID:zhangyaqiang,項目名稱:Fatigue-Detection,代碼行數:11,代碼來源:Plane.java

示例15: draw

import java.nio.FloatBuffer; //導入方法依賴的package包/類
@Override
public void draw(int textureId, FloatBuffer cubeBuffer, FloatBuffer textureBuffer) {
    GLES20.glUseProgram(mProgram);

    if (mMaskGrey1TextureId == -1) {
        ondraw();//
    }

    cubeBuffer.position(0);
    GLES20.glVertexAttribPointer(mAPositionHandle, 2, GLES20.GL_FLOAT, false, 0, cubeBuffer);
    GLES20.glEnableVertexAttribArray(mAPositionHandle);

    textureBuffer.position(0);
    GLES20.glVertexAttribPointer(mATextureCoordinateHandle, 2, GLES20.GL_FLOAT, false, 0, textureBuffer);
    GLES20.glEnableVertexAttribArray(mATextureCoordinateHandle);

    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId);
    GLES20.glUniform1i(mUTextureHandle, 0);

    GLES20.glUniformMatrix4fv(mUMVPMatrixHandle, 1, false, mMVPMatrix, 0);

    onDrawArraysPre();//

    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);

    onDrawArraysAfter();//

    GLES20.glDisableVertexAttribArray(mAPositionHandle);
    GLES20.glDisableVertexAttribArray(mATextureCoordinateHandle);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
}
 
開發者ID:vipycm,項目名稱:mao-android,代碼行數:33,代碼來源:SunriseFilter.java


注:本文中的java.nio.FloatBuffer.position方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。