groverburger / g3d

Simple and easy 3D engine for LÖVE.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to run some of the more complex g3d demos on iPad using love11.4-ios release

SugarRayLua opened this issue · comments

Hello. I am a novice mobile Lua programmer (iPad) and just starting using Love2D and am especially interested in its 3D capabilities. I liked how straightforward your g3d module looked to use and tried running some of your demos on my iPad Pro which I have installed the love11.4-ios release. The moon and earth demo works fine; however, I can't run the first person shooter demo nor the Hoarder's Horrible House demo as I get the following errors:

g3d
Example: First Person Test

Error

Error validating pixel shader code:
Line 18: ERROR: '-' : wrong operand types: no operation '-' exists that takes a left-hand operand of type ' const int' and a right operand of type ' temp mediump float' (or there is no acceptable conversion)
Line 18: ERROR: '' : missing #endif
Line 18: ERROR: '' : compilation terminated
ERROR: 3 compilation errors. No code generated.

Traceback

[love "callbacks.lua"]:228: in function 'handler'
[C]: in function 'newShader'
g3d/shader.lua:33: in main chunk
[C]: in function 'require'
g3d/model.lua:27: in main chunk
[C]: in function 'require'
g3d/init.lua:23: in main chunk
[C]: in function 'require'
main.lua:6: in main chunk
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function 'xpcall'

Separate example: Hoarder’s Horrible House of Stuff

Initial screen loads but then when tap to start the game get

Error

Error validating vertex shader code:
Line 7: ERROR: 'uniform' : cannot initialize this type of qualifier
ERROR: 1 compilation errors. No code generated.

Traceback

[love "callbacks.lua"]:228: in function 'handler'
[C]: in function 'newShader'
libs/g3d/camera.lua:26: in function 'initialize'
libs/middleclass.lua:140: in function 'new'
libs/g3d/sun.lua:5: in function 'initialize'
libs/middleclass.lua:140: in function 'new'
game.lua:238: in function 'createCamera'
game.lua:43: in function 'load'
main.lua:223: in function 'setgamestate'
menu.lua:56: in function 'update'
main.lua:84: in function 'update'
[love "callbacks.lua"]:162: in function <[love "callbacks.lua"]:144>
[C]: in function 'xpcall'

Yet, both of the above demos run fine when I run them on my desktop Mac with love-11.4 installed.

Any suggestions?

Thanks :-)

commented

Unfortunately, some platforms (such as iOS) are more picky about type coercion in shaders than other platforms. In the First Person Test project, it should be as simple as changing the 1-texcoord.y expression on line 28 of shader.lua to 1.0-texcoord.y, but it would most likely be a cleaner solution to update that project to the current version of g3d instead. I can't help with the issue in Hoarder's Horrible House of Stuff because I did not make that project.

I currently don't have plans to fix this platform specific issue myself, but if you want to contribute a PR that updates First Person Test to the latest version of g3d, I would appreciate it.

Thanks, @groverburger, for the reply and suggestions.

I tried the two suggestions you had to try and get the First Person Test to run on my iPad using love 11.4:

  1. first changed 1-texcoord.y to 1.0-texcoord.y in line 28 of shader.lua in g3d folder in First Person Test project.
    I didn't get anymore errors but I just got a black screen without anything else.

  2. I swapped out the g3d folder in the First Person Test with the newer g3d folder (latest release) from the moon/earth demo which did work but I got the same result (no more errors but just a black screen without anything else).

commented

I don't know what the issue would be, I don't think I can offer any more help here.

Okay, thank you.