Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SFML/Graphics.hpp>
- #include <SFML/Window.hpp>
- #include <GL/gl.h>
- int main(int argc, char* argv[])
- {
- sf::RenderWindow window(sf::VideoMode(800, 600), sf::String("SFML noShapeGL"), sf::Style::Default, sf::ContextSettings(32,0,8,4,2));
- window.setFramerateLimit(60);
- sf::RectangleShape shape(sf::Vector2f(50, 50));
- shape.setPosition(100, 100);
- while(window.isOpen())
- {
- sf::Event event;
- while(window.pollEvent(event))
- {
- switch(event.type)
- {
- case sf::Event::Closed:
- window.close();
- break;
- }
- }
- window.setActive();
- window.clear(sf::Color(0, 0, 0));
- //////////////////////////////////////////////////////////////////////////
- // With the line below it's working fine, without it nothing is drawed. //
- //////////////////////////////////////////////////////////////////////////
- //window.draw(shape);
- // custom GL-Rendering
- glPushAttrib(GL_TRANSFORM_BIT);
- glLoadIdentity();
- glPushAttrib(GL_CURRENT_BIT | GL_LINE_BIT);
- glColor4f(1.0, 0, 0, 1.0);
- glLineWidth(5);
- glBegin(GL_LINES);
- {
- glVertex2d(10, 50);
- glVertex2d(50, 10);
- }
- glEnd();
- glPopAttrib();
- glPopAttrib();
- window.display();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement