Here you can find the source of cubeTextureArray(float x0, float y0, float x1, float y1)
Parameter | Description |
---|---|
x0 | The x-value of the top-left texture coordinate. |
y0 | The y-value of the top-left texture coordinate. |
x1 | The x-value of the bottom-right texture coordinate. |
y1 | The y-value of the bottom-right texture coordinate. |
public static float[] cubeTextureArray(float x0, float y0, float x1, float y1)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w . j ava 2s . c om*/ * A GL_QUAD compatible array of texture coordinates. * * @param x0 * The x-value of the top-left texture coordinate. * @param y0 * The y-value of the top-left texture coordinate. * @param x1 * The x-value of the bottom-right texture coordinate. * @param y1 * The y-value of the bottom-right texture coordinate. * @return An array of coordinates that should be rendered 4 values at a * time to form a cube with given texture coordinates. */ public static float[] cubeTextureArray(float x0, float y0, float x1, float y1) { float[] tex = new float[] { x0, y0, x1, y0, x1, y1, x0, y1 }; return makeBigArray(tex, 6); } public static float[] makeBigArray(float[] array, int number) { float[] result = new float[array.length * number]; for (int i = 0; i < number; i++) { for (int j = 0; j < array.length; j++) { result[i * array.length + j] = array[j]; } } return result; } }