Class ImGuiImplGl3
java.lang.Object
de.luckymcdev.foundryengine.client.imgui.backend.ImGuiImplGl3
This class is a straightforward port of the
imgui_impl_opengl3.cpp.
It does support a backup and restoring of the GL state in the same way the original Dear ImGui code does. Some of the very specific OpenGL variables may be ignored here, yet you can copy-paste this class in your codebase and modify the rendering routine in the way you'd like.
This implementation has an ability to use a GLSL version provided during the initialization.
Please read the documentation for the init(String).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classData class to store implementation specific fields. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ImGuiImplGl3.Dataprotected static final booleanprotected static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckProgram(int handle, String desc) protected booleancheckShader(int handle, String desc) protected booleanbooleanvoidvoidprotected Stringprotected Stringprotected Stringprotected Stringbooleaninit()Method to do an initialization of theImGuiImplGl3state.booleanMethod to do an initialization of theImGuiImplGl3state.protected voidprotected ImGuiImplGl3.DatanewData()voidnewFrame()protected intparseGlslVersionString(String glslVersion) voidrenderDrawData(imgui.ImDrawData drawData) OpenGL3 Render function.protected voidsetupRenderState(imgui.ImDrawData drawData, int fbWidth, int fbHeight, int gVertexArrayObject) voidshutdown()protected voidprotected Stringprotected Stringprotected String
-
Field Details
-
OS
-
IS_APPLE
protected static final boolean IS_APPLE -
data
-
-
Constructor Details
-
ImGuiImplGl3
public ImGuiImplGl3()
-
-
Method Details
-
newData
-
init
public boolean init()Method to do an initialization of theImGuiImplGl3state. It SHOULD be called before calling of therenderDrawData(ImDrawData)method.Unlike in the
init(String)method, here the glslVersion argument is omitted. Thus, a "#version 130" string will be used instead.- Returns:
- true when initialized
-
init
Method to do an initialization of theImGuiImplGl3state. It SHOULD be called before calling of therenderDrawData(ImDrawData)method.Method takes an argument, which should be a valid GLSL string with the version to use.
---------------------------------------- OpenGL GLSL GLSL version version string --------------------------------------- 2.0 110 "#version 110" 2.1 120 "#version 120" 3.0 130 "#version 130" 3.1 140 "#version 140" 3.2 150 "#version 150" 3.3 330 "#version 330 core" 4.0 400 "#version 400 core" 4.1 410 "#version 410 core" 4.2 420 "#version 410 core" 4.3 430 "#version 430 core" ES 3.0 300 "#version 300 es" = WebGL 2.0 ---------------------------------------
If the argument is null, then a "#version 130" (150 for APPLE) string will be used by default.
- Parameters:
glslVersion- string with the version of the GLSL- Returns:
- true when initialized
-
shutdown
public void shutdown() -
newFrame
public void newFrame() -
setupRenderState
protected void setupRenderState(imgui.ImDrawData drawData, int fbWidth, int fbHeight, int gVertexArrayObject) -
renderDrawData
public void renderDrawData(imgui.ImDrawData drawData) OpenGL3 Render function. Note that this implementation is little overcomplicated because we are saving/setting up/restoring every OpenGL state explicitly. This is in order to be able to run within an OpenGL engine that doesn't do so.- Parameters:
drawData- draw data to render
-
createFontsTexture
public boolean createFontsTexture() -
destroyFontsTexture
public void destroyFontsTexture() -
checkShader
-
checkProgram
-
parseGlslVersionString
-
createDeviceObjects
protected boolean createDeviceObjects() -
destroyDeviceObjects
public void destroyDeviceObjects() -
initPlatformInterface
protected void initPlatformInterface() -
shutdownPlatformInterface
protected void shutdownPlatformInterface() -
vertexShaderGlsl120
-
vertexShaderGlsl130
-
vertexShaderGlsl410Core
-
fragmentShaderGlsl120
-
fragmentShaderGlsl130
-
fragmentShaderGlsl300es
-
fragmentShaderGlsl410Core
-