[of-dev] setting ofPrimitiveMode

Kyle McDonald kyle at kylemcdonald.net
Mon Apr 25 15:16:18 PDT 2011


aha, i missed that mode in ofPrimitiveMode.

i think i understand what you wrote now. ofMesh draws things. but you
need ofPath to prepare a tessellated ofMesh if you want something
filled in.

i was thinking it would be great to have ofBeginShape/endShape to act
like it does in Processing -- but it doesn't really make any sense
right now, because there are situations where there is no obvious
interpretation. for example, if you were drawing OF_TRIANGLE_FAN_MODE,
and then you said ofBezierVertex... that just doesn't make any sense.

so if we want to encourage people to do cross-renderer drawing, we
should tell them write:

ofMesh mesh;
mesh.setMode(OF_TRIANGLE_FAN_MODE);
mesh.addColor(...);
mesh.addVertex(...);
...
mesh.addVertex(...);
mesh.drawFaces();

whereas processing would be:

noStroke();
fill(...);
beginShape(TRIANGLE_FAN);
vertex(...);
...
vertex(...);
endShape();

kyle

On Mon, Apr 25, 2011 at 6:02 PM, arturo castro <arturo at openframeworks.cc> wrote:
> El lun, 25-04-2011 a las 17:58 -0400, Kyle McDonald escribió:
>> thanks, that explains a bunch.
>>
>> looking through it some more, i'm surprised to see that ofPath
>> supports both fill and outline like we were discussing near the end of
>> of-devcon... so it would be really, really easy to support
>> processing-style drawing (with fillColor vs strokeColor). it would be
>> like 6 lines of code.
>>
>> anyway, that's another topic. the main question originally was: 'what
>> drawing modes does ofBeginShape/endShape support?'
>>
>> and the answer is: 3 modes, the same as before. filled, no fill
>> closed, no fill open. but ofPath supports some more things via ofMesh.
>> they're not really meant to be accessed directly.
>>
>> so, if i want to do another style of drawing, like GL_LINES, i should
>> just use opengl.
>
> or an ofMesh
>
>>
>> kyle
>>
>> On Sat, Apr 23, 2011 at 10:45 AM, arturo castro
>> <arturo at openframeworks.cc> wrote:
>> > you can use it with ofMesh where you also have texcoords, normals...
>> >
>> > ofBegin/EndShape are the same as before,
>> >
>> > and ofPath allows to describe a path as primitives (bezier, arc...)
>> > decompose them to polylines, tessellate them and cache the tessellation
>> > into an ofMesh.
>> >
>> > El vie, 22-04-2011 a las 20:19 -0400, Kyle McDonald escribió:
>> >> so i've discovered ofPrimitiveMode, which seems to be for setting the
>> >> shape style, but i haven't found the function that lets you set what
>> >> ofPrimitiveMode is being used during ofBeginShape()/endShape().
>> >>
>> >> is there a function for this?
>> >>
>> >> will it be an argument to ofBeginShape() eventually?
>> >>
>> >> i was looking at using ofBeginShape()/endShape() as an alternative to
>> >> glBegin()/end() but it looks like it doesn't really wrap anything
>> >> besides tessellated polygons still.
>> >>
>> >> kyle
>> >> _______________________________________________
>> >> of-dev mailing list
>> >> of-dev at dev.openframeworks.cc
>> >> http://dev.openframeworks.cc/listinfo.cgi/of-dev-openframeworks.cc
>> >
>> >
>> > _______________________________________________
>> > of-dev mailing list
>> > of-dev at dev.openframeworks.cc
>> > http://dev.openframeworks.cc/listinfo.cgi/of-dev-openframeworks.cc
>> >
>> _______________________________________________
>> of-dev mailing list
>> of-dev at dev.openframeworks.cc
>> http://dev.openframeworks.cc/listinfo.cgi/of-dev-openframeworks.cc
>
>
> _______________________________________________
> of-dev mailing list
> of-dev at dev.openframeworks.cc
> http://dev.openframeworks.cc/listinfo.cgi/of-dev-openframeworks.cc
>



More information about the of-dev mailing list