mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2025-12-20 02:59:19 +01:00
Fix incorrect base format + swapped texture arg names
This commit is contained in:
parent
876043bf2f
commit
2aba4a7969
@ -10,7 +10,7 @@ import org.lwjgl.opengl.{ARBFramebufferObject, GL11, GL21, GL30}
|
|||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
|
|
||||||
class ScreenViewport(graphics: Graphics, private var _width: Int, private var _height: Int) extends Resource {
|
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()
|
private val framebuffer = ARBFramebufferObject.glGenFramebuffers()
|
||||||
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, framebuffer)
|
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, framebuffer)
|
||||||
GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, texture.texture, 0)
|
GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, texture.texture, 0)
|
||||||
|
|||||||
@ -42,10 +42,10 @@ class Texture extends Logging with Resource {
|
|||||||
GL11.GL_UNSIGNED_BYTE, buf)
|
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()
|
this()
|
||||||
bind()
|
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])
|
null.asInstanceOf[ByteBuffer])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import java.nio.channels.Channels
|
|||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
import javax.imageio.ImageIO
|
import javax.imageio.ImageIO
|
||||||
import javax.swing.JFileChooser
|
import javax.swing.JFileChooser
|
||||||
|
import scala.collection.Seq
|
||||||
import scala.collection.mutable
|
import scala.collection.mutable
|
||||||
import scala.collection.mutable.ArrayBuffer
|
import scala.collection.mutable.ArrayBuffer
|
||||||
import scala.concurrent.duration.DurationInt
|
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 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.
|
* @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 {
|
private object DispatchOrder {
|
||||||
/**
|
/**
|
||||||
* Creates a dispatch order for delivering events to multiple targets.
|
* Creates a dispatch order for delivering events to multiple targets.
|
||||||
* @param targets event targets, in hierarchy pre-order.
|
* @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]
|
val capture = mutable.Set.empty[Widget]
|
||||||
|
|
||||||
for (widget <- targets) {
|
for (widget <- targets) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user