GlStateManager.java

com.mojang.blaze3d.opengl.GlStateManager

信息

  • 全限定名:com.mojang.blaze3d.opengl.GlStateManager
  • 类型:public class
  • 包:com.mojang.blaze3d.opengl
  • 源码路径:src/main/java/com/mojang/blaze3d/opengl/GlStateManager.java
  • 起始行号:L27
  • 职责:

    TODO

字段/常量

  • PLOT_TEXTURES

    • 类型: Plot
    • 修饰符: private static final
    • 源码定位: L28
    • 说明:

      TODO

  • numTextures

    • 类型: int
    • 修饰符: private static
    • 源码定位: L29
    • 说明:

      TODO

  • PLOT_BUFFERS

    • 类型: Plot
    • 修饰符: private static final
    • 源码定位: L30
    • 说明:

      TODO

  • numBuffers

    • 类型: int
    • 修饰符: private static
    • 源码定位: L31
    • 说明:

      TODO

  • BLEND

    • 类型: GlStateManager.BlendState
    • 修饰符: private static final
    • 源码定位: L32
    • 说明:

      TODO

  • DEPTH

    • 类型: GlStateManager.DepthState
    • 修饰符: private static final
    • 源码定位: L33
    • 说明:

      TODO

  • CULL

    • 类型: GlStateManager.CullState
    • 修饰符: private static final
    • 源码定位: L34
    • 说明:

      TODO

  • POLY_OFFSET

    • 类型: GlStateManager.PolygonOffsetState
    • 修饰符: private static final
    • 源码定位: L35
    • 说明:

      TODO

  • COLOR_LOGIC

    • 类型: GlStateManager.ColorLogicState
    • 修饰符: private static final
    • 源码定位: L36
    • 说明:

      TODO

  • SCISSOR

    • 类型: GlStateManager.ScissorState
    • 修饰符: private static final
    • 源码定位: L37
    • 说明:

      TODO

  • activeTexture

    • 类型: int
    • 修饰符: private static
    • 源码定位: L38
    • 说明:

      TODO

  • TEXTURE_COUNT

    • 类型: int
    • 修饰符: private static final
    • 源码定位: L39
    • 说明:

      TODO

  • TEXTURES

    • 类型: GlStateManager.TextureState[]
    • 修饰符: private static final
    • 源码定位: L40
    • 说明:

      TODO

  • COLOR_MASK

    • 类型: int
    • 修饰符: private static
    • 源码定位: L43
    • 说明:

      TODO

  • readFbo

    • 类型: int
    • 修饰符: private static
    • 源码定位: L45
    • 说明:

      TODO

  • writeFbo

    • 类型: int
    • 修饰符: private static
    • 源码定位: L46
    • 说明:

      TODO

内部类/嵌套类型

  • com.mojang.blaze3d.opengl.GlStateManager.BlendState

    • 类型: class
    • 修饰符: private static
    • 源码定位: L520
    • 说明:

      TODO

  • com.mojang.blaze3d.opengl.GlStateManager.BooleanState

    • 类型: class
    • 修饰符: private static
    • 源码定位: L529
    • 说明:

      TODO

  • com.mojang.blaze3d.opengl.GlStateManager.ColorLogicState

    • 类型: class
    • 修饰符: private static
    • 源码定位: L559
    • 说明:

      TODO

  • com.mojang.blaze3d.opengl.GlStateManager.CullState

    • 类型: class
    • 修饰符: private static
    • 源码定位: L565
    • 说明:

      TODO

  • com.mojang.blaze3d.opengl.GlStateManager.DepthState

    • 类型: class
    • 修饰符: private static
    • 源码定位: L570
    • 说明:

      TODO

  • com.mojang.blaze3d.opengl.GlStateManager.PolygonOffsetState

    • 类型: class
    • 修饰符: private static
    • 源码定位: L577
    • 说明:

      TODO

  • com.mojang.blaze3d.opengl.GlStateManager.ScissorState

    • 类型: class
    • 修饰符: private static
    • 源码定位: L584
    • 说明:

      TODO

  • com.mojang.blaze3d.opengl.GlStateManager.TextureState

    • 类型: class
    • 修饰符: private static
    • 源码定位: L589
    • 说明:

      TODO

构造器

方法

下面的方法块按源码顺序生成。

public static void _disableScissorTest() @ L48

  • 方法名:_disableScissorTest
  • 源码定位:L48
  • 返回类型:void
  • 修饰符:public static

参数:

说明:

TODO

public static void _enableScissorTest() @ L53

  • 方法名:_enableScissorTest
  • 源码定位:L53
  • 返回类型:void
  • 修饰符:public static

参数:

说明:

TODO

public static void _scissorBox(int x, int y, int width, int height) @ L58

  • 方法名:_scissorBox
  • 源码定位:L58
  • 返回类型:void
  • 修饰符:public static

参数:

  • x: int
  • y: int
  • width: int
  • height: int

说明:

TODO

public static void _disableDepthTest() @ L63

  • 方法名:_disableDepthTest
  • 源码定位:L63
  • 返回类型:void
  • 修饰符:public static

参数:

说明:

TODO

public static void _enableDepthTest() @ L68

  • 方法名:_enableDepthTest
  • 源码定位:L68
  • 返回类型:void
  • 修饰符:public static

