Add some additional logging to GLProxy around GLFW context creation
This commit is contained in:
@@ -27,6 +27,7 @@ import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.enums.EGLProxyContext;
|
||||
import com.seibel.distanthorizons.core.logging.ConfigBasedLogger;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.util.ReflectionUtil;
|
||||
import com.seibel.distanthorizons.core.util.objects.GLMessage;
|
||||
import com.seibel.distanthorizons.core.util.objects.GLMessageOutputStream;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
@@ -167,14 +168,13 @@ public class GLProxy
|
||||
GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_FORWARD_COMPAT, GLFW.GLFW_TRUE);
|
||||
GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_PROFILE, GLFW.GLFW_OPENGL_CORE_PROFILE);
|
||||
|
||||
LOGGER.info(this.minecraftGlCapabilities.toString());
|
||||
|
||||
// create the Lod Builder context
|
||||
this.lodBuilderGlContext = GLFW.glfwCreateWindow(64, 48, "LOD Builder Window", 0L, this.minecraftGlContext);
|
||||
if (this.lodBuilderGlContext == 0)
|
||||
{
|
||||
GL_LOGGER.error("ERROR: Failed to create GLFW context for OpenGL 3.2 with"
|
||||
+ " Forward Compat Core Profile! Your OS may have not been able to support it!");
|
||||
GL_LOGGER.error("ERROR: Failed to create LodBuilder GLFW context for OpenGL 3.2 with Forward compatible Core Profile! Your OS may have not been able to support it.");
|
||||
GL_LOGGER.error("Minecraft GL Capabilities:\n [\n"+ReflectionUtil.getAllFieldValuesAsString(this.minecraftGlCapabilities)+"\n]\n");
|
||||
|
||||
throw new UnsupportedOperationException("Forward Compat Core Profile 3.2 creation failure");
|
||||
}
|
||||
// create the window
|
||||
@@ -197,8 +197,9 @@ public class GLProxy
|
||||
this.proxyWorkerGlContext = GLFW.glfwCreateWindow(64, 48, "LOD proxy worker Window", 0L, this.minecraftGlContext);
|
||||
if (this.proxyWorkerGlContext == 0)
|
||||
{
|
||||
GL_LOGGER.error("ERROR: Failed to create GLFW context for OpenGL 3.2 with"
|
||||
+ " Forward Compat Core Profile! Your OS may have not been able to support it!");
|
||||
GL_LOGGER.error("ERROR: Failed to create GLProxy Worker GLFW context for OpenGL 3.2 with Forward compatible Core Profile! Your OS may have not been able to support it.");
|
||||
GL_LOGGER.error("Minecraft GL Capabilities:\n [\n"+ReflectionUtil.getAllFieldValuesAsString(this.minecraftGlCapabilities)+"\n]\n");
|
||||
|
||||
throw new UnsupportedOperationException("Forward Compat Core Profile 3.2 creation failure");
|
||||
}
|
||||
// create the window
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2023 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.distanthorizons.core.util;
|
||||
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.AbstractOptifineAccessor;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class ReflectionUtil
|
||||
{
|
||||
|
||||
public static String getAllFieldValuesAsString(Object obj)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
Field[] fields = obj.getClass().getDeclaredFields();
|
||||
for (Field field : fields)
|
||||
{
|
||||
String fieldName = field.getName();;
|
||||
String fieldStringValue;
|
||||
try
|
||||
{
|
||||
field.setAccessible(true);
|
||||
fieldStringValue = field.get(obj) + "";
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
fieldStringValue = "ERROR:[" + e.getMessage() + "]";
|
||||
}
|
||||
|
||||
stringBuilder.append(fieldName+" - "+fieldStringValue+"\n");
|
||||
}
|
||||
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user