Page 1 of 1

bug TextureOutput

Posted: Wed Aug 19, 2020 9:10 pm
by pf shadoko
TextureOutput is behaving strangely:

under directx
the following program crash

Code: Select all

InitEngine3D():InitSprite():InitKeyboard():InitMouse()
OpenWindow(0, 0, 0, 0,0, "",#PB_Window_Maximize)
OpenWindowedScreen(WindowID(0), 0, 0, 800,600, 0, 0, 0)
CreateTexture(0,256,256)
Debug TextureOutput(0)
;StopDrawing()
Debug TextureOutput(0)
but if I put "StopDrawing()"
after the first call to "TextureOutput,"
no crash


under opengl, even weirder:

Code: Select all

InitEngine3D():InitSprite():InitKeyboard():InitMouse()
OpenWindow(0, 0, 0, 0,0, "",#PB_Window_Maximize)
OpenWindowedScreen(WindowID(0), 0, 0, 800,600, 0, 0, 0)
CreateTexture(0,256,256*3)
StartDrawing(TextureOutput(0))
StopDrawing()
Debug TextureOutput(0)
here, the dimensions of the texture are not a power of 2
but if I put a power of 2( CreateTexture(0,256,256), no crashing


tested with PB 5.72(x64)

Re: bug TextureOutput

Posted: Thu Aug 20, 2020 9:59 am
by leonhardt
OutputID = TextureOutput(#Texture)

Returns the output ID or zero if drawing is not possible. This value should be passed directly to the StartDrawing() function to start the drawing operation. The return-value is valid only for one drawing operation and cannot be reused.

according to the doc

Code: Select all

InitEngine3D():InitSprite():InitKeyboard():InitMouse()
OpenWindow(0, 0, 0, 0,0, "",#PB_Window_Maximize)
OpenWindowedScreen(WindowID(0), 0, 0, 800,600, 0, 0, 0)
CreateTexture(0,256,256)
CreateTexture(1,256,256)
Debug TextureOutput(0)
;StopDrawing()
Debug TextureOutput(1)
above is ok
I think StopDrawing finished your first output drawing call ,so it won't crash after the second call.

Re: bug TextureOutput

Posted: Mon Sep 14, 2020 10:19 am
by Fred
The only way to use an Output() command is to put it in a StartDrawing() block, because int/cleanup of the output are done in StartDrawing()/StopDrawing(). Just using 'Debug TextureOutput()' is not supported.

Can you confirm the following code still crash for you ?

Code: Select all

InitEngine3D():InitSprite():InitKeyboard():InitMouse()
OpenWindow(0, 0, 0, 0,0, "",#PB_Window_Maximize)
OpenWindowedScreen(WindowID(0), 0, 0, 800,600, 0, 0, 0)
CreateTexture(0,256,256)
If StartDrawing(TextureOutput(0))
  StopDrawing()
EndIf

If StartDrawing(TextureOutput(0))
  StopDrawing()
EndIf

Re: bug TextureOutput

Posted: Mon Sep 14, 2020 6:40 pm
by pf shadoko
as I said above, with opengl, if the dimension of the texture is not a power of 2, the second startdrawing call causes a crash

Re: bug TextureOutput

Posted: Thu Sep 17, 2020 7:28 am
by Olli
Hello pf shadoko,

it is as normal as opengl tells us (open source) that this depends of the hardware.

Re: bug TextureOutput

Posted: Fri Sep 18, 2020 10:07 am
by pf shadoko
no it's certainly a bug
the first startdrawing works

Re: bug TextureOutput

Posted: Sat Sep 19, 2020 7:40 pm
by Olli
@pfshadoko

Please "quote" the code whom you are talking about. My previous message is for your remark about non-2^N texture size on OpenGL.

If it is the code of Fred which is crashing, it is a bug. In this way, adding the subsystem which is crashing will help to isolate the problem.