参数:

说明:

TODO

public static void _depthFunc(int func) @ L73

  • 方法名:_depthFunc
  • 源码定位:L73
  • 返回类型:void
  • 修饰符:public static

参数:

  • func: int

说明:

TODO

public static void _depthMask(boolean mask) @ L81

  • 方法名:_depthMask
  • 源码定位:L81
  • 返回类型:void
  • 修饰符:public static

参数:

  • mask: boolean

说明:

TODO

public static void _disableBlend() @ L89

  • 方法名:_disableBlend
  • 源码定位:L89
  • 返回类型:void
  • 修饰符:public static

参数:

说明:

TODO

public static void _enableBlend() @ L94

  • 方法名:_enableBlend
  • 源码定位:L94
  • 返回类型:void
  • 修饰符:public static

参数:

说明:

TODO

public static void _blendFuncSeparate(int srcRgb, int dstRgb, int srcAlpha, int dstAlpha) @ L99

  • 方法名:_blendFuncSeparate
  • 源码定位:L99
  • 返回类型:void
  • 修饰符:public static

参数:

  • srcRgb: int
  • dstRgb: int
  • srcAlpha: int
  • dstAlpha: int

说明:

TODO

public static int glGetProgrami(int program, int pname) @ L110

  • 方法名:glGetProgrami
  • 源码定位:L110
  • 返回类型:int
  • 修饰符:public static

参数:

  • program: int
  • pname: int

说明:

TODO

public static void glAttachShader(int program, int shader) @ L115

  • 方法名:glAttachShader
  • 源码定位:L115
  • 返回类型:void
  • 修饰符:public static

参数:

  • program: int
  • shader: int

说明:

TODO

public static void glDeleteShader(int shader) @ L120

  • 方法名:glDeleteShader
  • 源码定位:L120
  • 返回类型:void
  • 修饰符:public static

参数:

  • shader: int

说明:

TODO

public static int glCreateShader(int type) @ L125

  • 方法名:glCreateShader
  • 源码定位:L125
  • 返回类型:int
  • 修饰符:public static

参数:

  • type: int

说明:

TODO

public static void glShaderSource(int shader, String source) @ L130

  • 方法名:glShaderSource
  • 源码定位:L130
  • 返回类型:void
  • 修饰符:public static

参数:

  • shader: int
  • source: String

说明:

TODO

public static void glCompileShader(int shader) @ L147

  • 方法名:glCompileShader
  • 源码定位:L147
  • 返回类型:void
  • 修饰符:public static

参数:

  • shader: int

说明:

TODO

public static int glGetShaderi(int shader, int pname) @ L152

  • 方法名:glGetShaderi
  • 源码定位:L152
  • 返回类型:int
  • 修饰符:public static

参数:

  • shader: int
  • pname: int

说明:

TODO

public static void _glUseProgram(int program) @ L157

  • 方法名:_glUseProgram
  • 源码定位:L157
  • 返回类型:void
  • 修饰符:public static

参数:

  • program: int

说明:

TODO

public static int glCreateProgram() @ L162

  • 方法名:glCreateProgram
  • 源码定位:L162
  • 返回类型:int
  • 修饰符:public static

参数:

说明:

TODO

public static void glDeleteProgram(int program) @ L167

  • 方法名:glDeleteProgram
  • 源码定位:L167
  • 返回类型:void
  • 修饰符:public static

参数:

  • program: int

说明:

TODO

public static void glLinkProgram(int program) @ L172

  • 方法名:glLinkProgram
  • 源码定位:L172
  • 返回类型:void
  • 修饰符:public static

参数:

  • program: int

说明:

TODO

public static int _glGetUniformLocation(int program, CharSequence name) @ L177

  • 方法名:_glGetUniformLocation
  • 源码定位:L177
  • 返回类型:int
  • 修饰符:public static

参数:

  • program: int
  • name: CharSequence

说明:

TODO

public static void _glUniform1i(int location, int v0) @ L182

  • 方法名:_glUniform1i
  • 源码定位:L182
  • 返回类型:void
  • 修饰符:public static

参数:

  • location: int
  • v0: int

说明:

TODO

public static void _glBindAttribLocation(int program, int location, CharSequence name) @ L187

  • 方法名:_glBindAttribLocation
  • 源码定位:L187
  • 返回类型:void
  • 修饰符:public static

参数:

  • program: int
  • location: int
  • name: CharSequence

说明:

TODO

static void incrementTrackedBuffers() @ L192

  • 方法名:incrementTrackedBuffers
  • 源码定位:L192
  • 返回类型:void
  • 修饰符:static

参数:

说明:

TODO

public static int _glGenBuffers() @ L197

  • 方法名:_glGenBuffers
  • 源码定位:L197
  • 返回类型:int
  • 修饰符:public static

参数:

说明:

TODO

public static int _glGenVertexArrays() @ L203

  • 方法名:_glGenVertexArrays
  • 源码定位:L203
  • 返回类型:int
  • 修饰符:public static

参数:

说明:

TODO

public static void _glBindBuffer(int target, int buffer) @ L208

  • 方法名:_glBindBuffer
  • 源码定位:L208
  • 返回类型:void
  • 修饰符:public static

参数:

  • target: int
  • buffer: int

说明:

TODO

public static void _glBindVertexArray(int arrayId) @ L213

  • 方法名:_glBindVertexArray
  • 源码定位:L213
  • 返回类型:void
  • 修饰符:public static

参数:

  • arrayId: int

说明:

TODO

public static void _glBufferData(int target, ByteBuffer data, int usage) @ L218

  • 方法名:_glBufferData
  • 源码定位:L218
  • 返回类型:void
  • 修饰符:public static

参数:

  • target: int
  • data: ByteBuffer
  • usage: int

说明:

TODO

public static void _glBufferSubData(int target, long offset, ByteBuffer data) @ L223

  • 方法名:_glBufferSubData
  • 源码定位:L223
  • 返回类型:void
  • 修饰符:public static

参数:

  • target: int
  • offset: long
  • data: ByteBuffer

说明:

TODO

public static void _glBufferData(int target, long size, int usage) @ L228

  • 方法名:_glBufferData
  • 源码定位:L228
  • 返回类型:void
  • 修饰符:public static

参数:

  • target: int
  • size: long
  • usage: int

说明:

TODO

public static ByteBuffer _glMapBufferRange(int target, long offset, long length, int access) @ L233

  • 方法名:_glMapBufferRange
  • 源码定位:L233
  • 返回类型:ByteBuffer
  • 修饰符:public static

参数:

  • target: int
  • offset: long
  • length: long
  • access: int

说明:

TODO

public static void _glUnmapBuffer(int target) @ L238

  • 方法名:_glUnmapBuffer
  • 源码定位:L238
  • 返回类型:void
  • 修饰符:public static

参数:

  • target: int

说明:

TODO

public static void _glDeleteBuffers(int buffer) @ L243

  • 方法名:_glDeleteBuffers
  • 源码定位:L243
  • 返回类型:void
  • 修饰符:public static

参数:

  • buffer: int

说明:

TODO

public static void _glBindFramebuffer(int target, int framebuffer) @ L250

  • 方法名:_glBindFramebuffer
  • 源码定位:L250
  • 返回类型:void
  • 修饰符:public static

参数:

  • target: int
  • framebuffer: int

说明:

TODO

public static int getFrameBuffer(int target) @ L262

  • 方法名:getFrameBuffer
  • 源码定位:L262
  • 返回类型:int
  • 修饰符:public static

参数:

  • target: int

说明:

TODO

public static void _glBlitFrameBuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter) @ L270

  • 方法名:_glBlitFrameBuffer
  • 源码定位:L270
  • 返回类型:void
  • 修饰符:public static

参数:

  • srcX0: int
  • srcY0: int
  • srcX1: int
  • srcY1: int
  • dstX0: int
  • dstY0: int
  • dstX1: int
  • dstY1: int
  • mask: int
  • filter: int

说明:

TODO

public static void _glDeleteFramebuffers(int framebuffer) @ L275

  • 方法名:_glDeleteFramebuffers
  • 源码定位:L275
  • 返回类型:void
  • 修饰符:public static

参数:

  • framebuffer: int

说明:

TODO

public static int glGenFramebuffers() @ L287

  • 方法名:glGenFramebuffers
  • 源码定位:L287
  • 返回类型:int
  • 修饰符:public static

参数:

说明:

TODO

public static void _glFramebufferTexture2D(int target, int attachment, int textarget, int texture, int level) @ L292

  • 方法名:_glFramebufferTexture2D
  • 源码定位:L292
  • 返回类型:void
  • 修饰符:public static

参数:

  • target: int
  • attachment: int
  • textarget: int
  • texture: int
  • level: int

说明:

TODO

public static void glBlendFuncSeparate(int srcColor, int dstColor, int srcAlpha, int dstAlpha) @ L297

  • 方法名:glBlendFuncSeparate
  • 源码定位:L297
  • 返回类型:void
  • 修饰符:public static

参数:

  • srcColor: int
  • dstColor: int
  • srcAlpha: int
  • dstAlpha: int

说明:

TODO

public static String glGetShaderInfoLog(int shader, int maxLength) @ L302

  • 方法名:glGetShaderInfoLog
  • 源码定位:L302
  • 返回类型:String
  • 修饰符:public static

参数:

  • shader: int
  • maxLength: int

说明:

TODO

public static String glGetProgramInfoLog(int program, int maxLength) @ L307

  • 方法名:glGetProgramInfoLog
  • 源码定位:L307
  • 返回类型:String
  • 修饰符:public static

参数:

  • program: int
  • maxLength: int

说明:

TODO

public static void _enableCull() @ L312

  • 方法名:_enableCull
  • 源码定位:L312
  • 返回类型:void
  • 修饰符:public static

参数:

说明:

TODO

public static void _disableCull() @ L317

  • 方法名:_disableCull
  • 源码定位:L317
  • 返回类型:void
  • 修饰符:public static

参数:

说明:

TODO

public static void _polygonMode(int face, int mode) @ L322

  • 方法名:_polygonMode
  • 源码定位:L322
  • 返回类型:void
  • 修饰符:public static

参数:

  • face: int
  • mode: int

说明:

TODO

public static void _enablePolygonOffset() @ L327

  • 方法名:_enablePolygonOffset
  • 源码定位:L327
  • 返回类型:void
  • 修饰符:public static

参数:

说明:

TODO

