Lib Screen (Sprite) (PB 6.10)

Advanced game related topics
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Lib Screen (Sprite) (PB 6.10)

Post by Caronte3D »

Now works nice! :wink:
infratec
Always Here
Always Here
Posts: 7575
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Lib Screen (Sprite) (PB 6.10)

Post by infratec »

case 2 shows only a black screen with dark red text.

The rest is Ok.

PB 6.11b2 x86 on Win10 x64

Works with PB x64
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Lib Screen (Sprite) (PB 6.10)

Post by Caronte3D »

infratec wrote: Fri May 17, 2024 7:05 pm case 2 shows only a black screen with dark red text.
The same here, only x64 is ok on all examples.
AZJIO
Addict
Addict
Posts: 2141
Joined: Sun May 14, 2017 1:48 am

Re: Lib Screen (Sprite) (PB 6.10)

Post by AZJIO »

infratec wrote: Fri May 17, 2024 7:05 pm case 2 shows only a black screen with dark red text.
From the folder "PureBasic 6.10 x64\Examples\3D\Data\Textures" copy the file "waternormal.png" to the folder "PureBasic_x64\Examples\3D\Data\Textures"

All demos work for me (Win10x64, PB6.10)
I had two files marked yellow in the IDE as missing. I added it and everything worked.
infratec
Always Here
Always Here
Posts: 7575
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Lib Screen (Sprite) (PB 6.10)

Post by infratec »

All files are available in PB 6.11B2 x86 and x64.
That's not the problem.
AZJIO
Addict
Addict
Posts: 2141
Joined: Sun May 14, 2017 1:48 am

Re: Lib Screen (Sprite) (PB 6.10)

Post by AZJIO »

Yes you are right. I initially launched it on version 6.04 and there were 2 files missing. For the sake of compactness, I’m still using the previous version with the addition of compilers 6.10. In the second frame there is the sea, a view from above and clouds are flying. It works on 6.10 too.
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 385
Joined: Thu Jul 09, 2015 9:07 am

Re: Lib Screen (Sprite) (PB 6.10)

Post by pf shadoko »

well, it's progressing

I made the correction for x86
infratec
Always Here
Always Here
Posts: 7575
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Lib Screen (Sprite) (PB 6.10)

Post by infratec »

Confirmed :!:

Works now in x86 and x64 on WIn10 x64 with PB 6.11B2
AZJIO
Addict
Addict
Posts: 2141
Joined: Sun May 14, 2017 1:48 am

Re: Lib Screen (Sprite) (PB 6.10)

Post by AZJIO »

Runs on Linux Fedora, Mint.
On Linux MX_i386 does not start

On Linux, hint text is upside down. Text blue instead of red.
The ground texture in the first and last frames is blue, but should be brown. The water is different from what is in Windows, it is not as contrasting.

Warning for missing files

Code: Select all

CompilerIf #PB_Compiler_Version < 610
	Debug "Check the presence of the files sky.png, waternormal.png"
CompilerEndIf
Add path checking so Linux users can specify the correct file path for their OS

Code: Select all

CompilerElseIf #PB_Compiler_OS = #PB_OS_Linux
	CompilerIf #PB_Compiler_Debugger 
		If FileSize("/usr/lib/x86_64-linux-gnu/libGL.so")
			Debug "Please provide the correct path to the libGL.so library"
		EndIf
	CompilerEndIf
Compatible paths. In Windows, the case of letters in file names is not important, but in Linux it is important

Code: Select all

