Search code examples
luacodea

Codea vertices draw full screen


So I've written a shader that I want to draw across the whole screen of my Codea app, although I have supplied 4 varying vec2's as the vertices table it only draws a triangle. Why is this happening?

Here's my code

board = mesh()
board.shader = shader("Documents:golBoard")

board.vertices = {vec2(0, 0),
    vec2(0, HEIGHT), 
    vec2(WIDTH, HEIGHT),
    vec2(WIDTH, 0)}

And here's what I get..

golBoard


Solution

  • You can also use:

    board:addRect( WIDTH/2, HEIGHT/2, WIDTH, HEIGHT )
    

    This adds the necessary triangles to the mesh to construct the rectangle.

    See the docs for more details