class methods
Extends
This class extends others, you can call their methods on an instance of ofPlanePrimitive too:
The ofPlanePrimitive allows you to create an UV plane, which can be used for example as simple canvas for projecting simple texture .
Like all primitives it allows you to set the size, in this case height and width, draw it, set positions, etc, as a simple example:
ofPlanePrimitive plane;
void setup()
{
/// let's say we have a window set to be at
// resolution 640x480...
plane.set(640, 480); ///dimensions for width and height in pixels
plane.setPosition(320, 240, 0); /// position in x y z
plane.setResolution(2, 2); /// this resolution (as columns and rows) is enough
}
void draw()
{
plane.drawWireframe();
}
As you can see, plane is constructed from two triangles. To draw a texture over any primitive, simply bind the ofTexture instance and then draw your primitive:
texture.getTextureReference().bind();
// now draw filled...
plane.draw();
The plane primitive also allows you to simply pass an ofTexture to the plane and generate the texture coordinates from that texture so that the ofTexture fills the plane when it's drawn. This saves you the hassle of creating all the texture coordinates for each vertex, which is nice.
ofPlanePrimitive(...)
ofPlanePrimitive::ofPlanePrimitive(float width, float height, int columns, int rows, ofPrimitiveMode mode=OF_PRIMITIVE_TRIANGLE_STRIP)
set(...)
void ofPlanePrimitive::set(float width, float height, int columns, int rows, ofPrimitiveMode mode=OF_PRIMITIVE_TRIANGLE_STRIP)
Last updated 火曜日, 19 11月 2024 17:23:59 UTC - 2537ee49f6d46d5fe98e408849448314fd1f180e
If you have any doubt about the usage of this module you can ask in the forum.
If you want to contribute better documentation or start documenting this section you can do so here
If you find anything wrong with this docs you can report any error by opening an issue