How to implement "Texture" inside the "Circle" shape

Discussion about using Moai SDK - post questions, bugs and issues here.

Moderators: seebs, franciscotufro

How to implement "Texture" inside the "Circle" shape

Postby tingnapianhai » Wed Aug 08, 2012 2:41 am

Hi, I want to implement the "texture" inside the "circle" shape, anyone knows ?

Code: Select all
  1. local function onDraw()

  2.     MOAIGfxDevice.setPenColor(0, 0, 1, 1)

  3.     MOAIDraw.drawCircle( 100, 100,radius,32)

  4.     -- add "texture" code

  5. end



Any one knows how to implement it ? Thanks.
tingnapianhai
 
Posts: 7
Joined: Sun Jul 15, 2012 4:43 am

Re: How to implement "Texture" inside the "Circle" shape

Postby joarb » Wed Aug 08, 2012 3:05 am

Hi tingnapianhai! I think you would find the gl-vertexBuffer sample quite useful: https://github.com/moai/moai-dev/blob/m ... r/main.lua

Try adding vertices so that the final shape forms a circle. (The triangle fan is quite good for making shapes like circles, might be a good idea to google GL_TRIANGLE_FAN for background info.) For reference, the following thread might be useful: need-assistance-using-moaishader-setvertexattribute-t827/

HTH!
joarb
 
Posts: 125
Joined: Thu Jan 19, 2012 12:47 pm

Re: How to implement "Texture" inside the "Circle" shape

Postby tingnapianhai » Fri Aug 10, 2012 2:30 am

Hi, joarb, thank you very much!!! I'm checking it now, really useful, . Thanks,
tingnapianhai
 
Posts: 7
Joined: Sun Jul 15, 2012 4:43 am


Return to Moai SDK

Who is online

Users browsing this forum: No registered users and 1 guest

x