From ccd988640dfbf109146ca54838e8b7743c7bd06c Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 24 May 2021 00:46:28 +0200 Subject: [PATCH] [DEBUG] set systelm work again --- .../atriasoft/gale/context/GaleContext.java | 1 - .../gale/resource/ResourceManager.java | 5 ++-- .../gale/resource/ResourceProgram.java | 6 ++-- .../gale/resource/ResourceTexture.java | 2 +- .../resource/ResourceVirtualArrayObject.java | 28 ++++++++++--------- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/org/atriasoft/gale/context/GaleContext.java b/src/org/atriasoft/gale/context/GaleContext.java index 82a0585..bb9b1d9 100644 --- a/src/org/atriasoft/gale/context/GaleContext.java +++ b/src/org/atriasoft/gale/context/GaleContext.java @@ -171,7 +171,6 @@ public abstract class GaleContext { } public GaleApplication getApplication() { - this.lock.lock(); try { return this.application; diff --git a/src/org/atriasoft/gale/resource/ResourceManager.java b/src/org/atriasoft/gale/resource/ResourceManager.java index a3ff133..c689303 100644 --- a/src/org/atriasoft/gale/resource/ResourceManager.java +++ b/src/org/atriasoft/gale/resource/ResourceManager.java @@ -163,6 +163,7 @@ public class ResourceManager { Log.error("Request update after application EXIT ..."); return; } + Log.debug("Update context : " + this.resourceListToUpdate.size()); // TODO Check the number of call this ... Log.info("update open-gl context ... "); if (this.contextHasBeenRemoved) { // need to update all ... @@ -173,7 +174,7 @@ public class ResourceManager { synchronized (this.resourceList) { if (this.resourceList.size() != 0) { for (long jjj = 0; jjj < MAX_RESOURCE_LEVEL; jjj++) { - Log.verbose(" updateContext level (D) : " + jjj + "/" + (MAX_RESOURCE_LEVEL - 1)); + Log.warning(" updateContext level (D) : " + jjj + "/" + (MAX_RESOURCE_LEVEL - 1)); for (final Resource it : this.resourceList) { if (jjj == it.getResourceLevel()) { //Log.debug("Update context named : " + lresourceList[iii].getName()); @@ -196,7 +197,7 @@ public class ResourceManager { } if (resourceListToUpdate.size() != 0) { for (long jjj = 0; jjj < MAX_RESOURCE_LEVEL; jjj++) { - Log.verbose(" updateContext level (U) : " + jjj + "/" + (MAX_RESOURCE_LEVEL - 1)); + Log.warning(" updateContext level (U) : " + jjj + "/" + (MAX_RESOURCE_LEVEL - 1)); for (final Resource it : resourceListToUpdate) { if (jjj == it.getResourceLevel()) { if (!it.updateContext()) { diff --git a/src/org/atriasoft/gale/resource/ResourceProgram.java b/src/org/atriasoft/gale/resource/ResourceProgram.java index 531ac04..afe90ad 100644 --- a/src/org/atriasoft/gale/resource/ResourceProgram.java +++ b/src/org/atriasoft/gale/resource/ResourceProgram.java @@ -33,9 +33,9 @@ public class ResourceProgram extends Resource { final String name = uriVertexShader.getValue() + "<-->" + uriFragmentShader.getValue(); Resource resource2 = getManager().localKeep(name); if (resource2 != null) { - if (resource2 instanceof ResourceProgram) { + if (resource2 instanceof ResourceProgram ploppp) { resource2.keep(); - return (ResourceProgram) resource2; + return ploppp; } Log.critical("Request resource file : '" + name + "' With the wrong type (dynamic cast error)"); return null; @@ -846,7 +846,7 @@ public class ResourceProgram extends Resource { } OpenGL.programBindAttribute(this.program, ResourceVirtualArrayObject.INDICE_VBO_POSITIONS, "in_position"); - OpenGL.programBindAttribute(this.program, ResourceVirtualArrayObject.INDICE_VBO_TEXTURE_COORDINATES, "tin_extureCoords"); + OpenGL.programBindAttribute(this.program, ResourceVirtualArrayObject.INDICE_VBO_TEXTURE_COORDINATES, "in_extureCoords"); OpenGL.programBindAttribute(this.program, ResourceVirtualArrayObject.INDICE_VBO_NORMALS, "in_normal"); OpenGL.programBindAttribute(this.program, ResourceVirtualArrayObject.INDICE_VBO_COLORS, "in_colors"); diff --git a/src/org/atriasoft/gale/resource/ResourceTexture.java b/src/org/atriasoft/gale/resource/ResourceTexture.java index a0a6c59..55fe3e6 100644 --- a/src/org/atriasoft/gale/resource/ResourceTexture.java +++ b/src/org/atriasoft/gale/resource/ResourceTexture.java @@ -64,7 +64,7 @@ public class ResourceTexture extends Resource { } else { for (int yyy = 0; yyy < decodedData.getHeight(); yyy++) { for (int xxx = 0; xxx < decodedData.getWidth(); xxx++) { - img.setAFloat(xxx, yyy, 0xFF); + img.setAByte(xxx, yyy, (byte)0xFF); img.setRByte(xxx, yyy, elemData[(yyy * decodedData.getWidth() + xxx) * 3 + 0]); img.setGByte(xxx, yyy, elemData[(yyy * decodedData.getWidth() + xxx) * 3 + 1]); img.setBByte(xxx, yyy, elemData[(yyy * decodedData.getWidth() + xxx) * 3 + 2]); diff --git a/src/org/atriasoft/gale/resource/ResourceVirtualArrayObject.java b/src/org/atriasoft/gale/resource/ResourceVirtualArrayObject.java index 1526391..8932b89 100644 --- a/src/org/atriasoft/gale/resource/ResourceVirtualArrayObject.java +++ b/src/org/atriasoft/gale/resource/ResourceVirtualArrayObject.java @@ -182,7 +182,7 @@ public class ResourceVirtualArrayObject extends Resource { public void flush() { // request to the manager to be call at the next update ... getManager().update(this); - Log.verbose("Request flush of VBO: [" + getId() + "] '" + getName() + "'"); + Log.error("Request flush of VAO: [" + getId() + "] '" + getName() + "'"); } /** @@ -198,51 +198,53 @@ public class ResourceVirtualArrayObject extends Resource { } public void loadAgainToVAO() { - createVAO(); + GL30.glBindVertexArray(this.vaoID); + Log.error("push VAO: [" + getId() + "] '" + getName() + "'"); if (this.indices != null) { Log.verbose("Set indices"); bindIndicesBuffer(this.indices); } if (this.positions != null) { Log.verbose("Set positions"); - storeDataInAttributeList(0, 3, this.positions); + storeDataInAttributeList(INDICE_VBO_POSITIONS, 3, this.positions); } if (this.textureCoordinates != null) { Log.verbose("Set textureCoordinates"); - storeDataInAttributeList(1, 2, this.textureCoordinates); + storeDataInAttributeList(INDICE_VBO_TEXTURE_COORDINATES, 2, this.textureCoordinates); } if (this.normals != null) { Log.verbose("Set normals"); - storeDataInAttributeList(2, 3, this.normals); + storeDataInAttributeList(INDICE_VBO_NORMALS, 3, this.normals); } if (this.colors != null) { Log.verbose("Set colors"); - storeDataInAttributeList(3, 4, this.colors); + storeDataInAttributeList(INDICE_VBO_COLORS, 4, this.colors); } unbindVAO(); } public void loadToVAO() { - GL30.glBindVertexArray(this.vaoID); + createVAO(); + Log.error("push VAO: [" + getId() + "] '" + getName() + "'"); if (this.indices != null) { Log.verbose("Set indices"); bindIndicesBuffer(this.indices); } if (this.positions != null) { Log.verbose("Set positions"); - storeDataInAttributeList(0, 3, this.positions); + storeDataInAttributeList(INDICE_VBO_POSITIONS, 3, this.positions); } if (this.textureCoordinates != null) { Log.verbose("Set textureCoordinates"); - storeDataInAttributeList(1, 2, this.textureCoordinates); + storeDataInAttributeList(INDICE_VBO_TEXTURE_COORDINATES, 2, this.textureCoordinates); } if (this.normals != null) { Log.verbose("Set normals"); - storeDataInAttributeList(2, 3, this.normals); + storeDataInAttributeList(INDICE_VBO_NORMALS, 3, this.normals); } if (this.colors != null) { Log.verbose("Set colors"); - storeDataInAttributeList(3, 4, this.colors); + storeDataInAttributeList(INDICE_VBO_COLORS, 4, this.colors); } unbindVAO(); } @@ -389,7 +391,7 @@ public class ResourceVirtualArrayObject extends Resource { */ @Override public boolean updateContext() { - Log.verbose(" Start: [" + getId() + "] '" + getName() + "' (size=" + this.vertexCount + ") ********************************"); + Log.error(" Start: [" + getId() + "] '" + getName() + "' (size=" + this.vertexCount + ") ********************************"); if (!this.exist) { Log.error(" ==> ALLOCATE new handle"); // Allocate and assign a Vertex Array Object to our handle @@ -403,7 +405,7 @@ public class ResourceVirtualArrayObject extends Resource { } this.exist = true; - Log.verbose(" Stop: [" + getId() + "] '" + getName() + "'"); + Log.error(" Stop: [" + getId() + "] '" + getName() + "'"); return true; }