LineXY needs 3D???
Posted: Mon Oct 27, 2025 12:59 am
Why is using LineXY() causing PB to crash out, telling me I need to use InitEngine3D()?? It's a 2D drawing command in the 2D drawing index.
http://www.purebasic.com
https://www.purebasic.fr/english/
Here's the code that caused the issue.
Code: Select all
Procedure Screen_Game()
DrawToGame()
DrawingMode(#PB_2DDrawing_Default)
Protected InFrame.a
Protected LensX.w, LensY.w
Protected DustIntense.w
Protected DustR.a, DustG.a, DustB.a
Protected TurClipX.a, TurClipY.a DustOpacity = 0.0
Select GameRezSize
Case 0 : Box(CornerX, CornerY, 1280, 720, RGB(0, 0, 0))
Case 1 : Box(CornerX, CornerY, 1920, 1080, RGB(0, 0, 0))
EndSelect
LineXY(NodeX(0), NodeY(0), NodeX(0), 720, RGB(160, 160, 160))
EndDrawing()Code: Select all
LineXY(Rope\NodeX(0), Rope\NodeY(0), Rope\NodeX(0), 720, RGB(160, 160, 160))We cannot reproduce that, as the code you posted to show the issue is not executable.Carm3D wrote: Mon Oct 27, 2025 11:25 pm For some reason the error reported was not that the variable doesn't exist, but 3D was required.
It's because NodeX() and NodeY() are 3D functions. https://www.purebasic.com/documentation/node/nodex.htmlCarm3D wrote: Mon Oct 27, 2025 11:25 pm For some reason the error reported was not that the variable doesn't exist, but 3D was required.
Ahhhhh! Brilliant.Samuel wrote: Tue Oct 28, 2025 1:49 amIt's because NodeX() and NodeY() are 3D functions. https://www.purebasic.com/documentation/node/nodex.html
The compiler was seeing the 3D functions within your LineXY call, which is why you where getting the InitEngine3D() error.