UPBGE: Screen Rotation Bug & Confusion regarding render.drawLine

Heya everyone,

I’ve recently begun using the UPBGE again, and almost immediately ran into two problems from the editor:

Problem # 1 )

Launching the game in fullscreen at 1920x1080, UPBGE rotates the camera 90° and alters the target resolution.

The target resolution becomes 1025x1280 :thinking:

If I invert the resolution to 1080x1920 then it does indeed output at the correct resolution, but the image is still rotated.

I’m running a dual monitor setup, the main is running at 3840x2160 in landscape mode, and the secondary at 1080x1920 in portrait mode. The Secondary monitor is to the left of the main monitor, and this is reflected in the windows display settings.

The image is outputted to the main monitor as expected, but the output is strange.

I thought I might get it to work by simply disabling the second monitor as a quick but annoying fix, but it had no effect. Thougths?

Problem # 2 )
I can’t for the life of me get the UPBGE render.drawLine function to work with alpha values.
The new drawLine function takes [r,g,b,a] as parameters for colour, but it just does nothing >__<

https://upbge.org/api/bge.render.html?highlight=drawline#bge.render.drawLine

Thanks for taking the time to read, buh-bye!

Hi,
bge.render.drawLine()'s alpha transparency seems to be working for me.

Example.

  • Top cube emits ray with alpha set to 0.25.
  • Bottom cube emits ray with alpha set to 1.0.

Blend-File.
RenderDrawLine_Alpha.blend (90.9 KB)

Thanks for the reply : D

I tested your file in 0.2.5 and it works, but it is broken in 0.3.0 Alpha - I wonder if it is being deprecated in favour of something new, or perhaps it simply broke due to changes in the source?

One question down, one left to go! : D

bge never handled multi monitor well, and the hammer until it fits mentality of 0.3.0 didnt do it any favors im sure.

I can confirm that the alpha value isn’t calculated into EEVEE code.
Also, the ray is still stuck in overlay viewing & not taking into account collision …

@lordloki_reloaded, @aWeirdOwl will hopefully be able to implement fixes from the legacy branch to current …

So drawline is currently a post processing step,

I think the most robust solution is actually placing a
Plane that is move to one side of an axis (x+?)
And scales so it’s length is exactly 1 bu,

You can place it at a point, align to a other point, and scale the distance between.

#args vec3, vec3, vec4, spawnOb
def drawLinePlane(p1, p2, color, ob):
    added = own.scene.addObject('Plane_Line', ob, 1)
    added.worldPosition = p1
    V2 = added.getVectTo(p2)
    added.alignAxisToVect(V2[1],0,1)
    added.localScale = [ V2[0], 1,1]
    added.color = color

if you have to draw 100s of lines moving the faces of a single mesh may be faster to draw

also a compiled function could be used to break the whole iterating 100s of times in py too

Damn, that’s actually a pretty decent solution to the problem, that would also allow transparency, albeit with some artifacts.

I’ll try to use it.