mirror of
https://github.com/processing/processing4.git
synced 2026-06-08 16:40:46 +02:00
several opengl fixes (among them, major memory leak due to incorrectly initialized static var)
This commit is contained in:
@@ -207,7 +207,38 @@ public class Texture implements PConstants {
|
||||
public void init(int width, int height, Parameters params) {
|
||||
setParameters(params);
|
||||
setSize(width, height);
|
||||
allocate();
|
||||
//allocate();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the texture using GL parameters
|
||||
*/
|
||||
public void init(int width, int height,
|
||||
int glName, int glTarget, int glFormat,
|
||||
int glWidth, int glHeight,
|
||||
int glMinFilter, int glMagFilter,
|
||||
int glWrapS, int glWrapT) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
|
||||
this.glName = glName;
|
||||
this.glTarget = glTarget;
|
||||
this.glFormat = glFormat;
|
||||
this.glWidth = glWidth;
|
||||
this.glHeight = glHeight;
|
||||
this.glMinFilter = glMinFilter;
|
||||
this.glMagFilter = glMagFilter;
|
||||
this.glWrapS = glWrapS;
|
||||
this.glWrapT = glWrapT;
|
||||
|
||||
maxTexcoordU = (float)width / glWidth;
|
||||
maxTexcoordV = (float)height / glHeight;
|
||||
|
||||
usingMipmaps = glMinFilter == PGL.LINEAR_MIPMAP_NEAREST ||
|
||||
glMinFilter == PGL.LINEAR_MIPMAP_LINEAR;
|
||||
|
||||
usingRepeat = glWrapS == PGL.REPEAT || glWrapT == PGL.REPEAT;
|
||||
}
|
||||
|
||||
|
||||
@@ -239,31 +270,6 @@ public class Texture implements PConstants {
|
||||
return 0 < glName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the texture using GL parameters
|
||||
*/
|
||||
public void init(int glName, int glTarget, int glFormat, int glWidth, int glHeight,
|
||||
int glMinFilter, int glMagFilter, int glWrapS, int glWrapT) {
|
||||
this.glName = glName;
|
||||
this.glTarget = glTarget;
|
||||
this.glFormat = glFormat;
|
||||
this.glWidth = glWidth;
|
||||
this.glHeight = glHeight;
|
||||
this.glMinFilter = glMinFilter;
|
||||
this.glMagFilter = glMagFilter;
|
||||
this.glWrapS = glWrapS;
|
||||
this.glWrapT = glWrapT;
|
||||
|
||||
width = glWidth;
|
||||
height = glHeight;
|
||||
maxTexcoordU = 1;
|
||||
maxTexcoordV = 1;
|
||||
|
||||
usingMipmaps = glMinFilter == PGL.LINEAR_MIPMAP_NEAREST ||
|
||||
glMinFilter == PGL.LINEAR_MIPMAP_LINEAR;
|
||||
|
||||
usingRepeat = glWrapS == PGL.REPEAT || glWrapT == PGL.REPEAT;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Reference in New Issue
Block a user