Render: Set 1-byte texture alignment. Make blank_texture transparent.

This commit is contained in:
Alberto Torres 2025-01-21 20:13:24 +01:00
parent a56da31656
commit d903789389

View file

@ -125,6 +125,9 @@ proc initialize*(self: RenderManager) =
glEnable(GL_CULL_FACE)
glCullFace(GL_BACK)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
# For uploading byte-packed textures. TODO: Does WebGL 2 ignore this?
glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
glPixelStorei(GL_PACK_ALIGNMENT, 1)
self.bg_mesh = newMesh(self.engine, "_bg_mesh", common_attributes={vertex})
self.bg_mesh.load_from_va_ia(@[-1'f32, -1, -1, 3, -1, -1, -1, 3, -1])
self.bg_mesh.radius = Inf
@ -132,9 +135,9 @@ proc initialize*(self: RenderManager) =
self.no_material = self.engine.newSolidMaterial("_no_material", vec4(1,0,1,1));
self.camera_render_ubo = self.newUBO("CameraRenderUniform", CameraRenderUniform, 1)
# since this is a ref, it won't be destroyed until it's used
let zero = newArrRef[uint8](3)
let zero = newArrRef[uint8](4)
zero.fill 0
self.blank_texture = self.engine.newTexture("",1,1,1,RGB_u8,pixels=zero.to float32)
self.blank_texture = self.engine.newTexture("",1,1,1,RGBA_u8,pixels=zero.to float32)
self.initialized = true
for fun in self.queue:
try: