You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With RapaNui, I'm not able to dynamically update a MOAIImageTexture object already bound to GPU memory from an input event handler. I display the texture with RNFactory.createImageFromMoaiImage () function, which accepts a MOAIImage object. MOAIImageTexture inherits from MOAIImage, so I expect that createImageFromMoaiImage () should work fine passed in a subclass of what it expects. This may be a bug somewhere, as MOAIImageTexture is something that has recently been added to MOAI. Thanks!
Code to reproduce:
require("rapanui-sdk/rapanui")
SCREEN_WIDTH = RNFactory.screen.width
SCREEN_HEIGHT = RNFactory.screen.height
print ( "hello" )
local background = RNFactory.createImage ( "images/background-blue.png" )
background:sendToBottom ()
print ( "displayed background" )
texture = MOAIImageTexture.new ()
texture:load ( "C:/dev/sdks/moai-sdk/samples/hello-moai/moai.png", MOAIImage.TRUECOLOR + MOAIImage.PREMULTIPLY_ALPHA )
print ( "loaded texture" )
-- demonstrate that we can modify the texture before rendering it
-- this draws a red line 50 pixels long diagonally from the top left
for i = 0,50 do
texture:setRGBA ( i, i, 1, 0, 0, 1 )
end
image = RNFactory.createImageFromMoaiImage ( texture )
image.x = SCREEN_WIDTH/2
image.y = SCREEN_HEIGHT/2
print ( "displayed image from texture" )
function onTouchEvent ( event )
if event.phase == "began" then
print ( "touch begin" )
-- this should draw a white line 128 pixels long diagonally from the top left
for i = 0,127 do
texture:setRGBA ( i, i, 1, 1, 1, 1 )
end
texture:invalidate ()
elseif event.phase == "ended" then
print ( "touch end" )
-- this should draw a blue line 128 pixels long diagonally from the top left
for i = 0,127 do
texture:setRGBA ( i, i, 0, 0, 1, 1 )
end
texture:invalidate ()
end
end
local listenerId = RNListeners:addEventListener("touch", onTouchEvent)
The text was updated successfully, but these errors were encountered:
With RapaNui, I'm not able to dynamically update a MOAIImageTexture object already bound to GPU memory from an input event handler. I display the texture with RNFactory.createImageFromMoaiImage () function, which accepts a MOAIImage object. MOAIImageTexture inherits from MOAIImage, so I expect that createImageFromMoaiImage () should work fine passed in a subclass of what it expects. This may be a bug somewhere, as MOAIImageTexture is something that has recently been added to MOAI. Thanks!
Code to reproduce:
The text was updated successfully, but these errors were encountered: