mirror of
https://github.com/processing/processing4.git
synced 2026-02-02 21:29:17 +01:00
more cleaning up and renaming
This commit is contained in:
@@ -94,7 +94,7 @@ class PFontTexture implements PConstants {
|
||||
h = PApplet.min(2 * textures[currentTex].glHeight, maxTexHeight);
|
||||
resize = true;
|
||||
} else {
|
||||
h = PApplet.min(PGraphicsOpenGL2.maxTextureSize, 512, maxTexHeight / 4);
|
||||
h = PApplet.min(PGraphicsOpenGL.maxTextureSize, 512, maxTexHeight / 4);
|
||||
resize = false;
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ class PFontTexture implements PConstants {
|
||||
int[] rgba = new int[w * h];
|
||||
int t = 0;
|
||||
int p = 0;
|
||||
if (PGraphicsOpenGL2.BIG_ENDIAN) {
|
||||
if (PGraphicsOpenGL.BIG_ENDIAN) {
|
||||
java.util.Arrays.fill(rgba, 0, w, 0xFFFFFF00); // Set the first row to blank pixels.
|
||||
t = w;
|
||||
for (int y = 0; y < glyph.height; y++) {
|
||||
|
||||
@@ -41,7 +41,7 @@ import processing.core.PConstants;
|
||||
*/
|
||||
public class PFramebuffer implements PConstants {
|
||||
protected PApplet parent;
|
||||
protected PGraphicsOpenGL2 ogl;
|
||||
protected PGraphicsOpenGL ogl;
|
||||
|
||||
public int glFboID;
|
||||
public int glDepthBufferID;
|
||||
@@ -76,7 +76,7 @@ public class PFramebuffer implements PConstants {
|
||||
|
||||
PFramebuffer(PApplet parent, int w, int h, boolean screen) {
|
||||
this.parent = parent;
|
||||
ogl = (PGraphicsOpenGL2)parent.g;
|
||||
ogl = (PGraphicsOpenGL)parent.g;
|
||||
|
||||
glFboID = 0;
|
||||
glDepthBufferID = 0;
|
||||
@@ -86,7 +86,7 @@ public class PFramebuffer implements PConstants {
|
||||
|
||||
screenFb = screen;
|
||||
noDepth = false;
|
||||
fboMode = PGraphicsOpenGL2.fboSupported;
|
||||
fboMode = PGraphicsOpenGL.fboSupported;
|
||||
numColorBuffers = 0;
|
||||
|
||||
multisample = false;
|
||||
@@ -189,7 +189,7 @@ public class PFramebuffer implements PConstants {
|
||||
colorBufferAttchPoints = new int[numColorBuffers];
|
||||
colorBufferAttchPoints[0] = GL.GL_COLOR_ATTACHMENT0;
|
||||
|
||||
glColorBufferMultisampleID = ogl.createGLResource(PGraphicsOpenGL2.GL_RENDER_BUFFER);
|
||||
glColorBufferMultisampleID = ogl.createGLResource(PGraphicsOpenGL.GL_RENDER_BUFFER);
|
||||
getGl().glBindRenderbuffer(GL.GL_RENDERBUFFER, glColorBufferMultisampleID);
|
||||
getGl2().glRenderbufferStorageMultisample(GL.GL_RENDERBUFFER, nsamples,
|
||||
GL.GL_RGBA8, width, height);
|
||||
@@ -211,7 +211,7 @@ public class PFramebuffer implements PConstants {
|
||||
ogl.pushFramebuffer();
|
||||
ogl.setFramebuffer(this);
|
||||
|
||||
glDepthStencilBufferID = ogl.createGLResource(PGraphicsOpenGL2.GL_RENDER_BUFFER);
|
||||
glDepthStencilBufferID = ogl.createGLResource(PGraphicsOpenGL.GL_RENDER_BUFFER);
|
||||
getGl().glBindRenderbuffer(GL.GL_RENDERBUFFER, glDepthStencilBufferID);
|
||||
|
||||
if (multisample) {
|
||||
@@ -240,7 +240,7 @@ public class PFramebuffer implements PConstants {
|
||||
ogl.pushFramebuffer();
|
||||
ogl.setFramebuffer(this);
|
||||
|
||||
glDepthBufferID = ogl.createGLResource(PGraphicsOpenGL2.GL_RENDER_BUFFER);
|
||||
glDepthBufferID = ogl.createGLResource(PGraphicsOpenGL.GL_RENDER_BUFFER);
|
||||
getGl().glBindRenderbuffer(GL.GL_RENDERBUFFER, glDepthBufferID);
|
||||
|
||||
int glConst = GL.GL_DEPTH_COMPONENT16;
|
||||
@@ -276,7 +276,7 @@ public class PFramebuffer implements PConstants {
|
||||
ogl.pushFramebuffer();
|
||||
ogl.setFramebuffer(this);
|
||||
|
||||
glStencilBufferID = ogl.createGLResource(PGraphicsOpenGL2.GL_RENDER_BUFFER);
|
||||
glStencilBufferID = ogl.createGLResource(PGraphicsOpenGL.GL_RENDER_BUFFER);
|
||||
getGl().glBindRenderbuffer(GL.GL_RENDERBUFFER, glStencilBufferID);
|
||||
|
||||
int glConst = GL.GL_STENCIL_INDEX1;
|
||||
@@ -301,7 +301,7 @@ public class PFramebuffer implements PConstants {
|
||||
|
||||
public void bind() {
|
||||
if (screenFb) {
|
||||
if (PGraphicsOpenGL2.fboSupported) {
|
||||
if (PGraphicsOpenGL.fboSupported) {
|
||||
getGl().glBindFramebuffer(GL.GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
} else if (fboMode) {
|
||||
@@ -412,7 +412,7 @@ public class PFramebuffer implements PConstants {
|
||||
if (screenFb) {
|
||||
glFboID = 0;
|
||||
} else if (fboMode) {
|
||||
glFboID = ogl.createGLResource(PGraphicsOpenGL2.GL_FRAME_BUFFER);
|
||||
glFboID = ogl.createGLResource(PGraphicsOpenGL.GL_FRAME_BUFFER);
|
||||
} else {
|
||||
glFboID = 0;
|
||||
}
|
||||
@@ -420,27 +420,27 @@ public class PFramebuffer implements PConstants {
|
||||
|
||||
protected void deleteFramebuffer() {
|
||||
if (glFboID != 0) {
|
||||
ogl.deleteGLResource(glFboID, PGraphicsOpenGL2.GL_FRAME_BUFFER);
|
||||
ogl.deleteGLResource(glFboID, PGraphicsOpenGL.GL_FRAME_BUFFER);
|
||||
glFboID = 0;
|
||||
}
|
||||
|
||||
if (glDepthBufferID != 0) {
|
||||
ogl.deleteGLResource(glDepthBufferID, PGraphicsOpenGL2.GL_RENDER_BUFFER);
|
||||
ogl.deleteGLResource(glDepthBufferID, PGraphicsOpenGL.GL_RENDER_BUFFER);
|
||||
glDepthBufferID = 0;
|
||||
}
|
||||
|
||||
if (glStencilBufferID != 0) {
|
||||
ogl.deleteGLResource(glStencilBufferID, PGraphicsOpenGL2.GL_RENDER_BUFFER);
|
||||
ogl.deleteGLResource(glStencilBufferID, PGraphicsOpenGL.GL_RENDER_BUFFER);
|
||||
glStencilBufferID = 0;
|
||||
}
|
||||
|
||||
if (glColorBufferMultisampleID != 0) {
|
||||
ogl.deleteGLResource(glColorBufferMultisampleID, PGraphicsOpenGL2.GL_RENDER_BUFFER);
|
||||
ogl.deleteGLResource(glColorBufferMultisampleID, PGraphicsOpenGL.GL_RENDER_BUFFER);
|
||||
glColorBufferMultisampleID = 0;
|
||||
}
|
||||
|
||||
if (glDepthStencilBufferID != 0) {
|
||||
ogl.deleteGLResource(glDepthStencilBufferID, PGraphicsOpenGL2.GL_RENDER_BUFFER);
|
||||
ogl.deleteGLResource(glDepthStencilBufferID, PGraphicsOpenGL.GL_RENDER_BUFFER);
|
||||
glDepthStencilBufferID = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ import processing.core.PApplet;
|
||||
* By Andres Colubri
|
||||
*
|
||||
*/
|
||||
public class PGraphicsOpenGL2 extends PGraphics {
|
||||
public class PGraphicsOpenGL extends PGraphics {
|
||||
// JOGL2 objects:
|
||||
|
||||
/**
|
||||
@@ -121,7 +121,7 @@ public class PGraphicsOpenGL2 extends PGraphics {
|
||||
protected GLContext context;
|
||||
|
||||
/** The PApplet renderer. For the primary surface, pgl == this. */
|
||||
protected PGraphicsOpenGL2 ogl;
|
||||
protected PGraphicsOpenGL ogl;
|
||||
|
||||
// ........................................................
|
||||
|
||||
@@ -562,7 +562,7 @@ public class PGraphicsOpenGL2 extends PGraphics {
|
||||
|
||||
// INIT/ALLOCATE/FINISH
|
||||
|
||||
public PGraphicsOpenGL2() {
|
||||
public PGraphicsOpenGL() {
|
||||
}
|
||||
|
||||
|
||||
@@ -6794,7 +6794,7 @@ public class PGraphicsOpenGL2 extends PGraphics {
|
||||
|
||||
protected void initOffscreen() {
|
||||
// Getting the context and capabilities from the main renderer.
|
||||
ogl = (PGraphicsOpenGL2)parent.g;
|
||||
ogl = (PGraphicsOpenGL)parent.g;
|
||||
|
||||
context = ogl.getContext();
|
||||
capabilities = ogl.getCapabilities();
|
||||
@@ -6823,7 +6823,7 @@ public class PGraphicsOpenGL2 extends PGraphics {
|
||||
|
||||
// We need the GL2GL3 profile to access the glRenderbufferStorageMultisample
|
||||
// function used in multisampled (antialiased) offscreen rendering.
|
||||
if (PGraphicsOpenGL2.fboMultisampleSupported && gl2x != null && (opengl2X || opengl4X)) {
|
||||
if (PGraphicsOpenGL.fboMultisampleSupported && gl2x != null && (opengl2X || opengl4X)) {
|
||||
int nsamples = 1;
|
||||
if (opengl2X) {
|
||||
nsamples = 2;
|
||||
@@ -49,7 +49,7 @@ import java.io.BufferedReader;
|
||||
*/
|
||||
public class PShape3D extends PShape {
|
||||
protected PApplet papplet;
|
||||
protected PGraphicsOpenGL2 ogl;
|
||||
protected PGraphicsOpenGL ogl;
|
||||
|
||||
// Element types handled by PShape3D (vertices, normals, color, texture coordinates).
|
||||
protected static final int VERTICES = 0;
|
||||
@@ -125,7 +125,7 @@ public class PShape3D extends PShape {
|
||||
protected int glMode;
|
||||
protected boolean pointSprites;
|
||||
protected PImage[] textures;
|
||||
protected float maxSpriteSize = PGraphicsOpenGL2.maxPointSize;
|
||||
protected float maxSpriteSize = PGraphicsOpenGL.maxPointSize;
|
||||
// Coefficients for point sprite distance attenuation function.
|
||||
// These default values correspond to the constant sprite size.
|
||||
protected float spriteDistAtt[] = { 1.0f, 0.0f, 0.0f };
|
||||
@@ -175,7 +175,7 @@ public class PShape3D extends PShape {
|
||||
public PShape3D(PApplet parent) {
|
||||
this();
|
||||
this.papplet = parent;
|
||||
ogl = (PGraphicsOpenGL2)parent.g;
|
||||
ogl = (PGraphicsOpenGL)parent.g;
|
||||
this.family = PShape.GROUP;
|
||||
this.name = "root";
|
||||
this.root = this;
|
||||
@@ -187,7 +187,7 @@ public class PShape3D extends PShape {
|
||||
|
||||
public PShape3D(PApplet parent, String filename, Parameters params) {
|
||||
this.papplet = parent;
|
||||
ogl = (PGraphicsOpenGL2)parent.g;
|
||||
ogl = (PGraphicsOpenGL)parent.g;
|
||||
|
||||
this.family = PShape.GROUP;
|
||||
this.name = "root";
|
||||
@@ -205,7 +205,7 @@ public class PShape3D extends PShape {
|
||||
|
||||
public PShape3D(PApplet parent, int size, Parameters params) {
|
||||
this.papplet = parent;
|
||||
ogl = (PGraphicsOpenGL2)parent.g;
|
||||
ogl = (PGraphicsOpenGL)parent.g;
|
||||
|
||||
this.family = PShape.GROUP;
|
||||
this.name = "root";
|
||||
@@ -405,7 +405,7 @@ public class PShape3D extends PShape {
|
||||
return;
|
||||
}
|
||||
|
||||
if (PGraphicsOpenGL2.maxTextureUnits <= unit) {
|
||||
if (PGraphicsOpenGL.maxTextureUnits <= unit) {
|
||||
PGraphics.showWarning("PShape3D: wrong texture unit");
|
||||
return;
|
||||
}
|
||||
@@ -711,8 +711,8 @@ public class PShape3D extends PShape {
|
||||
child.lastVertex = n1;
|
||||
child.setDrawModeImpl(mode);
|
||||
child.strokeWeight = weight;
|
||||
child.textures = new PImage[PGraphicsOpenGL2.MAX_TEXTURES];
|
||||
child.renderTextures = new PTexture[PGraphicsOpenGL2.MAX_TEXTURES];
|
||||
child.textures = new PImage[PGraphicsOpenGL.MAX_TEXTURES];
|
||||
child.renderTextures = new PTexture[PGraphicsOpenGL.MAX_TEXTURES];
|
||||
|
||||
java.util.Arrays.fill(child.textures, null);
|
||||
if (tex != null) {
|
||||
@@ -1180,7 +1180,7 @@ public class PShape3D extends PShape {
|
||||
|
||||
|
||||
protected void setTextureImpl(PImage tex, int unit) {
|
||||
if (unit < 0 || PGraphicsOpenGL2.maxTextureUnits <= unit) {
|
||||
if (unit < 0 || PGraphicsOpenGL.maxTextureUnits <= unit) {
|
||||
System.err.println("PShape3D: Wrong texture unit.");
|
||||
return;
|
||||
}
|
||||
@@ -1304,7 +1304,7 @@ public class PShape3D extends PShape {
|
||||
|
||||
|
||||
protected void setMaxSpriteSizeImpl(float s) {
|
||||
maxSpriteSize = PApplet.min(s, PGraphicsOpenGL2.maxPointSize);
|
||||
maxSpriteSize = PApplet.min(s, PGraphicsOpenGL.maxPointSize);
|
||||
}
|
||||
|
||||
|
||||
@@ -1883,9 +1883,9 @@ public class PShape3D extends PShape {
|
||||
public void initIndices(int n) {
|
||||
indexCount = n;
|
||||
|
||||
glIndexBufferID = ogl.createGLResource(PGraphicsOpenGL2.GL_VERTEX_BUFFER);
|
||||
glIndexBufferID = ogl.createGLResource(PGraphicsOpenGL.GL_VERTEX_BUFFER);
|
||||
getGl().glBindBuffer(GL.GL_ARRAY_BUFFER, glIndexBufferID);
|
||||
final int bufferSize = indexCount * PGraphicsOpenGL2.SIZEOF_INT;
|
||||
final int bufferSize = indexCount * PGraphicsOpenGL.SIZEOF_INT;
|
||||
getGl().glBufferData(GL.GL_ARRAY_BUFFER, bufferSize, null, GL.GL_STATIC_DRAW);
|
||||
getGl().glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
|
||||
|
||||
@@ -1967,7 +1967,7 @@ public class PShape3D extends PShape {
|
||||
if (ogl.gl2f == null) {
|
||||
throw new RuntimeException("PShape3D: OpenGL ES 1.1 required");
|
||||
}
|
||||
if (!PGraphicsOpenGL2.vboSupported) {
|
||||
if (!PGraphicsOpenGL.vboSupported) {
|
||||
throw new RuntimeException("PShape3D: Vertex Buffer Objects are not available");
|
||||
}
|
||||
|
||||
@@ -1984,7 +1984,7 @@ public class PShape3D extends PShape {
|
||||
if (ogl.gl2f == null) {
|
||||
throw new RuntimeException("PShape3D: OpenGL ES 1.1 required");
|
||||
}
|
||||
if (!PGraphicsOpenGL2.vboSupported) {
|
||||
if (!PGraphicsOpenGL.vboSupported) {
|
||||
throw new RuntimeException("PShape3D: Vertex Buffer Objects are not available");
|
||||
}
|
||||
|
||||
@@ -2045,9 +2045,9 @@ public class PShape3D extends PShape {
|
||||
protected void createVertexBuffer() {
|
||||
deleteVertexBuffer(); // Just in the case this object is being re-initialized.
|
||||
|
||||
glVertexBufferID = ogl.createGLResource(PGraphicsOpenGL2.GL_VERTEX_BUFFER);
|
||||
glVertexBufferID = ogl.createGLResource(PGraphicsOpenGL.GL_VERTEX_BUFFER);
|
||||
getGl().glBindBuffer(GL.GL_ARRAY_BUFFER, glVertexBufferID);
|
||||
final int bufferSize = vertexCount * 3 * PGraphicsOpenGL2.SIZEOF_FLOAT;
|
||||
final int bufferSize = vertexCount * 3 * PGraphicsOpenGL.SIZEOF_FLOAT;
|
||||
getGl().glBufferData(GL.GL_ARRAY_BUFFER, bufferSize, null, glUsage);
|
||||
getGl().glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
@@ -2064,9 +2064,9 @@ public class PShape3D extends PShape {
|
||||
protected void createColorBuffer() {
|
||||
deleteColorBuffer();
|
||||
|
||||
glColorBufferID = ogl.createGLResource(PGraphicsOpenGL2.GL_VERTEX_BUFFER);
|
||||
glColorBufferID = ogl.createGLResource(PGraphicsOpenGL.GL_VERTEX_BUFFER);
|
||||
getGl().glBindBuffer(GL.GL_ARRAY_BUFFER, glColorBufferID);
|
||||
final int bufferSize = vertexCount * 4 * PGraphicsOpenGL2.SIZEOF_FLOAT;
|
||||
final int bufferSize = vertexCount * 4 * PGraphicsOpenGL.SIZEOF_FLOAT;
|
||||
getGl().glBufferData(GL.GL_ARRAY_BUFFER, bufferSize, FloatBuffer.wrap(colors), glUsage);
|
||||
getGl().glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
@@ -2080,9 +2080,9 @@ public class PShape3D extends PShape {
|
||||
protected void createNormalBuffer() {
|
||||
deleteNormalBuffer();
|
||||
|
||||
glNormalBufferID = ogl.createGLResource(PGraphicsOpenGL2.GL_VERTEX_BUFFER);
|
||||
glNormalBufferID = ogl.createGLResource(PGraphicsOpenGL.GL_VERTEX_BUFFER);
|
||||
getGl().glBindBuffer(GL.GL_ARRAY_BUFFER, glNormalBufferID);
|
||||
final int bufferSize = vertexCount * 3 * PGraphicsOpenGL2.SIZEOF_FLOAT;
|
||||
final int bufferSize = vertexCount * 3 * PGraphicsOpenGL.SIZEOF_FLOAT;
|
||||
getGl().glBufferData(GL.GL_ARRAY_BUFFER, bufferSize, null, glUsage);
|
||||
getGl().glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
@@ -2092,21 +2092,21 @@ public class PShape3D extends PShape {
|
||||
allTexcoords = new float[1][vertexCount * 2];
|
||||
texcoords = allTexcoords[0];
|
||||
convTexcoords = new float[vertexCount * 2];
|
||||
texCoordSet = new boolean[PGraphicsOpenGL2.MAX_TEXTURES];
|
||||
texCoordSet = new boolean[PGraphicsOpenGL.MAX_TEXTURES];
|
||||
}
|
||||
|
||||
|
||||
protected void createTexCoordBuffer() {
|
||||
if (glTexCoordBufferID == null) {
|
||||
glTexCoordBufferID = new int[PGraphicsOpenGL2.MAX_TEXTURES];
|
||||
glTexCoordBufferID = new int[PGraphicsOpenGL.MAX_TEXTURES];
|
||||
java.util.Arrays.fill(glTexCoordBufferID, 0);
|
||||
} else {
|
||||
deleteTexCoordBuffer();
|
||||
}
|
||||
|
||||
glTexCoordBufferID[0] = ogl.createGLResource(PGraphicsOpenGL2.GL_VERTEX_BUFFER);
|
||||
glTexCoordBufferID[0] = ogl.createGLResource(PGraphicsOpenGL.GL_VERTEX_BUFFER);
|
||||
getGl().glBindBuffer(GL.GL_ARRAY_BUFFER, glTexCoordBufferID[0]);
|
||||
final int bufferSize = vertexCount * 2 * PGraphicsOpenGL2.SIZEOF_FLOAT;
|
||||
final int bufferSize = vertexCount * 2 * PGraphicsOpenGL.SIZEOF_FLOAT;
|
||||
getGl().glBufferData(GL.GL_ARRAY_BUFFER, bufferSize, null, glUsage);
|
||||
getGl().glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
@@ -2117,10 +2117,10 @@ public class PShape3D extends PShape {
|
||||
int t = numTexBuffers + i;
|
||||
deleteTexCoordBuffer(t);
|
||||
|
||||
glTexCoordBufferID[t] = ogl.createGLResource(PGraphicsOpenGL2.GL_VERTEX_BUFFER);
|
||||
glTexCoordBufferID[t] = ogl.createGLResource(PGraphicsOpenGL.GL_VERTEX_BUFFER);
|
||||
|
||||
getGl().glBindBuffer(GL.GL_ARRAY_BUFFER, glTexCoordBufferID[t]);
|
||||
final int bufferSize = vertexCount * 2 * PGraphicsOpenGL2.SIZEOF_FLOAT;
|
||||
final int bufferSize = vertexCount * 2 * PGraphicsOpenGL.SIZEOF_FLOAT;
|
||||
getGl().glBufferData(GL.GL_ARRAY_BUFFER, bufferSize, null, glUsage);
|
||||
getGl().glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
@@ -2155,7 +2155,7 @@ public class PShape3D extends PShape {
|
||||
|
||||
protected void deleteVertexBuffer() {
|
||||
if (glVertexBufferID != 0) {
|
||||
ogl.deleteGLResource(glVertexBufferID, PGraphicsOpenGL2.GL_VERTEX_BUFFER);
|
||||
ogl.deleteGLResource(glVertexBufferID, PGraphicsOpenGL.GL_VERTEX_BUFFER);
|
||||
glVertexBufferID = 0;
|
||||
}
|
||||
}
|
||||
@@ -2163,7 +2163,7 @@ public class PShape3D extends PShape {
|
||||
|
||||
protected void deleteColorBuffer() {
|
||||
if (glColorBufferID != 0) {
|
||||
ogl.deleteGLResource(glColorBufferID, PGraphicsOpenGL2.GL_VERTEX_BUFFER);
|
||||
ogl.deleteGLResource(glColorBufferID, PGraphicsOpenGL.GL_VERTEX_BUFFER);
|
||||
glColorBufferID = 0;
|
||||
}
|
||||
}
|
||||
@@ -2171,7 +2171,7 @@ public class PShape3D extends PShape {
|
||||
|
||||
protected void deleteNormalBuffer() {
|
||||
if (glNormalBufferID != 0) {
|
||||
ogl.deleteGLResource(glNormalBufferID, PGraphicsOpenGL2.GL_VERTEX_BUFFER);
|
||||
ogl.deleteGLResource(glNormalBufferID, PGraphicsOpenGL.GL_VERTEX_BUFFER);
|
||||
glNormalBufferID = 0;
|
||||
}
|
||||
}
|
||||
@@ -2179,7 +2179,7 @@ public class PShape3D extends PShape {
|
||||
|
||||
protected void deleteIndexBuffer() {
|
||||
if (glIndexBufferID != 0) {
|
||||
ogl.deleteGLResource(glIndexBufferID, PGraphicsOpenGL2.GL_VERTEX_BUFFER);
|
||||
ogl.deleteGLResource(glIndexBufferID, PGraphicsOpenGL.GL_VERTEX_BUFFER);
|
||||
glIndexBufferID = 0;
|
||||
}
|
||||
}
|
||||
@@ -2193,7 +2193,7 @@ public class PShape3D extends PShape {
|
||||
|
||||
protected void deleteTexCoordBuffer(int idx) {
|
||||
if (glTexCoordBufferID[idx] != 0) {
|
||||
ogl.deleteGLResource(glTexCoordBufferID[idx], PGraphicsOpenGL2.GL_VERTEX_BUFFER);
|
||||
ogl.deleteGLResource(glTexCoordBufferID[idx], PGraphicsOpenGL.GL_VERTEX_BUFFER);
|
||||
glTexCoordBufferID[idx] = 0;
|
||||
}
|
||||
}
|
||||
@@ -2358,10 +2358,10 @@ public class PShape3D extends PShape {
|
||||
// either the group's weight or the renderer's weight.
|
||||
if (0 < strokeWeight && style) {
|
||||
getGl().glLineWidth(strokeWeight);
|
||||
pointSize = PApplet.min(strokeWeight, PGraphicsOpenGL2.maxPointSize);
|
||||
pointSize = PApplet.min(strokeWeight, PGraphicsOpenGL.maxPointSize);
|
||||
} else {
|
||||
getGl().glLineWidth(g.strokeWeight);
|
||||
pointSize = PApplet.min(g.strokeWeight, PGraphicsOpenGL2.maxPointSize);
|
||||
pointSize = PApplet.min(g.strokeWeight, PGraphicsOpenGL.maxPointSize);
|
||||
}
|
||||
if (!pointSprites) {
|
||||
// Point sprites use their own size variable (set below).
|
||||
@@ -2462,7 +2462,7 @@ public class PShape3D extends PShape {
|
||||
// Here the vertex indices are understood as the range of indices.
|
||||
int last = lastIndex;
|
||||
int first = firstIndex;
|
||||
getGl().glDrawElements(glMode, last - first + 1, GL.GL_UNSIGNED_INT, first * PGraphicsOpenGL2.SIZEOF_INT);
|
||||
getGl().glDrawElements(glMode, last - first + 1, GL.GL_UNSIGNED_INT, first * PGraphicsOpenGL.SIZEOF_INT);
|
||||
getGl().glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
} else {
|
||||
getGl().glDrawArrays(glMode, firstVertex, lastVertex - firstVertex + 1);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class PTexture implements PConstants {
|
||||
public int width, height;
|
||||
|
||||
protected PApplet parent;
|
||||
protected PGraphicsOpenGL2 ogl;
|
||||
protected PGraphicsOpenGL ogl;
|
||||
|
||||
// These are public but use at your own risk!
|
||||
public int glID;
|
||||
@@ -93,7 +93,7 @@ public class PTexture implements PConstants {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
|
||||
ogl = (PGraphicsOpenGL2)parent.g;
|
||||
ogl = (PGraphicsOpenGL)parent.g;
|
||||
|
||||
glID = 0;
|
||||
|
||||
@@ -121,7 +121,7 @@ public class PTexture implements PConstants {
|
||||
public PTexture(PApplet parent, String filename, Object params) {
|
||||
this.parent = parent;
|
||||
|
||||
ogl = (PGraphicsOpenGL2)parent.g;
|
||||
ogl = (PGraphicsOpenGL)parent.g;
|
||||
|
||||
glID = 0;
|
||||
|
||||
@@ -265,7 +265,7 @@ public class PTexture implements PConstants {
|
||||
getGl().glBindTexture(glTarget, glID);
|
||||
|
||||
if (usingMipmaps) {
|
||||
if (PGraphicsOpenGL2.mipmapGeneration) {
|
||||
if (PGraphicsOpenGL.mipmapGeneration) {
|
||||
// Automatic mipmap generation.
|
||||
int[] rgbaPixels = new int[w * h];
|
||||
convertToRGBA(pixels, rgbaPixels, format, w, h);
|
||||
@@ -310,7 +310,7 @@ public class PTexture implements PConstants {
|
||||
tempFbo = new PFramebuffer(parent, glWidth, glHeight);
|
||||
}
|
||||
|
||||
if (PGraphicsOpenGL2.fboSupported) {
|
||||
if (PGraphicsOpenGL.fboSupported) {
|
||||
// Attaching the texture to the color buffer of a FBO, binding the FBO and reading the pixels
|
||||
// from the current draw buffer (which is the color buffer of the FBO).
|
||||
tempFbo.setColorBuffer(this);
|
||||
@@ -511,7 +511,7 @@ public class PTexture implements PConstants {
|
||||
* @param h int
|
||||
*/
|
||||
protected void convertToRGBA(int[] intArray, int[] tIntArray, int arrayFormat, int w, int h) {
|
||||
if (PGraphicsOpenGL2.BIG_ENDIAN) {
|
||||
if (PGraphicsOpenGL.BIG_ENDIAN) {
|
||||
switch (arrayFormat) {
|
||||
case ALPHA:
|
||||
|
||||
@@ -651,7 +651,7 @@ public class PTexture implements PConstants {
|
||||
protected void convertToARGB(int[] intArray, int[] tIntArray) {
|
||||
int t = 0;
|
||||
int p = 0;
|
||||
if (PGraphicsOpenGL2.BIG_ENDIAN) {
|
||||
if (PGraphicsOpenGL.BIG_ENDIAN) {
|
||||
|
||||
// RGBA to ARGB conversion: shifting RGB 8 bits to the right,
|
||||
// and placing A 24 bits to the left.
|
||||
@@ -695,7 +695,7 @@ public class PTexture implements PConstants {
|
||||
protected void createTexture(int w, int h) {
|
||||
deleteTexture(); // Just in the case this object is being re-initialized.
|
||||
|
||||
if (PGraphicsOpenGL2.npotTexSupported) {
|
||||
if (PGraphicsOpenGL.npotTexSupported) {
|
||||
glWidth = w;
|
||||
glHeight = h;
|
||||
} else {
|
||||
@@ -703,17 +703,17 @@ public class PTexture implements PConstants {
|
||||
glHeight = nextPowerOfTwo(h);
|
||||
}
|
||||
|
||||
if ((glWidth > PGraphicsOpenGL2.maxTextureSize) || (glHeight > PGraphicsOpenGL2.maxTextureSize)) {
|
||||
if ((glWidth > PGraphicsOpenGL.maxTextureSize) || (glHeight > PGraphicsOpenGL.maxTextureSize)) {
|
||||
glWidth = glHeight = 0;
|
||||
throw new RuntimeException("Image width and height cannot be" +
|
||||
" larger than " + PGraphicsOpenGL2.maxTextureSize +
|
||||
" larger than " + PGraphicsOpenGL.maxTextureSize +
|
||||
" with this graphics card.");
|
||||
}
|
||||
|
||||
usingMipmaps = glMinFilter == GL.GL_LINEAR_MIPMAP_LINEAR;
|
||||
|
||||
getGl().glEnable(glTarget);
|
||||
glID = ogl.createGLResource(PGraphicsOpenGL2.GL_TEXTURE_OBJECT);
|
||||
glID = ogl.createGLResource(PGraphicsOpenGL.GL_TEXTURE_OBJECT);
|
||||
getGl().glBindTexture(glTarget, glID);
|
||||
getGl().glTexParameteri(glTarget, GL.GL_TEXTURE_MIN_FILTER, glMinFilter);
|
||||
getGl().glTexParameteri(glTarget, GL.GL_TEXTURE_MAG_FILTER, glMagFilter);
|
||||
@@ -752,7 +752,7 @@ public class PTexture implements PConstants {
|
||||
*/
|
||||
protected void deleteTexture() {
|
||||
if (glID != 0) {
|
||||
ogl.deleteGLResource(glID, PGraphicsOpenGL2.GL_TEXTURE_OBJECT);
|
||||
ogl.deleteGLResource(glID, PGraphicsOpenGL.GL_TEXTURE_OBJECT);
|
||||
glID = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user