Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/client/java/net/irisshaders/imgui/ImGuiMC.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ public void onKeyPress(long window, int keycode, int scancode, int action, int m
glWindow.keyCallback(window, keycode, scancode, action, mods);
}

public void recreateFonts() {
public void recreateFonts(boolean sharp) {
glAccessor.destroyFontsTexture();
glAccessor.createFontsTexture();
glAccessor.createFontsTexture(sharp);
}

public void onCharTyped(long window, int chara, int j) {
Expand Down
11 changes: 6 additions & 5 deletions src/client/java/net/irisshaders/imgui/window/ImGuiImplGl3.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import static org.lwjgl.opengl.GL32.GL_FUNC_ADD;
import static org.lwjgl.opengl.GL32.GL_INFO_LOG_LENGTH;
import static org.lwjgl.opengl.GL32.GL_LINEAR;
import static org.lwjgl.opengl.GL32.GL_NEAREST;
import static org.lwjgl.opengl.GL32.GL_LINK_STATUS;
import static org.lwjgl.opengl.GL32.GL_MAJOR_VERSION;
import static org.lwjgl.opengl.GL32.GL_MINOR_VERSION;
Expand Down Expand Up @@ -342,7 +343,7 @@ public void newFrame() {
}

if (data.fontTexture == 0) {
createFontsTexture();
createFontsTexture(false);
}
}

Expand Down Expand Up @@ -582,7 +583,7 @@ public void renderDrawData(final ImDrawData drawData) {
glScissor(props.lastScissorBox[0], props.lastScissorBox[1], props.lastScissorBox[2], props.lastScissorBox[3]);
}

public boolean createFontsTexture() {
public boolean createFontsTexture(boolean sharp) {
final ImFontAtlas fontAtlas = ImGui.getIO().getFonts();

// Build texture atlas
Expand All @@ -596,8 +597,8 @@ public boolean createFontsTexture() {
glGetIntegerv(GL_TEXTURE_BINDING_2D, lastTexture);
data.fontTexture = glGenTextures();
glBindTexture(GL_TEXTURE_2D, data.fontTexture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, sharp ? GL_NEAREST : GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, sharp ? GL_NEAREST : GL_LINEAR);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4); // Not on WebGL/ES
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); // Not on WebGL/ES
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); // Not on WebGL/ES
Expand Down Expand Up @@ -724,7 +725,7 @@ protected boolean createDeviceObjects() {
data.vboHandle = glGenBuffers();
data.elementsHandle = glGenBuffers();

createFontsTexture();
createFontsTexture(false);

// Restore modified GL state
glBindTexture(GL_TEXTURE_2D, lastTexture[0]);
Expand Down