GLAllocation .java

net.minecraft.client.renderer.GLAllocation (class): members: createDirectFloatBuffer, createDirectByteBuffer, createDirectIntBuffer, generateDisplayLists.

net.minecraft.client.rendererclass73 linesclient2.0 KB

API Surface (6)

int generateDisplayLists(int range)
void deleteDisplayLists(int list, int range)
void deleteDisplayLists(int list)
ByteBuffer createDirectByteBuffer(int capacity)
IntBuffer createDirectIntBuffer(int capacity)
FloatBuffer createDirectFloatBuffer(int capacity)

String literals (3)

"No error code reported"
"glGenLists returned an ID of 0 for a count of "
", GL error ("

Full Source

GLAllocation.java73 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.renderer;
2
3
import java.nio.ByteBuffer;
4
import java.nio.ByteOrder;
5
import java.nio.FloatBuffer;
6
import java.nio.IntBuffer;
7
import org.lwjgl.opengl.GL11;
8
import org.lwjgl.util.glu.GLU;
9
10
public class GLAllocation
11
{
12
13
    /**
14
     * Generates the specified number of display lists and returns the first index.
15
     */
16
    public static synchronized int generateDisplayLists(int range)
17
    {
18
        int i = GL11.glGenLists(range);
19
20
        if (i == 0)
21
        {
22
            int j = GL11.glGetError();
23
            String s = "No error code reported";
24
25
            if (j != 0)
26
            {
27
                s = GLU.gluErrorString(j);
28
            }
29
30
            throw new IllegalStateException("glGenLists returned an ID of 0 for a count of " + range + ", GL error (" + j + "): " + s);
31
        }
32
        else
33
        {
34
            return i;
35
        }
36
    }
37
38
    public static synchronized void deleteDisplayLists(int list, int range)
39
    {
40
        GL11.glDeleteLists(list, range);
41
    }
42
43
    public static synchronized void deleteDisplayLists(int list)
44
    {
45
        GL11.glDeleteLists(list, 1);
46
    }
47
48
    /**
49
     * Creates and returns a direct byte buffer with the specified capacity. Applies native ordering to speed up access.
50
     */
51
    public static synchronized ByteBuffer createDirectByteBuffer(int capacity)
52
    {
53
        return ByteBuffer.allocateDirect(capacity).order(ByteOrder.nativeOrder());
54
    }
55
56
    /**
57
     * Creates and returns a direct int buffer with the specified capacity. Applies native ordering to speed up access.
58
     */
59
    public static IntBuffer createDirectIntBuffer(int capacity)
60
    {
61
        return createDirectByteBuffer(capacity << 2).asIntBuffer();
62
    }
63
64
    /**
65
     * Creates and returns a direct float buffer with the specified capacity. Applies native ordering to speed up
66
     * access.
67
     */
68
    public static FloatBuffer createDirectFloatBuffer(int capacity)
69
    {
70
        return createDirectByteBuffer(capacity << 2).asFloatBuffer();
71
    }
72
}
73

Deobfuscated MCP 1.8.9 source of GLAllocation from Marcelektro/MavenMCP-1.8.9 (net/minecraft/client/renderer/GLAllocation.java), stored verbatim.