mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 07:46:12 +03:00
opengl: adding pixelStorei
This commit is contained in:
@ -42,7 +42,7 @@ pub fn init(alloc: std.mem.Allocator) !TextRenderer {
|
||||
_ = ftc.FT_Set_Pixel_Sizes(face, 0, 48);
|
||||
|
||||
// disable byte-alignment restriction
|
||||
gl.c.glPixelStorei(gl.c.GL_UNPACK_ALIGNMENT, 1);
|
||||
try gl.pixelStore(gl.c.GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
// Pre-render all the ASCII characters
|
||||
var chars = try CharList.initCapacity(alloc, 128);
|
||||
@ -160,7 +160,6 @@ pub fn render(
|
||||
try gl.Texture.active(gl.c.GL_TEXTURE0);
|
||||
try self.vao.bind();
|
||||
|
||||
std.log.info("---", .{});
|
||||
var curx: f32 = x;
|
||||
for (text) |c| {
|
||||
const char = self.chars.items[c];
|
||||
@ -170,14 +169,6 @@ pub fn render(
|
||||
const w = char.size[0] * scale;
|
||||
const h = char.size[1] * scale;
|
||||
|
||||
std.log.info("CHARACTER INFO ch={} xpos={} ypos={} w={} h={}", .{
|
||||
c,
|
||||
xpos,
|
||||
ypos,
|
||||
w,
|
||||
h,
|
||||
});
|
||||
|
||||
const vert = [6][4]f32{
|
||||
.{ xpos, ypos + h, 0.0, 0.0 },
|
||||
.{ xpos, ypos, 0.0, 1.0 },
|
||||
|
@ -17,3 +17,11 @@ pub fn drawArrays(mode: c.GLenum, first: c.GLint, count: c.GLsizei) !void {
|
||||
pub fn viewport(x: c.GLint, y: c.GLint, width: c.GLsizei, height: c.GLsizei) !void {
|
||||
c.glViewport(x, y, width, height);
|
||||
}
|
||||
|
||||
pub fn pixelStore(mode: c.GLenum, value: anytype) !void {
|
||||
switch (@typeInfo(@TypeOf(value))) {
|
||||
.ComptimeInt, .Int => c.glPixelStorei(mode, value),
|
||||
else => unreachable,
|
||||
}
|
||||
try errors.getError();
|
||||
}
|
||||
|
Reference in New Issue
Block a user