Work on the fontrenderer
This commit is contained in:
parent
9036a7391a
commit
e3a17373a9
@ -6,6 +6,7 @@ import java.util.function.BiConsumer;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.opengl.GL;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL45;
|
||||
import org.lwjgl.system.Configuration;
|
||||
import org.lwjgl.util.freetype.FreeType;
|
||||
|
||||
@ -73,7 +74,7 @@ public class NewInputTest {
|
||||
Joystick.INSTANCE.init(manager, bus);
|
||||
FileDrop.INSTANCE.init(bus);
|
||||
manager.addDevices(Mouse.INSTANCE, Keyboard.INSTANCE, Joystick.INSTANCE, FileDrop.INSTANCE);
|
||||
Window window = manager.builder().title("Testing Engine").antialis(1).build();
|
||||
Window window = manager.builder().title("Testing Engine").width(800).height(600).antialis(2).build();
|
||||
shaderTest.register();
|
||||
guiShader.register();
|
||||
assets.addListener(GLStateTracker.instance().shaders);
|
||||
@ -166,7 +167,8 @@ public class NewInputTest {
|
||||
model.unbindArray();
|
||||
guiModel[0].bindArray();
|
||||
guiShader.bind();
|
||||
GLStateTracker.instance().blend.setFunction(GLBlendFactor.SRC_COLOR, GLBlendFactor.ONE_MINUS_SRC_ALPHA, GLBlendFactor.ONE, GLBlendFactor.ZERO).enable();
|
||||
tracker.blend.enable();
|
||||
tracker.blend.setFunction(GLBlendFactor.SRC_ALPHA, GLBlendFactor.ONE_MINUS_SRC_ALPHA);
|
||||
for(GLDraw draw : draws) {
|
||||
tracker.textures.bind(draw.texture());
|
||||
GLStateTracker.drawArrays(GLMode.TRIANGLES.glValue(), draw.startVertex(), draw.vertexCount());
|
||||
|
@ -19,7 +19,7 @@ import speiger.src.coreengine.rendering.utils.values.textures.GLTextureValue;
|
||||
public class FontTexture extends BaseTexture {
|
||||
private static final TextureMetadata COLOR = TextureMetadata.builder()
|
||||
.externalFormat(GLTextureFormat.RGBA).internalFormat(GLTextureFormat.RGBAI).dataFormat(GLDataType.UNSIGNED_BYTE).mipmapping(false)
|
||||
.arguement(GLTextureParameter.MIN_FILTER, GLTextureValue.NEAREST).arguement(GLTextureParameter.MAG_FILTER, GLTextureValue.NEAREST)
|
||||
.arguement(GLTextureParameter.MIN_FILTER, GLTextureValue.LINEAR).arguement(GLTextureParameter.MAG_FILTER, GLTextureValue.LINEAR)
|
||||
.arguement(GLTextureParameter.WRAP_S, GLTextureValue.CLAMP_TO_EDGE).arguement(GLTextureParameter.WRAP_T, GLTextureValue.CLAMP_TO_EDGE).build();
|
||||
private static final TextureMetadata NO_COLOR = COLOR.copy().internalFormat(GLTextureFormat.LUMINANCE).externalFormat(GLTextureFormat.R).specialarguments(FontTexture::swizzle).build();
|
||||
|
||||
|
@ -244,8 +244,7 @@ public class FreeTypeProvider implements IFontProvider {
|
||||
if(index == 0) return null;
|
||||
oversample *= this.oversample;
|
||||
int pixels = Math.round(size * oversample);
|
||||
if(FreeTypeLibrary.parseError(FreeType.FT_Set_Pixel_Sizes(face, pixels, pixels), "Set Pixel Size")) return null;
|
||||
|
||||
if(FreeTypeLibrary.parseError(FreeType.FT_Set_Pixel_Sizes(face, 0, pixels), "Set Pixel Size")) return null;
|
||||
if(FreeTypeLibrary.parseError(FreeType.FT_Load_Glyph(face, index, FreeType.FT_LOAD_NO_BITMAP | FreeType.FT_LOAD_BITMAP_METRICS_ONLY), "Loading Glyth")) return null;
|
||||
FT_GlyphSlot slot = face.glyph();
|
||||
if(slot == null) {
|
||||
|
BIN
src/main/resources/assets/base/font/roboto/Roboto-Thin.ttf
Normal file
BIN
src/main/resources/assets/base/font/roboto/Roboto-Thin.ttf
Normal file
Binary file not shown.
@ -1,8 +1,8 @@
|
||||
{
|
||||
"type": "free-ttf",
|
||||
"regular": {
|
||||
"file": "font/roboto/Roboto-Medium.ttf",
|
||||
"oversample": 3,
|
||||
"file": "font/roboto/Roboto-Thin.ttf",
|
||||
"oversample": 1,
|
||||
"shadowOffset": 1,
|
||||
"skip": "",
|
||||
"offset": { "x": 0, "y": 0 }
|
||||
|
@ -10,8 +10,5 @@ uniform sampler2D texture;
|
||||
void main()
|
||||
{
|
||||
vec4 color = pass_color * texture2D(texture, pass_tex);
|
||||
if(color.a < 0.2) {
|
||||
discard;
|
||||
}
|
||||
frag_color = color;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user