From 2aba4a796996228a9da6b716a1db5a9014080524 Mon Sep 17 00:00:00 2001 From: UnicornFreedom Date: Sat, 13 Sep 2025 05:48:01 +0200 Subject: [PATCH] Fix incorrect base format + swapped texture arg names --- src/main/scala/ocelot/desktop/graphics/ScreenViewport.scala | 2 +- src/main/scala/ocelot/desktop/graphics/Texture.scala | 4 ++-- src/main/scala/ocelot/desktop/ui/UiHandler.scala | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/scala/ocelot/desktop/graphics/ScreenViewport.scala b/src/main/scala/ocelot/desktop/graphics/ScreenViewport.scala index a154aa9..be7ea1d 100644 --- a/src/main/scala/ocelot/desktop/graphics/ScreenViewport.scala +++ b/src/main/scala/ocelot/desktop/graphics/ScreenViewport.scala @@ -10,7 +10,7 @@ import org.lwjgl.opengl.{ARBFramebufferObject, GL11, GL21, GL30} import java.nio.ByteBuffer class ScreenViewport(graphics: Graphics, private var _width: Int, private var _height: Int) extends Resource { - private[graphics] var texture = new Texture(_width, _height, GL21.GL_SRGB8, GL11.GL_UNSIGNED_BYTE, 0) + private[graphics] var texture = new Texture(_width, _height, GL21.GL_SRGB8, GL11.GL_UNSIGNED_BYTE, GL11.GL_RGB) private val framebuffer = ARBFramebufferObject.glGenFramebuffers() GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, framebuffer) GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, texture.texture, 0) diff --git a/src/main/scala/ocelot/desktop/graphics/Texture.scala b/src/main/scala/ocelot/desktop/graphics/Texture.scala index 3fbcfc7..f6ecea8 100644 --- a/src/main/scala/ocelot/desktop/graphics/Texture.scala +++ b/src/main/scala/ocelot/desktop/graphics/Texture.scala @@ -42,10 +42,10 @@ class Texture extends Logging with Resource { GL11.GL_UNSIGNED_BYTE, buf) } - def this(width: Int, height: Int, format: Int, dataType: Int, internalFormat: Int) = { + def this(width: Int, height: Int, internalFormat: Int, dataType: Int, format: Int) = { this() bind() - GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, format, width, height, 0, internalFormat, dataType, + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, dataType, null.asInstanceOf[ByteBuffer]) } diff --git a/src/main/scala/ocelot/desktop/ui/UiHandler.scala b/src/main/scala/ocelot/desktop/ui/UiHandler.scala index 37e4a80..3f80984 100644 --- a/src/main/scala/ocelot/desktop/ui/UiHandler.scala +++ b/src/main/scala/ocelot/desktop/ui/UiHandler.scala @@ -23,6 +23,7 @@ import java.nio.channels.Channels import java.nio.file.Paths import javax.imageio.ImageIO import javax.swing.JFileChooser +import scala.collection.Seq import scala.collection.mutable import scala.collection.mutable.ArrayBuffer import scala.concurrent.duration.DurationInt @@ -555,14 +556,14 @@ object UiHandler extends Logging { * @param capture widgets to deliver events during capture phase, in hierarchy pre-order. * @param targets widgets to deliver events during target phase, in hierarchy pre-order. */ - private case class DispatchOrder(capture: collection.Seq[Widget], targets: collection.Seq[Widget]) + private case class DispatchOrder(capture: Seq[Widget], targets: Seq[Widget]) private object DispatchOrder { /** * Creates a dispatch order for delivering events to multiple targets. * @param targets event targets, in hierarchy pre-order. */ - def resolve(targets: collection.Seq[Widget]): DispatchOrder = { + def resolve(targets: Seq[Widget]): DispatchOrder = { val capture = mutable.Set.empty[Widget] for (widget <- targets) {