public static void _disablePolygonOffset() @ L332

  • 方法名:_disablePolygonOffset
  • 源码定位:L332
  • 返回类型:void
  • 修饰符:public static

参数:

说明:

TODO

public static void _polygonOffset(float factor, float units) @ L337

  • 方法名:_polygonOffset
  • 源码定位:L337
  • 返回类型:void
  • 修饰符:public static

参数:

  • factor: float
  • units: float

说明:

TODO

public static void _enableColorLogicOp() @ L346

  • 方法名:_enableColorLogicOp
  • 源码定位:L346
  • 返回类型:void
  • 修饰符:public static

参数:

说明:

TODO

public static void _disableColorLogicOp() @ L351

  • 方法名:_disableColorLogicOp
  • 源码定位:L351
  • 返回类型:void
  • 修饰符:public static

参数:

说明:

TODO

public static void _logicOp(int op) @ L356

  • 方法名:_logicOp
  • 源码定位:L356
  • 返回类型:void
  • 修饰符:public static

参数:

  • op: int

说明:

TODO

public static void _activeTexture(int texture) @ L364

  • 方法名:_activeTexture
  • 源码定位:L364
  • 返回类型:void
  • 修饰符:public static

参数:

  • texture: int

说明:

TODO

public static void _texParameter(int target, int name, int value) @ L372

  • 方法名:_texParameter
  • 源码定位:L372
  • 返回类型:void
  • 修饰符:public static

参数:

  • target: int
  • name: int
  • value: int

说明:

TODO

public static int _getTexLevelParameter(int target, int level, int name) @ L377

  • 方法名:_getTexLevelParameter
  • 源码定位:L377
  • 返回类型:int
  • 修饰符:public static

参数:

  • target: int
  • level: int
  • name: int

说明:

TODO

public static int _genTexture() @ L381

  • 方法名:_genTexture
  • 源码定位:L381
  • 返回类型:int
  • 修饰符:public static

参数:

说明:

TODO

public static void _deleteTexture(int id) @ L388

  • 方法名:_deleteTexture
  • 源码定位:L388
  • 返回类型:void
  • 修饰符:public static

参数:

  • id: int

说明:

TODO

public static void _bindTexture(int id) @ L402

  • 方法名:_bindTexture
  • 源码定位:L402
  • 返回类型:void
  • 修饰符:public static

参数:

  • id: int

说明:

TODO

public static void _texImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer pixels) @ L410

  • 方法名:_texImage2D
  • 源码定位:L410
  • 返回类型:void
  • 修饰符:public static

参数:

  • target: int
  • level: int
  • internalformat: int
  • width: int
  • height: int
  • border: int
  • format: int
  • type: int
  • pixels: ByteBuffer

说明:

TODO

public static void _texSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, long pixels) @ L417

  • 方法名:_texSubImage2D
  • 源码定位:L417
  • 返回类型:void
  • 修饰符:public static

参数:

  • target: int
  • level: int
  • xoffset: int
  • yoffset: int
  • width: int
  • height: int
  • format: int
  • type: int
  • pixels: long

说明:

TODO

public static void _texSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, ByteBuffer pixels) @ L422

  • 方法名:_texSubImage2D
  • 源码定位:L422
  • 返回类型:void
  • 修饰符:public static

参数:

  • target: int
  • level: int
  • xoffset: int
  • yoffset: int
  • width: int
  • height: int
  • format: int
  • type: int
  • pixels: ByteBuffer

说明:

TODO

public static void _viewport(int x, int y, int width, int height) @ L427

  • 方法名:_viewport
  • 源码定位:L427
  • 返回类型:void
  • 修饰符:public static

参数:

  • x: int
  • y: int
  • width: int
  • height: int

说明:

TODO

public static void _colorMask(int writeMask) @ L431

  • 方法名:_colorMask
  • 源码定位:L431
  • 返回类型:void
  • 修饰符:public static

参数:

  • writeMask: int

说明:

TODO

public static void _clear(int mask) @ L439

  • 方法名:_clear
  • 源码定位:L439
  • 返回类型:void
  • 修饰符:public static

参数:

  • mask: int

说明:

TODO

public static void _vertexAttribPointer(int index, int size, int type, boolean normalized, int stride, long value) @ L447

  • 方法名:_vertexAttribPointer
  • 源码定位:L447
  • 返回类型:void
  • 修饰符:public static

参数:

  • index: int
  • size: int
  • type: int
  • normalized: boolean
  • stride: int
  • value: long

说明:

TODO

public static void _vertexAttribIPointer(int index, int size, int type, int stride, long value) @ L452

  • 方法名:_vertexAttribIPointer
  • 源码定位:L452
  • 返回类型:void
  • 修饰符:public static

参数:

  • index: int
  • size: int
  • type: int
  • stride: int
  • value: long

说明:

TODO

public static void _enableVertexAttribArray(int index) @ L457

  • 方法名:_enableVertexAttribArray
  • 源码定位:L457
  • 返回类型:void
  • 修饰符:public static

参数:

  • index: int

说明:

TODO

public static void _drawElements(int mode, int count, int type, long indices) @ L462

  • 方法名:_drawElements
  • 源码定位:L462
  • 返回类型:void
  • 修饰符:public static

参数:

  • mode: int
  • count: int
  • type: int
  • indices: long

说明:

