Logo

SM5 Lua question about textures

Enregistré Connexion Retour aux forums

Post #1 · Posté à 2019-07-21 07:08:29am il y a 4.6 années

Offline Engine_Machiner
Engine_Machiner Avatar Member
222 Messages
Colombia
Reg. 2014-01-16

"~The message~"
I'm trying to create a mirrored texture with an ActorFrameTexture (1 texture mirrored by each side). It's for the Kaleidoscope effect of the BGA project, I don't know much about the AFT (or even if this is the way AFT is supposed to work), but I would like to know if it is possible to create the texture and make a Sprite load the texture to scroll it.

I've tried using GetTexture() and SetTexture() but it gives me a white texture.

Here's the code:
https://pastebin.com/RMitWJZ7

Here's what happens when I try calling the string of the Texture in the last Def.Sprite:
https://imgur.com/QP2AzGb

The texture does loads in the AFT but after that I don't know why it isn't loading in the Sprite.
The code was based in the examples of the Docs.
http://66.media.tumblr.com/652d5cdeea85a39ee07a6cffb343f8a7/tumblr_mhsqmzte3S1s5307io1_100.gif https://images.duckduckgo.com/iu/?u=http%3A%2F%2Fmedia.riffsy.com%2Fimages%2F802c4321ccc6e92fb1caeddfaa52562f%2Fraw&f=1 https://images.duckduckgo.com/iu/?u=http%3A%2F%2Fauto.img.v4.skyrock.net%2F3682%2F77303682%2Fpics%2F2981513201_1_7_CclapQKR.gif&f=1

Post #2 · Posté à 2019-07-21 01:27:13pm il y a 4.6 années

Offline leadbman
leadbman Avatar Member
263 Messages
Australia
Reg. 2016-02-01

"Working On: 5thMix BGA bgchanges"
Have you tried putting the for loop after the def.sprite for Example 1? Maybe it needs to load the sprite first before the loop, otherwise, there's nothing for it to call for the first loop. Not sure if that's the answer though - it's possibly not but it may be worth a try. I'd have to check it out.


t[#t+1] = Def.Sprite{
Texture="Example 1",
OnCommand=function(self)
self:Center()
end
}

for i = 1,4 do
t_tex[#t_tex+1] = Def.Sprite{

etc, etc.

https://zenius-i-vanisher.com/ddrsig/18213.png?t=1510895050
Really need to add my scores to the tracker soon.
Always learning, always trying to push the boundaries of SM.

Post #3 · Posté à 2019-07-21 05:35:03pm il y a 4.6 années

Offline Engine_Machiner
Engine_Machiner Avatar Member
222 Messages
Colombia
Reg. 2014-01-16

"~The message~"

Last updated: 2019-07-21 09:54pm
Quote
Have you tried putting the for loop after the def.sprite for Example 1? Maybe it needs to load the sprite first before the loop, otherwise, there's nothing for it to call for the first loop. Not sure if that's the answer though - it's possibly not but it may be worth a try. I'd have to check it out.

https://imgur.com/2PSCngn
Ok, I have doubts about using InitCommand or OnCommand in the AFT, also I tried what you said and it gave me a white texture.
Maybe it is the same as the GetTexture() and SetTexture() thing I did getting the same white texture.

For reference, I'm trying to get the second example and scroll it
https://learnopengl.com/img/getting-started/texture_wrapping.png
http://66.media.tumblr.com/652d5cdeea85a39ee07a6cffb343f8a7/tumblr_mhsqmzte3S1s5307io1_100.gif https://images.duckduckgo.com/iu/?u=http%3A%2F%2Fmedia.riffsy.com%2Fimages%2F802c4321ccc6e92fb1caeddfaa52562f%2Fraw&f=1 https://images.duckduckgo.com/iu/?u=http%3A%2F%2Fauto.img.v4.skyrock.net%2F3682%2F77303682%2Fpics%2F2981513201_1_7_CclapQKR.gif&f=1

Post #4 · Posté à 2019-07-21 11:13:22pm il y a 4.6 années

Offline dbk2
dbk2 Avatar Member
332 Messages
Not Set
Reg. 2012-04-30


Last updated: 2019-07-21 11:17pm
ActorFrameTextures are not supported when SM5 is using d3d as the video renderer. The issue (the code was never written) manifests as a white texture. There was a GitHub issue that discussed this a while back, but the issue is unlikely to ever be fixed with the current engine.

If you want to use ActorFrameTextures, you (and your users) must be using opengl as the VideoRenderer. It seems unreasonable to expect all users of your work to be using opengl since d3d is the default renderer for Windows OS.

You could include some conditional checks in your BGA code like

Quote: "code"
if DISPLAY:SupportsRenderToTexture() then
-- use ActorFrameTexture
else
-- do something else
end

but then you'd have to write twice as much code. My general approach in theming is to not rely on AFTs because they will fail by default for most users, most users don't know where their Preferences.ini file is, and they really should not have to change it in the first place.

Perhaps if you explain what you are trying to accomplish, someone here can help you find a way to achieve that without using AFTs.

Post #5 · Posté à 2019-07-22 04:17:30am il y a 4.6 années

Offline Engine_Machiner
Engine_Machiner Avatar Member
222 Messages
Colombia
Reg. 2014-01-16

"~The message~"

Last updated: 2019-07-22 04:17am
Oh no, welp, guess AFTs are not an option then...

I want to use texcoordvelocity() and customtexturerect() with the song's BG, but I want the texture of the BG to be mirrored like you see here: (The second picture GL_MIRRORED_REPEAT)
Quote
https://learnopengl.com/img/getting-started/texture_wrapping.png

It's for the kaleidoscope effect I was working with, because if the song's BG isn't mirrored when scrolling it looks just like a bad cropped thing. (Like what you see in the first picture of above GL_REPEAT)
http://66.media.tumblr.com/652d5cdeea85a39ee07a6cffb343f8a7/tumblr_mhsqmzte3S1s5307io1_100.gif https://images.duckduckgo.com/iu/?u=http%3A%2F%2Fmedia.riffsy.com%2Fimages%2F802c4321ccc6e92fb1caeddfaa52562f%2Fraw&f=1 https://images.duckduckgo.com/iu/?u=http%3A%2F%2Fauto.img.v4.skyrock.net%2F3682%2F77303682%2Fpics%2F2981513201_1_7_CclapQKR.gif&f=1
Enregistré Connexion Retour aux forums

0 User(s) Viewing This Thread (Past 15 Minutes)

©2006-2024 Zenius -I- vanisher.com -5th style- IIPrivacy Policy
Web Server: 5% · Database: 8% · Server Time: 2024-03-29 07:53:21
Page générée en 0.004 secondes.
Theme: starlight · Language: french
Reset Theme & Language