application.SendNotification();
drawTrace.Enable( false );
- // geometry type is set as GL_POINTS
+ // geometry type is set as GL_TRIANGLE_STRIP
// no index buffer, call glDrawArrays,
DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION);
out.str("");
application.SendNotification();
drawTrace.Enable( false );
- // geometry type is set as GL_POINTS
+ // geometry type is set as GL_TRIANGLE_FAN
// no index buffer, call glDrawArrays,
DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION);
out.str("");
TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
/****************************************************/
- // Default (TRIANGLES), no index buffer
+ // Default (TRIANGLES), with index buffer
drawTrace.Reset();
drawTrace.Enable(true);
application.SendNotification();
DALI_TEST_EQUALS( geometry.GetGeometryType(), Geometry::TRIANGLES, TEST_LOCATION);
/*********************************************************/
- // LINES, no index buffer
+ // LINES, with index buffer
geometry.SetGeometryType( Geometry::LINES );
drawTrace.Reset();
application.SendNotification();
drawTrace.Enable( false );
- // geometry type is set as GL_POINTS
+ // geometry type is set as GL_TRIANGLE_STRIP
DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION);
out.str("");
out << GL_TRIANGLE_STRIP << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"indices";
application.SendNotification();
drawTrace.Enable( false );
- // geometry type is set as GL_POINTS
+ // geometry type is set as GL_TRIANGLE_FAN
DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION);
out.str("");
out << GL_TRIANGLE_FAN << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"indices";
END_TEST;
}
+int UtcDaliGeometryQUAD(void)
+{
+ TestApplication application;
+
+ tet_infoline("Test Geometry::QUAD()");
+
+ Geometry geometry = Geometry::QUAD();
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
+ Actor actor = Actor::New();
+ actor.SetSize(Vector3::ONE * 100.f);
+ actor.AddRenderer(renderer);
+ Stage::GetCurrent().Add(actor);
+
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+
+ drawTrace.Reset();
+ drawTrace.Enable(true);
+ application.SendNotification();
+ application.Render(0);
+ application.Render();
+ application.SendNotification();
+ drawTrace.Enable( false );
+
+ // geometry type is set as GL_TRIANGLE_STRIP, no index buffer
+ // no index buffer, call glDrawArrays,
+ DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION);
+ std::stringstream out;
+ int numVertex = 4;
+ out << GL_TRIANGLE_STRIP << ", " << 0 << ", " << numVertex;
+ DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
+
+ DALI_TEST_EQUALS( geometry.GetGeometryType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
+
+ END_TEST;
+}
+
return GetImplementation(*this).GetGeometryType();
}
+Geometry Geometry::QUAD()
+{
+ Dali::Property::Map quadVertexFormat;
+ quadVertexFormat["aPosition"] = Dali::Property::VECTOR2;
+ Dali::PropertyBuffer vertexData = Dali::PropertyBuffer::New( quadVertexFormat );
+
+ const float halfQuadSize = .5f;
+ struct QuadVertex { Dali::Vector2 position; };
+ QuadVertex quadVertexData[4] = {
+ { Dali::Vector2(-halfQuadSize, -halfQuadSize) },
+ { Dali::Vector2(-halfQuadSize, halfQuadSize) },
+ { Dali::Vector2( halfQuadSize, -halfQuadSize) },
+ { Dali::Vector2( halfQuadSize, halfQuadSize) } };
+ vertexData.SetData(quadVertexData, 4);
+
+ Dali::Geometry quad = Dali::Geometry::New();
+ quad.AddVertexBuffer( vertexData );
+ quad.SetGeometryType( Dali::Geometry::TRIANGLE_STRIP );
+ return quad;
+}
+
Geometry::Geometry( Internal::Geometry* pointer )
: BaseHandle( pointer )
{