TODO

public static void _drawArrays(int mode, int first, int count) @ L467

  • 方法名:_drawArrays
  • 源码定位:L467
  • 返回类型:void
  • 修饰符:public static

参数:

  • mode: int
  • first: int
  • count: int

说明:

TODO

public static void _pixelStore(int name, int value) @ L472

  • 方法名:_pixelStore
  • 源码定位:L472
  • 返回类型:void
  • 修饰符:public static

参数:

  • name: int
  • value: int

说明:

TODO

public static void _readPixels(int x, int y, int width, int height, int format, int type, long pixels) @ L477

  • 方法名:_readPixels
  • 源码定位:L477
  • 返回类型:void
  • 修饰符:public static

参数:

  • x: int
  • y: int
  • width: int
  • height: int
  • format: int
  • type: int
  • pixels: long

说明:

TODO

public static int _getError() @ L482

  • 方法名:_getError
  • 源码定位:L482
  • 返回类型:int
  • 修饰符:public static

参数:

说明:

TODO

public static void clearGlErrors() @ L487

  • 方法名:clearGlErrors
  • 源码定位:L487
  • 返回类型:void
  • 修饰符:public static

参数:

说明:

TODO

public static String _getString(int id) @ L494

  • 方法名:_getString
  • 源码定位:L494
  • 返回类型:String
  • 修饰符:public static

参数:

  • id: int

说明:

TODO

public static int _getInteger(int name) @ L499

  • 方法名:_getInteger
  • 源码定位:L499
  • 返回类型:int
  • 修饰符:public static

参数:

  • name: int

说明:

TODO

public static long _glFenceSync(int condition, int flags) @ L504

  • 方法名:_glFenceSync
  • 源码定位:L504
  • 返回类型:long
  • 修饰符:public static

参数:

  • condition: int
  • flags: int

说明:

TODO

public static int _glClientWaitSync(long sync, int flags, long timeout) @ L509

  • 方法名:_glClientWaitSync
  • 源码定位:L509
  • 返回类型:int
  • 修饰符:public static

参数:

  • sync: long
  • flags: int
  • timeout: long

说明:

TODO

public static void _glDeleteSync(long sync) @ L514

  • 方法名:_glDeleteSync
  • 源码定位:L514
  • 返回类型:void
  • 修饰符:public static

