summaryrefslogtreecommitdiff
path: root/demo
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2020-12-17 23:27:39 -0600
committersanine-a <sanine.not@pm.me>2020-12-17 23:27:39 -0600
commitac16a4e0ae9fcc272cf5f8a9c1350f27817df7d0 (patch)
tree5fdb84f9d92032e9b0a85469b1ab8c9b7a31954f /demo
parent505b497cb1afed4a2b3c78292adaeca59fac12c3 (diff)
fix segfault when destroying cairo textures
Diffstat (limited to 'demo')
-rw-r--r--demo/main.lua16
1 files changed, 15 insertions, 1 deletions
diff --git a/demo/main.lua b/demo/main.lua
index 75b9966..eb05beb 100644
--- a/demo/main.lua
+++ b/demo/main.lua
@@ -19,9 +19,22 @@ end)
local tex = honey.texture.load('lowres.png',
{minFilter='nearest', magFilter='nearest'})
+local cairo = honey.cairo()
+cairo:setColor(1, 1, 1)
+cairo:moveTo(1024,0)
+cairo:lineTo(0,1024)
+cairo:stroke()
+
+cairo:setColor(1, 0, 1, 0.2)
+cairo:moveTo(0,0)
+cairo:lineTo(1024,1024)
+cairo:stroke()
+
+cairo:updateTexture()
+
local sceneRoot = Node.new()
-local shader = SpatialShader.new(tex)
+local shader = SpatialShader.new(cairo:getTexture())
local lightDirection = honey.glm.vec3{1,1,1}
lightDirection:normalize()
shader:setVec3('directional_lights[0].direction', lightDirection)
@@ -70,6 +83,7 @@ function honey.update(dt)
sceneRoot:updateCascade(dt)
if total_time > 1 then
print('FPS: '..tostring(total_frames/total_time))
+ print(cairo)
total_time = 0
total_frames = 0
end