File tree Expand file tree Collapse file tree
src/main/java/cam72cam/mod/render/opengl Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99
1010public class DirectDraw {
1111 private final List <VertexBuilder > verts = new ArrayList <>();
12+ private Mode mode ;
13+
14+ public DirectDraw () {
15+ this (Mode .QUADS );
16+ }
17+
18+ public DirectDraw (Mode mode ) {
19+ this .mode = mode ;
20+ }
1221
1322 public void draw (RenderState state ) {
1423 try (With ctx = RenderContext .apply (state )) {
15- GL11 .glBegin (GL11 . GL_QUADS );
24+ GL11 .glBegin (mode . asGlMode () );
1625 for (VertexBuilder vert : verts ) {
1726 vert .draw ();
1827 }
@@ -84,4 +93,24 @@ private void draw() {
8493 GL11 .glVertex3d (x , y , z );
8594 }
8695 }
96+
97+ public enum Mode {
98+ LINES (GL11 .GL_LINES ),
99+ LINE_STRIP (GL11 .GL_LINE_STRIP ),
100+ TRIANGLES (GL11 .GL_TRIANGLES ),
101+ TRIANGLE_STRIP (GL11 .GL_TRIANGLE_STRIP ),
102+ TRIANGLE_FAN (GL11 .GL_TRIANGLE_FAN ),
103+ QUADS (GL11 .GL_QUADS ),
104+ ;
105+
106+ private final int glMode ;
107+
108+ Mode (int glMode ) {
109+ this .glMode = glMode ;
110+ }
111+
112+ int asGlMode () {
113+ return glMode ;
114+ }
115+ }
87116}
You can’t perform that action at this time.
0 commit comments