参数:

  • sync: long

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class GlStateManager {
    private static final Plot PLOT_TEXTURES = TracyClient.createPlot("GPU Textures");
    private static int numTextures = 0;
    private static final Plot PLOT_BUFFERS = TracyClient.createPlot("GPU Buffers");
    private static int numBuffers = 0;
    private static final GlStateManager.BlendState BLEND = new GlStateManager.BlendState();
    private static final GlStateManager.DepthState DEPTH = new GlStateManager.DepthState();
    private static final GlStateManager.CullState CULL = new GlStateManager.CullState();
    private static final GlStateManager.PolygonOffsetState POLY_OFFSET = new GlStateManager.PolygonOffsetState();
    private static final GlStateManager.ColorLogicState COLOR_LOGIC = new GlStateManager.ColorLogicState();
    private static final GlStateManager.ScissorState SCISSOR = new GlStateManager.ScissorState();
    private static int activeTexture;
    private static final int TEXTURE_COUNT = 12;
    private static final GlStateManager.TextureState[] TEXTURES = IntStream.range(0, 12)
        .mapToObj(i -> new GlStateManager.TextureState())
        .toArray(GlStateManager.TextureState[]::new);
    @ColorTargetState.WriteMask
    private static int COLOR_MASK = 15;
    private static int readFbo;
    private static int writeFbo;
 
    public static void _disableScissorTest() {
        RenderSystem.assertOnRenderThread();
        SCISSOR.mode.disable();
    }
 
    public static void _enableScissorTest() {
        RenderSystem.assertOnRenderThread();
        SCISSOR.mode.enable();
    }
 
    public static void _scissorBox(int x, int y, int width, int height) {
        RenderSystem.assertOnRenderThread();
        GL20.glScissor(x, y, width, height);
    }
 
    public static void _disableDepthTest() {
        RenderSystem.assertOnRenderThread();
        DEPTH.mode.disable();
    }
 
    public static void _enableDepthTest() {
        RenderSystem.assertOnRenderThread();
        DEPTH.mode.enable();
    }
 
    public static void _depthFunc(int func) {
        RenderSystem.assertOnRenderThread();
        if (func != DEPTH.func) {
            DEPTH.func = func;
            GL11.glDepthFunc(func);
        }
    }
 
    public static void _depthMask(boolean mask) {
        RenderSystem.assertOnRenderThread();
        if (mask != DEPTH.mask) {
            DEPTH.mask = mask;
            GL11.glDepthMask(mask);
        }
    }
 
    public static void _disableBlend() {
        RenderSystem.assertOnRenderThread();
        BLEND.mode.disable();
    }
 
    public static void _enableBlend() {
        RenderSystem.assertOnRenderThread();
        BLEND.mode.enable();
    }
 
    public static void _blendFuncSeparate(int srcRgb, int dstRgb, int srcAlpha, int dstAlpha) {
        RenderSystem.assertOnRenderThread();
        if (srcRgb != BLEND.srcRgb || dstRgb != BLEND.dstRgb || srcAlpha != BLEND.srcAlpha || dstAlpha != BLEND.dstAlpha) {
            BLEND.srcRgb = srcRgb;
            BLEND.dstRgb = dstRgb;
            BLEND.srcAlpha = srcAlpha;
            BLEND.dstAlpha = dstAlpha;
            glBlendFuncSeparate(srcRgb, dstRgb, srcAlpha, dstAlpha);
        }
    }
 
    public static int glGetProgrami(int program, int pname) {
        RenderSystem.assertOnRenderThread();
        return GL20.glGetProgrami(program, pname);
    }
 
    public static void glAttachShader(int program, int shader) {
        RenderSystem.assertOnRenderThread();
        GL20.glAttachShader(program, shader);
    }
 
    public static void glDeleteShader(int shader) {
        RenderSystem.assertOnRenderThread();
        GL20.glDeleteShader(shader);
    }
 
    public static int glCreateShader(int type) {
        RenderSystem.assertOnRenderThread();
        return GL20.glCreateShader(type);
    }
 
    public static void glShaderSource(int shader, String source) {
        RenderSystem.assertOnRenderThread();
        byte[] encoded = source.getBytes(StandardCharsets.UTF_8);
        ByteBuffer buffer = MemoryUtil.memAlloc(encoded.length + 1);
        buffer.put(encoded);
        buffer.put((byte)0);
        buffer.flip();
 
        try (MemoryStack stack = MemoryStack.stackPush()) {
            PointerBuffer pointers = stack.mallocPointer(1);
            pointers.put(buffer);
            GL20C.nglShaderSource(shader, 1, pointers.address0(), 0L);
        } finally {
            MemoryUtil.memFree(buffer);
        }
    }
 
    public static void glCompileShader(int shader) {
        RenderSystem.assertOnRenderThread();
        GL20.glCompileShader(shader);
    }
 
    public static int glGetShaderi(int shader, int pname) {
        RenderSystem.assertOnRenderThread();
        return GL20.glGetShaderi(shader, pname);
    }
 
    public static void _glUseProgram(int program) {
        RenderSystem.assertOnRenderThread();
        GL20.glUseProgram(program);
    }
 
    public static int glCreateProgram() {
        RenderSystem.assertOnRenderThread();
        return GL20.glCreateProgram();
    }
 
    public static void glDeleteProgram(int program) {
        RenderSystem.assertOnRenderThread();
        GL20.glDeleteProgram(program);
    }
 
    public static void glLinkProgram(int program) {
        RenderSystem.assertOnRenderThread();
        GL20.glLinkProgram(program);
    }
 
    public static int _glGetUniformLocation(int program, CharSequence name) {
        RenderSystem.assertOnRenderThread();
        return GL20.glGetUniformLocation(program, name);
    }
 
    public static void _glUniform1i(int location, int v0) {
        RenderSystem.assertOnRenderThread();
        GL20.glUniform1i(location, v0);
    }
 
    public static void _glBindAttribLocation(int program, int location, CharSequence name) {
        RenderSystem.assertOnRenderThread();
        GL20.glBindAttribLocation(program, location, name);
    }
 
    static void incrementTrackedBuffers() {
        numBuffers++;
        PLOT_BUFFERS.setValue(numBuffers);
    }
 
    public static int _glGenBuffers() {
        RenderSystem.assertOnRenderThread();
        incrementTrackedBuffers();
        return GL15.glGenBuffers();
    }
 
    public static int _glGenVertexArrays() {
        RenderSystem.assertOnRenderThread();
        return GL30.glGenVertexArrays();
    }
 
    public static void _glBindBuffer(int target, int buffer) {
        RenderSystem.assertOnRenderThread();
        GL15.glBindBuffer(target, buffer);
    }
 
    public static void _glBindVertexArray(int arrayId) {
        RenderSystem.assertOnRenderThread();
        GL30.glBindVertexArray(arrayId);
    }
 
    public static void _glBufferData(int target, ByteBuffer data, int usage) {
        RenderSystem.assertOnRenderThread();
        GL15.glBufferData(target, data, usage);
    }
 
    public static void _glBufferSubData(int target, long offset, ByteBuffer data) {
        RenderSystem.assertOnRenderThread();
        GL15.glBufferSubData(target, offset, data);
    }
 
    public static void _glBufferData(int target, long size, int usage) {
        RenderSystem.assertOnRenderThread();
        GL15.glBufferData(target, size, usage);
    }
 
    public static @Nullable ByteBuffer _glMapBufferRange(int target, long offset, long length, int access) {
        RenderSystem.assertOnRenderThread();
        return GL30.glMapBufferRange(target, offset, length, access);
    }
 
    public static void _glUnmapBuffer(int target) {
        RenderSystem.assertOnRenderThread();
        GL15.glUnmapBuffer(target);
    }
 
    public static void _glDeleteBuffers(int buffer) {
        RenderSystem.assertOnRenderThread();
        numBuffers--;
        PLOT_BUFFERS.setValue(numBuffers);
        GL15.glDeleteBuffers(buffer);
    }
 
    public static void _glBindFramebuffer(int target, int framebuffer) {
        if ((target == 36008 || target == 36160) && readFbo != framebuffer) {
            GL30.glBindFramebuffer(36008, framebuffer);
            readFbo = framebuffer;
        }
 
        if ((target == 36009 || target == 36160) && writeFbo != framebuffer) {
            GL30.glBindFramebuffer(36009, framebuffer);
            writeFbo = framebuffer;
        }
    }
 
    public static int getFrameBuffer(int target) {
        if (target == 36008) {
            return readFbo;
        } else {
            return target == 36009 ? writeFbo : 0;
        }
    }
 
    public static void _glBlitFrameBuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter) {
        RenderSystem.assertOnRenderThread();
        GL30.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
    }
 
    public static void _glDeleteFramebuffers(int framebuffer) {
        RenderSystem.assertOnRenderThread();
        GL30.glDeleteFramebuffers(framebuffer);
        if (readFbo == framebuffer) {
            readFbo = 0;
        }
 
        if (writeFbo == framebuffer) {
            writeFbo = 0;
        }
    }
 
    public static int glGenFramebuffers() {
        RenderSystem.assertOnRenderThread();
        return GL30.glGenFramebuffers();
    }
 
    public static void _glFramebufferTexture2D(int target, int attachment, int textarget, int texture, int level) {
        RenderSystem.assertOnRenderThread();
        GL30.glFramebufferTexture2D(target, attachment, textarget, texture, level);
    }
 
    public static void glBlendFuncSeparate(int srcColor, int dstColor, int srcAlpha, int dstAlpha) {
        RenderSystem.assertOnRenderThread();
        GL14.glBlendFuncSeparate(srcColor, dstColor, srcAlpha, dstAlpha);
    }
 
    public static String glGetShaderInfoLog(int shader, int maxLength) {
        RenderSystem.assertOnRenderThread();
        return GL20.glGetShaderInfoLog(shader, maxLength);
    }
 
    public static String glGetProgramInfoLog(int program, int maxLength) {
        RenderSystem.assertOnRenderThread();
        return GL20.glGetProgramInfoLog(program, maxLength);
    }
 
    public static void _enableCull() {
        RenderSystem.assertOnRenderThread();
        CULL.enable.enable();
    }
 
    public static void _disableCull() {
        RenderSystem.assertOnRenderThread();
        CULL.enable.disable();
    }
 
    public static void _polygonMode(int face, int mode) {
        RenderSystem.assertOnRenderThread();
        GL11.glPolygonMode(face, mode);
    }
 
    public static void _enablePolygonOffset() {
        RenderSystem.assertOnRenderThread();
        POLY_OFFSET.fill.enable();
    }
 
    public static void _disablePolygonOffset() {
        RenderSystem.assertOnRenderThread();
        POLY_OFFSET.fill.disable();
    }
 
    public static void _polygonOffset(float factor, float units) {
        RenderSystem.assertOnRenderThread();
        if (factor != POLY_OFFSET.factor || units != POLY_OFFSET.units) {
            POLY_OFFSET.factor = factor;
            POLY_OFFSET.units = units;
            GL11.glPolygonOffset(factor, units);
        }
    }
 
    public static void _enableColorLogicOp() {
        RenderSystem.assertOnRenderThread();
        COLOR_LOGIC.enable.enable();
    }
 
    public static void _disableColorLogicOp() {
        RenderSystem.assertOnRenderThread();
        COLOR_LOGIC.enable.disable();
    }
 
    public static void _logicOp(int op) {
        RenderSystem.assertOnRenderThread();
        if (op != COLOR_LOGIC.op) {
            COLOR_LOGIC.op = op;
            GL11.glLogicOp(op);
        }
    }
 
    public static void _activeTexture(int texture) {
        RenderSystem.assertOnRenderThread();
        if (activeTexture != texture - 33984) {
            activeTexture = texture - 33984;
            GL13.glActiveTexture(texture);
        }
    }
 
    public static void _texParameter(int target, int name, int value) {
        RenderSystem.assertOnRenderThread();
        GL11.glTexParameteri(target, name, value);
    }
 
    public static int _getTexLevelParameter(int target, int level, int name) {
        return GL11.glGetTexLevelParameteri(target, level, name);
    }
 
    public static int _genTexture() {
        RenderSystem.assertOnRenderThread();
        numTextures++;
        PLOT_TEXTURES.setValue(numTextures);
        return GL11.glGenTextures();
    }
 
    public static void _deleteTexture(int id) {
        RenderSystem.assertOnRenderThread();
        GL11.glDeleteTextures(id);
 
        for (GlStateManager.TextureState state : TEXTURES) {
            if (state.binding == id) {
                state.binding = -1;
            }
        }
 
        numTextures--;
        PLOT_TEXTURES.setValue(numTextures);
    }
 
    public static void _bindTexture(int id) {
        RenderSystem.assertOnRenderThread();
        if (id != TEXTURES[activeTexture].binding) {
            TEXTURES[activeTexture].binding = id;
            GL11.glBindTexture(3553, id);
        }
    }
 
    public static void _texImage2D(
        int target, int level, int internalformat, int width, int height, int border, int format, int type, @Nullable ByteBuffer pixels
    ) {
        RenderSystem.assertOnRenderThread();
        GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
    }
 
    public static void _texSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, long pixels) {
        RenderSystem.assertOnRenderThread();
        GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
    }
 
    public static void _texSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, ByteBuffer pixels) {
        RenderSystem.assertOnRenderThread();
        GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
    }
 
    public static void _viewport(int x, int y, int width, int height) {
        GL11.glViewport(x, y, width, height);
    }
 
    public static void _colorMask(@ColorTargetState.WriteMask int writeMask) {
        RenderSystem.assertOnRenderThread();
        if (writeMask != COLOR_MASK) {
            COLOR_MASK = writeMask;
            GL11.glColorMask((writeMask & 1) != 0, (writeMask & 2) != 0, (writeMask & 4) != 0, (writeMask & 8) != 0);
        }
    }
 
    public static void _clear(int mask) {
        RenderSystem.assertOnRenderThread();
        GL11.glClear(mask);
        if (MacosUtil.IS_MACOS) {
            _getError();
        }
    }
 
    public static void _vertexAttribPointer(int index, int size, int type, boolean normalized, int stride, long value) {
        RenderSystem.assertOnRenderThread();
        GL20.glVertexAttribPointer(index, size, type, normalized, stride, value);
    }
 
    public static void _vertexAttribIPointer(int index, int size, int type, int stride, long value) {
        RenderSystem.assertOnRenderThread();
        GL30.glVertexAttribIPointer(index, size, type, stride, value);
    }
 
    public static void _enableVertexAttribArray(int index) {
        RenderSystem.assertOnRenderThread();
        GL20.glEnableVertexAttribArray(index);
    }
 
    public static void _drawElements(int mode, int count, int type, long indices) {
        RenderSystem.assertOnRenderThread();
        GL11.glDrawElements(mode, count, type, indices);
    }
 
    public static void _drawArrays(int mode, int first, int count) {
        RenderSystem.assertOnRenderThread();
        GL11.glDrawArrays(mode, first, count);
    }
 
    public static void _pixelStore(int name, int value) {
        RenderSystem.assertOnRenderThread();
        GL11.glPixelStorei(name, value);
    }
 
    public static void _readPixels(int x, int y, int width, int height, int format, int type, long pixels) {
        RenderSystem.assertOnRenderThread();
        GL11.glReadPixels(x, y, width, height, format, type, pixels);
    }
 
    public static int _getError() {
        RenderSystem.assertOnRenderThread();
        return GL11.glGetError();
    }
 
    public static void clearGlErrors() {
        RenderSystem.assertOnRenderThread();
 
        while (GL11.glGetError() != 0) {
        }
    }
 
    public static String _getString(int id) {
        RenderSystem.assertOnRenderThread();
        return GL11.glGetString(id);
    }
 
    public static int _getInteger(int name) {
        RenderSystem.assertOnRenderThread();
        return GL11.glGetInteger(name);
    }
 
    public static long _glFenceSync(int condition, int flags) {
        RenderSystem.assertOnRenderThread();
        return GL32.glFenceSync(condition, flags);
    }
 
    public static int _glClientWaitSync(long sync, int flags, long timeout) {
        RenderSystem.assertOnRenderThread();
        return GL32.glClientWaitSync(sync, flags, timeout);
    }
 
    public static void _glDeleteSync(long sync) {
        RenderSystem.assertOnRenderThread();
        GL32.glDeleteSync(sync);
    }
 
    @OnlyIn(Dist.CLIENT)
    private static class BlendState {
        public final GlStateManager.BooleanState mode = new GlStateManager.BooleanState(3042);
        public int srcRgb = 1;
        public int dstRgb = 0;
        public int srcAlpha = 1;
        public int dstAlpha = 0;
    }
 
    @OnlyIn(Dist.CLIENT)
    private static class BooleanState {
        private final int state;
        private boolean enabled;
 
        public BooleanState(int state) {
            this.state = state;
        }
 
        public void disable() {
            this.setEnabled(false);
        }
 
        public void enable() {
            this.setEnabled(true);
        }
 
        public void setEnabled(boolean enabled) {
            RenderSystem.assertOnRenderThread();
            if (enabled != this.enabled) {
                this.enabled = enabled;
                if (enabled) {
                    GL11.glEnable(this.state);
                } else {
                    GL11.glDisable(this.state);
                }
            }
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    private static class ColorLogicState {
        public final GlStateManager.BooleanState enable = new GlStateManager.BooleanState(3058);
        public int op = 5379;
    }
 
    @OnlyIn(Dist.CLIENT)
    private static class CullState {
        public final GlStateManager.BooleanState enable = new GlStateManager.BooleanState(2884);
    }
 
    @OnlyIn(Dist.CLIENT)
    private static class DepthState {
        public final GlStateManager.BooleanState mode = new GlStateManager.BooleanState(2929);
        public boolean mask = true;
        public int func = 513;
    }
 
    @OnlyIn(Dist.CLIENT)
    private static class PolygonOffsetState {
        public final GlStateManager.BooleanState fill = new GlStateManager.BooleanState(32823);
        public float factor;
        public float units;
    }
 
    @OnlyIn(Dist.CLIENT)
    private static class ScissorState {
        public final GlStateManager.BooleanState mode = new GlStateManager.BooleanState(3089);
    }
 
    @OnlyIn(Dist.CLIENT)
    private static class TextureState {
        public int binding;
    }
}

引用的其他类

  • RenderSystem
    • 引用位置: 方法调用
    • 关联成员: RenderSystem.assertOnRenderThread()