LoadImage(1,#PB_Compiler_Home+"examples" + #PS$ + "3d" + #PS$ + "Data" + #PS$ + "Textures" + #PS$ + "water.png")
LoadImage(2,#PB_Compiler_Home+"examples" + #PS$ + "3d" + #PS$ + "Data" + #PS$ + "Textures" + #PS$ + "smoke2.png")
LoadImage(3,#PB_Compiler_Home+"examples" + #PS$ + "3d" + #PS$ + "Data" + #PS$ + "Textures" + #PS$ + "flare.png")
LoadImage(4,#PB_Compiler_Home+"examples" + #PS$ + "3d" + #PS$ + "Data" + #PS$ + "Textures" + #PS$ + "sky.png")
LoadImage(5,#PB_Compiler_Home+"examples" + #PS$ + "3d" + #PS$ + "Data" + #PS$ + "Textures" + #PS$ + "nvidia" + #PS$ + "dirt_grayrocky_diffusespecular.jpg")
LoadImage(6,#PB_Compiler_Home+"examples" + #PS$ + "3d" + #PS$ + "Data" + #PS$ + "Textures" + #PS$ + "nvidia" + #PS$ + "dirt_grayrocky_normalheight.jpg")
LoadImage(7,#PB_Compiler_Home+"examples" + #PS$ + "3d" + #PS$ + "Data" + #PS$ + "Textures" + #PS$ + "waternormal.png")
benubi
Enthusiast
Enthusiast
Posts: 215
Joined: Tue Mar 29, 2005 4:01 pm

Re: Lib Screen (Sprite) (PB 6.10)

Post by benubi »

Wow, now it works for me. Very impressive indeed!!

I had to laugh, you have even put a shader editor in it - that's a genius idea. :D

I thought about having to make such a helper tool to learn shader programming; now I can save the time and efforts. I suppose you know that shadertoy website/app.

It would be nice if there was a shader tool that would also take into account PureBasic/Ogre interfaces so that we can make funny "shader toys" and have a productive tool for the 3D engine. "Shaders are the future" (since, a while crocodile... but I am sloooooow) :lol:
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Lib Screen (Sprite) (PB 6.10)

Post by Caronte3D »

benubi wrote: Sun May 19, 2024 1:30 pm It would be nice if there was a shader tool that would also take into account PureBasic/Ogre...
+1000
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 385
Joined: Thu Jul 09, 2015 9:07 am

Re: Lib Screen (Sprite) (PB 6.10)

Post by pf shadoko »

@AZJIO
I made some corrections for linux, can you tell me if it's ok?
can you give me the paths to “libGL.so” for your different linux versions, I'll test them all

@ benubi & Caronte3D
it's planned, but it will be a bit more complicated to use.
AZJIO
Addict
Addict
Posts: 2141
Joined: Sun May 14, 2017 1:48 am

Re: Lib Screen (Sprite) (PB 6.10)

Post by AZJIO »

I haven't tested it yet, but if you use IncludeBinary, it will allow you to compile a file that does not depend on external files

Code: Select all

DataSection
	img1:
	IncludeBinary #PB_Compiler_Home+"examples/3d/Data/Textures/water.png"
	img2:
	IncludeBinary #PB_Compiler_Home+"examples/3d/Data/Textures/smoke2.png"
	img3:
	IncludeBinary #PB_Compiler_Home+"examples/3d/Data/Textures/flare.png"
	img4:
	IncludeBinary #PB_Compiler_Home+"examples/3d/Data/Textures/sky.png"
	img5:
	IncludeBinary #PB_Compiler_Home+"examples/3d/Data/Textures/nvidia/dirt_grayrocky_diffusespecular.jpg"
	img6:
	IncludeBinary #PB_Compiler_Home+"examples/3d/Data/Textures/nvidia/dirt_grayrocky_normalheight.jpg"
	img7:
	IncludeBinary #PB_Compiler_Home+"examples/3d/Data/Textures/waternormal.png"
EndDataSection
CatchImage(1, ?img1)
CatchImage(2, ?img2)
CatchImage(3, ?img3)
CatchImage(4, ?img4)
CatchImage(5, ?img5)
CatchImage(6, ?img6)
CatchImage(7, ?img7)
I tried to translate the text into Russian, but it caused an error. Is it possible to support UTF8?

Code: Select all

  S_DrawText(8,0,"[F1] Редактировать шейдер")
  S_DrawText(8,60,"[Пробел] Следующий пример")
  S_DrawText(8,120,"[Esc] Выход")
  S_DrawText(8,180,"Используйте мышь",40)
User avatar
moulder61
Enthusiast
Enthusiast
Posts: 188
Joined: Sun Sep 19, 2021 6:16 pm
Location: U.K.

Re: Lib Screen (Sprite) (PB 6.10)

Post by moulder61 »

@pf shadoko

"I made some corrections for linux, can you tell me if it's ok?
can you give me the paths to “libGL.so” for your different linux versions, I'll test them all"

I'm using PB 6.04 but copied the missing images from 6.10/11.
As AZJIO said, the text is blue and upside down. You seem to have added a 4th texture too. :)

The paths to libGL.so on my Linux systems are:
Devuan - as you had originally /usr/lib/x86_64-linux-gnu/ - works OK
Void - /usr/lib/ and /usr/lib64/ - but only lib64 works
Arch - /usr/lib/ and /usr/lib64/ - very hit and miss, works in both sometimes, or not. It's a bit temperamental. Getting an error on line 722?

Moulder.
"If it ain't broke, fix it until it is!

This message is brought to you thanks to SenselessComments.com

My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 385
Joined: Thu Jul 09, 2015 9:07 am

Re: Lib Screen (Sprite) (PB 6.10)

Post by pf shadoko »

@ AZJIO
I know, but the aim is to propose the code on the forum so...

@ moulder61
strange
I made 2 changes:
- for the color problem:
line 144: If #PB_OS_Windows:rgb=#GL_BGR_EXT:rgba=#GL_BGRA_EXT:Else:rgb=#GL_RGB:rgba=#GL_RGBA:EndIf
try with if 0... and if 1...

- for y-coordinate inversion:
line 533: If #PB_OS_Windows:codevertex=ReplaceString(codevertex,"//invertv","vuv.y=1-vuv.y;"):EndIf
try with if 0... and if 1...
Post Reply