[DEBUG] set systelm work again

This commit is contained in:
Edouard DUPIN 2021-05-24 00:46:28 +02:00
parent c19cafa55e
commit ccd988640d
5 changed files with 22 additions and 20 deletions

View File

@ -171,7 +171,6 @@ public abstract class GaleContext {
}
public GaleApplication getApplication() {
this.lock.lock();
try {
return this.application;

View File

@ -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()) {

View File

@ -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");

View File

@ -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]);

View File

@ -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;
}