several opengl fixes (among them, major memory leak due to incorrectly initialized static var)

This commit is contained in:
codeanticode
2012-12-14 22:49:25 +00:00
parent 188e0a8019
commit b548787f73
3 changed files with 392 additions and 245 deletions
+32 -26
View File
@@ -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;
}
////////////////////////////////////////////////////////////