Hello,
I want to draw rhombus with sf::VertexArray class
sf::VertexArray polygonImage2;
polygonImage2.clear();
polygonImage2.setPrimitiveType (sf::LinesStrip);
polygonImage2.resize (5);
float c = 1.0f;
polygonImage2[0] = {sf::Vector2f {62.5f * c, 55.0f * c}, sf::Color::Black};
polygonImage2[1] = {sf::Vector2f {70.0f * c, 62.5f * c}, sf::Color::Black};
polygonImage2[2] = {sf::Vector2f {62.5f * c, 70.0f * c}, sf::Color::Black};
polygonImage2[3] = {sf::Vector2f {55.0f * c, 62.5f * c}, sf::Color::Black};
polygonImage2[4] = {sf::Vector2f {62.5f * c, 55.0f * c}, sf::Color::Black};
theWindow.draw (polygonImage2);
but result shape is interrupted in the bottom. How can I solve this problem?
Thanks for an answers.
This is a small program, where nothing is excess.
#include <windows.h>
#include "SFML/Graphics/RenderWindow.hpp"
#include "SFML/Graphics/VertexArray.hpp"
int WINAPI WinMain (HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR LpCmdLine, int nCmdShow)
{
sf::RenderWindow myWindow;
myWindow.create (sf::VideoMode (1024, 768), "DM", sf::Style::Titlebar | sf::Style::Close);
while (myWindow.isOpen())
{
myWindow.clear(sf::Color::White);
sf::VertexArray polygonImage2;
polygonImage2.clear();
polygonImage2.setPrimitiveType (sf::LinesStrip);
polygonImage2.resize (5);
float c = 1.0f;
polygonImage2[0] = {sf::Vector2f {62.5f * c, 55.0f * c}, sf::Color::Black};
polygonImage2[1] = {sf::Vector2f {70.0f * c, 62.5f * c}, sf::Color::Black};
polygonImage2[2] = {sf::Vector2f {62.5f * c, 70.0f * c}, sf::Color::Black};
polygonImage2[3] = {sf::Vector2f {55.0f * c, 62.5f * c}, sf::Color::Black};
polygonImage2[4] = {sf::Vector2f {62.5f * c, 55.0f * c}, sf::Color::Black};
myWindow.draw (polygonImage2);
myWindow.display();
}
return 0;
}
And it still give me the same result with interrupt lines. I'm using 2.3.2 version of SFML. Is it problem with graphic driver? Is there any possible ways to resolve it?