Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - dragondgold

Pages: [1]
1
Graphics / ViewPort not working correctly?
« on: May 11, 2013, 07:04:05 pm »
Hello, I am trying to display a full screen image using Views. This is my code:

       sf::RenderWindow mWindow(sf::VideoMode(800,600), "Prueba Animaciones");

        // Cargo la imagen y muestro un pedazo
        sf::Texture mBGTexture;
        sf::Sprite mBGSprite;
        if(!mBGTexture.loadFromFile("bg_big.png")) return EXIT_FAILURE;
        mBGSprite.setTexture(mBGTexture);

        imageWidth = mBGTexture.getSize().x;
        imageHeight = mBGTexture.getSize().y;

        sf::CircleShape mBall;
        mBall.setRadius(10.0);
        mBall.setFillColor(sf::Color::White);

        sf::View miniMap;
        miniMap.setSize(imageWidth, imageHeight);
        miniMap.setViewport(sf::FloatRect(0, 0, 1, 1));

        mWindow.setFramerateLimit(60);

        while(mWindow.isOpen()){
                mWindow.clear();
                mWindow.setView(miniMap);
                mWindow.draw(mBGSprite);
                mWindow.draw(mBall);

                mWindow.display();
        }

The result is this: http://db.tt/14sjmZol. As you can see it is not using the full screen and my image is cutted on right (this is the original image: http://db.tt/5Q6D3uN5). Why this happens? Isn't it suppose to show me the full image on the window ?

2
Graphics / SFML 2.0 crappy graphics on Intel GMA3150
« on: May 03, 2013, 03:19:04 am »
Hello! I have recently started using SFML 2.0 with Thor 2.0. I made an example program to learn how the library works and I have correctly running it on my Ubuntu x64 PC in Eclipse:

#include <SFML/System.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <Thor/Animation.hpp>
#include <Thor/Particles.hpp>
#include <iostream>

int main()
{
        bool moveText = false;

        // Create the main window
        sf::RenderWindow Ventana(sf::VideoMode(800, 600), "Prueba Juego con SFML");

        // Create a graphical string to display
        sf::Font font;
        if(!font.loadFromFile("gkfont.ttf")) return EXIT_FAILURE;
        sf::Text mText("Hello!! :D", font, 50);

        sf::Music miMusica;
    if (!miMusica.openFromFile("musica.ogg")) return EXIT_FAILURE;

    Ventana.setFramerateLimit(60);
    Ventana.clear(sf::Color::Black);

        // Start the game loop
        while (Ventana.isOpen()){
                // Process events
                sf::Event Event;
                while (Ventana.pollEvent(Event)){
                        // Close window : exit
                        if (Event.type == sf::Event::Closed) Ventana.close();
                        if (Event.type == sf::Event::MouseButtonPressed){
                                mText.setPosition(Event.mouseButton.x, Event.mouseButton.y);
                                Ventana.draw(mText);
                                moveText = true;
                        }
                        if(Event.type == sf::Event::MouseMoved && moveText == true){
                                Ventana.clear(sf::Color::Black);
                                mText.setPosition(Event.mouseMove.x, Event.mouseMove.y);
                                Ventana.draw(mText);
                        }
                        if(Event.type == sf::Event::MouseButtonReleased){
                                Ventana.clear(sf::Color::Black);
                                moveText = false;
                        }
                        if(Event.type == sf::Event::KeyPressed && moveText){
                                if(Event.key.code == sf::Keyboard::A) mText.setCharacterSize(mText.getCharacterSize()-2);
                                if(Event.key.code == sf::Keyboard::S) mText.setCharacterSize(mText.getCharacterSize()+2);
                                Ventana.clear(sf::Color::Black);
                                Ventana.draw(mText);
                        }
                        if(Event.type == sf::Event::KeyPressed){
                                if(Event.key.code == sf::Keyboard::P) miMusica.pause();
                                if(Event.key.code == sf::Keyboard::O) miMusica.play();
                        }
                }
                // Update the window
                Ventana.display();
        }

        return EXIT_SUCCESS;
}

The program simply shows a text where the mouse pointer is, you can change its size pressing keys A and S and play music pressing O and P, everything ok.
The problem is when I try to run it on my netbook with Windows XP x86, Intel GMA3150, 1Gb RAM and Intel Athom even this very simple program is very slow and choppy:
  • I can see the window refreshing (the window flashs white)
  • Text movement is slow and not smooth as in my other PC
  • Even if I don't show any text screen flash unless I delete Ventana.display() from the loop

The graphics card have OpenGL v1.4 I think it should be ok to display a simple text. I already updated the drivers to the latest version. Hope you can help me :)

Pages: [1]
anything