Page 1 of 1

LineXY needs 3D???

Posted: Mon Oct 27, 2025 12:59 am
by Carm3D
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.

Re: LineXY needs 3D???

Posted: Mon Oct 27, 2025 4:06 am
by Carm3D
I guess it will remain a mystery. I managed to draw the lines I wanted with zoomed sprites and a bunch of fancy math to rotate them. Heck of a workaround.

Re: LineXY needs 3D???

Posted: Mon Oct 27, 2025 1:23 pm
by Fred
LineXY() doesn't need 3D, please post a code

Re: LineXY needs 3D???

Posted: Mon Oct 27, 2025 11:15 pm
by Carm3D
Fred wrote: Mon Oct 27, 2025 1:23 pm LineXY() doesn't need 3D, please post a code
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()

Re: LineXY needs 3D???

Posted: Mon Oct 27, 2025 11:25 pm
by Carm3D
I discovered what the problem was... I was not using the proper variable name. The NodeX was inside a structure, and when I changed it to this it worked:

Code: Select all

LineXY(Rope\NodeX(0), Rope\NodeY(0), Rope\NodeX(0), 720, RGB(160, 160, 160))
For some reason the error reported was not that the variable doesn't exist, but 3D was required.

Re: LineXY needs 3D???

Posted: Mon Oct 27, 2025 11:39 pm
by Little John
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.
We cannot reproduce that, as the code you posted to show the issue is not executable.
Perhaps using ‘EnableExplicit’ in your code would have helped.

Re: LineXY needs 3D???

Posted: Tue Oct 28, 2025 1:49 am
by Samuel
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.html
The compiler was seeing the 3D functions within your LineXY call, which is why you where getting the InitEngine3D() error.

Re: LineXY needs 3D???

Posted: Tue Oct 28, 2025 1:52 am
by Carm3D
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.
Ahhhhh! Brilliant. :)