Re: A few more questions
Posted: Thu Nov 22, 2012 8:35 am
Now we have LuaJIT anyway.rude wrote:<rude> There once was an experimental module ... love.native, which allowed you to compile C code 'inside' Lua code.
Now we have LuaJIT anyway.rude wrote:<rude> There once was an experimental module ... love.native, which allowed you to compile C code 'inside' Lua code.
Would love.graphics.isSupported("npot", "subtractive") ever return false?Added automatic PO2 padding for systems not supporting the OpenGL extension.
...
Added support for the subtract BlendMode on older graphics cards.
Code: Select all
function love.load()
file = love.filesystem.newFile('test.txt')
file:open('r')
s, b = file:read()
print('#s '..#s)
print(b..' bytes')
print(s)
print()
s, b = file:read()
print('#s '..#s)
print(b..' bytes')
print(s)
print()
file:seek(0)
s, b = file:read()
print('#s '..#s)
print(b..' bytes')
print(s)
print()
file:seek(10)
s, b = file:read()
print('#s '..#s)
print(b..' bytes')
print(s)
end
What? No, it's just reading garbage past EOF. It's interpreted however your terminal interprets raw bytes. (So the standard encoding of your terminal.)Santos wrote:Second: Apparently still 20 characters, but interpreted as Unicode I guess.
love.graphics.setMode isn't perfect. checkMode should stay there just to cover all angles.Santos wrote:I'm struggling to think of a use case for love.graphics.checkMode. [...] And then if a user did enter a window size which wasn't supported, it could be caught by love.graphics.setMode returning nil. Is this still a good reason for it existing, or have I missed some other reason?
You're asking if one of the two can ever be unsupported and the answer is obviously yes. I think you wanted to ask something different, but I fail to recognize it. I'll just answer it with this: The actual deployed implementations do follow certain patterns; it is usually safe to assume that if some new extension is supported, the older stuff is supported too. However, The OpenGL extension system allows the implementations to support all kinds of configurations and it may prevent problems later if the application checks properly for them.Santos wrote:Would love.graphics.isSupported("npot", "subtractive") ever return false?
Canvases and Images both use OpenGL textures which are restricted to power-of-two widths before OpenGL 2.0 and the appropriate extension. I'm not sure if there actually is an implementation with framebuffers that doesn't do non-power-of-two textures, but I'm sure there's some weird configuration that would make it possible.Santos wrote:(I was wondering about non-power-of-two sized canvases, but it appears that "npot" only tests images.)
Agh, I thought LÖVE handles it this way, but it actually defaults to a hardcoded 64 sources. Odd, it should not do that...Santos wrote:Am I right in thinking that the maximum number of Sources that can play simultaneously is system dependent?
This is a bug. Someone didn't write File:read carefully enough. It allocates too much memory and doesn't shrink it if not all of it could be filled. Robin is right, it's returning garbage from your memory.Santos wrote:[filesystem related stuff...] Is this all expected? If so, why do these things happen?
Code: Select all
case Graphics::SUPPORT_NPOT:
if (!Image::hasNpot())
supported = false;
break;
Are there still graphics cards which won't support the subtractive blend mode even now?Added support for the subtract BlendMode on older graphics cards.
Images are only padded if non-power-of-two texture are unsupported. Padded images can show a different behaviour with texture filtering and wrapping.Santos wrote:Even if PO2 isn't supported, images are automatically padded, right? So what I meant to ask was, does npot ever need to be checked, assuming it will never be a problem?
That check also counts for Canvases. As I said, they both use OpenGL textures.Santos wrote:And I thought "ah, maybe it should still be checked to see if npot canvases will work!" But it seems like they aren't checked:
Err, a very old Intel chip. And the Windows software renderer of course.Santos wrote:Are there still graphics cards which won't support the subtractive blend mode even now?
I looked very quickly at the SDL code and it looks like it gets the mode list to check for a specific mode. So, no... I guess.Santos wrote:And about checkMode, I saw it once used to recheck what was returned getModes, was this necessary?
Code: Select all
function love.load()
decoder = love.sound.newDecoder('music.ogg')
source1 = love.audio.newSource(decoder, 'stream')
source2 = love.audio.newSource(decoder, 'stream')
source1:play()
end
function love.keypressed(key)
source2:play()
end
Code: Select all
source1 = love.audio.newSource(decoder, 'static')
source2 = love.audio.newSource(decoder, 'static')
Code: Select all
love.audio.newSource('music.ogg', 4096)
Code: Select all
source2 = love.audio.newSource(source1)
or
source2 = source1:copy()
Which is currently done by using the same SoundData?Santos wrote:Each copy would be played independently, but they would use the same encoded data in memory.Code: Select all
source2 = love.audio.newSource(source1) or source2 = source1:copy()
This API change would also be useful for caching static sounds as well. Maybe.