use of io.xol.chunkstories.renderer.opengl.vbo.VertexBufferGL in project chunkstories by Hugobros3.
the class FarTerrainGSMeshRenderer method generateGrid.
VertexBufferGL generateGrid(int gridSubdivisions) {
VertexBufferGL grid = new VertexBufferGL();
ByteBuffer bb = MemoryUtil.memAlloc((gridSubdivisions + 1) * (gridSubdivisions + 1) * 1 * (3 * 4));
bb.order(ByteOrder.LITTLE_ENDIAN);
MemFreeByteBuffer mbb = new MemFreeByteBuffer(bb);
int s = 32 / gridSubdivisions;
for (int a = 0; a < gridSubdivisions + 1; a++) for (int b = 0; b < gridSubdivisions + 1; b++) {
int i = a * s;
int j = b * s;
bb.putFloat(i + 0);
bb.putFloat(0);
bb.putFloat(j + 0);
/*bb.putFloat(i + s);
bb.putFloat(0);
bb.putFloat(j + s);
bb.putFloat(i + s);
bb.putFloat(0);
bb.putFloat(j + 0);
bb.putFloat(i + 0);
bb.putFloat(0);
bb.putFloat(j + 0);
bb.putFloat(i + 0);
bb.putFloat(0);
bb.putFloat(j + s);
bb.putFloat(i + s);
bb.putFloat(0);
bb.putFloat(j + s);*/
}
bb.flip();
grid.uploadData(mbb);
return grid;
}
use of io.xol.chunkstories.renderer.opengl.vbo.VertexBufferGL in project chunkstories by Hugobros3.
the class OpenGLRenderingContext method drawFSQuad.
public void drawFSQuad() {
if (fsQuadVertices == null) {
fsQuadVertices = new VertexBufferGL();
FloatBuffer fsQuadBuffer = BufferUtils.createFloatBuffer(6 * 2);
fsQuadBuffer.put(new float[] { 1f, 1f, -1f, -1f, 1f, -1f, 1f, 1f, -1f, 1f, -1f, -1f });
fsQuadBuffer.flip();
fsQuadVertices.uploadData(fsQuadBuffer);
fsQuadAttrib = fsQuadVertices.asAttributeSource(VertexFormat.FLOAT, 2);
}
this.bindAttribute("vertexIn", fsQuadAttrib);
this.draw(Primitive.TRIANGLE, 0, 6);
}
use of io.xol.chunkstories.renderer.opengl.vbo.VertexBufferGL in project chunkstories by Hugobros3.
the class TextMeshObject method finalizeTemp.
private void finalizeTemp() {
if (done)
return;
if (temp <= 0)
return;
VertexBufferGL verticesObject = new VertexBufferGL();
tempBuffer.flip();
// System.out.println("Cucking"+temp);
verticesObject.uploadData(tempBuffer);
// System.out.println("Added " + verticesObject.getVramUsage() + " bytes worth of verticesObject");
verticesObjects.add(verticesObject);
tempBuffer = BufferUtils.createByteBuffer(4 * (3 + 2 + 4) * 6 * 128);
temp = 0;
}
use of io.xol.chunkstories.renderer.opengl.vbo.VertexBufferGL in project chunkstories by Hugobros3.
the class MeshRenderableImpl method uploadFloatBuffers.
protected void uploadFloatBuffers(FloatBuffer vertices, FloatBuffer textureCoordinates, FloatBuffer normals) {
verticesDataOnGpu = new VertexBufferGL();
texCoordDataOnGpu = new VertexBufferGL();
normalsDataOnGpu = new VertexBufferGL();
verticesDataOnGpu.uploadData(vertices);
texCoordDataOnGpu.uploadData(textureCoordinates);
normalsDataOnGpu.uploadData(normals);
}
use of io.xol.chunkstories.renderer.opengl.vbo.VertexBufferGL in project chunkstories by Hugobros3.
the class FarTerrainNoMeshRenderer method generateGrid.
VertexBufferGL generateGrid(int gridSubdivisions) {
VertexBufferGL grid = new VertexBufferGL();
ByteBuffer bb = MemoryUtil.memAlloc((gridSubdivisions + 1) * (gridSubdivisions + 1) * 2 * 3 * (3 * 4));
bb.order(ByteOrder.LITTLE_ENDIAN);
MemFreeByteBuffer mbb = new MemFreeByteBuffer(bb);
int s = 32 / gridSubdivisions;
for (int a = 0; a < gridSubdivisions + 1; a++) for (int b = 0; b < gridSubdivisions + 1; b++) {
int i = a * s;
int j = b * s;
bb.putFloat(i + 0);
bb.putFloat(0);
bb.putFloat(j + 0);
bb.putFloat(i + s);
bb.putFloat(0);
bb.putFloat(j + s);
bb.putFloat(i + s);
bb.putFloat(0);
bb.putFloat(j + 0);
bb.putFloat(i + 0);
bb.putFloat(0);
bb.putFloat(j + 0);
bb.putFloat(i + 0);
bb.putFloat(0);
bb.putFloat(j + s);
bb.putFloat(i + s);
bb.putFloat(0);
bb.putFloat(j + s);
}
bb.flip();
grid.uploadData(mbb);
return grid;
}
Aggregations