Thanks for the reply.
I'm aware of that, but it should still display something before the program exits right? I've tried the same code in a "while(true)" loop with the clear/draw/display steps, but it didnt help. I started from scratch, but now I get a "An internal OpenGL call failed in RenderTarget.cpp (355) : GL_INVALID_ENUM, an unacceptable value has been specified for an enumerated argument" error at rw.display(). At first I was getting the same error in Texture.cpp, but after updating the libjpeg.a file for arm64, that one went away.
EDIT: Never mind, still get the Texture.cpp error after calling rw.clear(sf::Color::Red). The error I get is
"An internal OpenGL call failed in Texture.cpp (556) : GL_INVALID_ENUM, an unacceptable value has been specified for an enumerated argument"
EDIT 2: Managed to fix the errors by adding this line #import <OpenGLES/ES2/gl.h>, still getting a black screen.
Edit 3: Got it working. Turns out you
HAVE to poll for events on iOS or at least that's what fixed it for me. Here's my code in case anyone needs it in the future.
#import <iostream>
#import <OpenGLES/ES2/gl.h>
#include <SFML/Main.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>
int main(int argc, char * argv[])
{
sf::RenderWindow rw(sf::VideoMode(700, 1334), "Hi", sf::Style::Fullscreen ,sf::ContextSettings(32));
bool running = true;
sf::RectangleShape rect;
rect.setSize(sf::Vector2f(50, 50));
rect.setPosition(sf::Vector2f(100, 100));
rect.setFillColor(sf::Color::Green);
while (running)
{
// handle events
sf::Event event;
while (rw.pollEvent(event))
{
if (event.type == sf::Event::Closed)
{
// end the program
running = false;
}
else if (event.type == sf::Event::Resized)
{
// adjust the viewport when the window is resized
glViewport(0, 0, event.size.width, event.size.height);
}
}
rw.clear(sf::Color::Red);
rw.draw(rect);
rw.display();
}
return 0;
}