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.


Messages - virus7

Pages: [1]
1
Graphics / Re: A weird message when loading a file to Texture !
« on: June 16, 2013, 06:17:05 pm »
I added those lines and the outcome was : 1.1  :-X

I guess since you said at least it should be 1.2 then this where the problem comes from.

maybe you can also help me out how to update OpenGL the right way ?  :(

thanks  ;)

2
Graphics / A weird message when loading a file to Texture !
« on: June 16, 2013, 03:16:06 pm »
Here's my code :

#include <SFML/Graphics.hpp>
#include <string>
#include <iostream>

int main(void) {
        sf::RenderWindow Window;
        Window.create(sf::VideoMode(640, 480), "First app", sf::Style::Titlebar | sf::Style::Close);

        sf::Texture pTexture;
        sf::Sprite playerImage;

        pTexture.loadFromFile("player.png");
        playerImage.setTexture(pTexture);

        while(Window.isOpen()) {
                sf::Event Event;
                while(Window.pollEvent(Event)) {
                        switch(Event.type) {
                                case sf::Event::Closed :
                                        Window.close();
                                        break;                 
                        }
                }

                Window.draw(playerImage);
                Window.display();
        }
}

And here's the message that come on the console window :

An internal OpenGL call failed in Texture.cpp <146> : GL_INVALID_ENUM, an unacceptable
value has been specified for an enumerated argument
An internal OpenGL call failed in Texture.cpp <147> : GL_INVALID_ENUM, an
unacceptable value has been specified for an enumerated argument

3
Graphics / Re: My game run really slow when using sf::Text ? : (
« on: August 02, 2012, 03:51:43 pm »
oh ! .. lol .. it works .. thank you so much .. brilliant idea xD

4
Graphics / Re: My game run really slow when using sf::Text ? : (
« on: August 02, 2012, 03:34:55 pm »
I guess i'm gonna have to use mingw command line for now till I find a solution for the Visual C++ thing
thanks Laurent for helping me out to know what's the problem : )

5
Graphics / Re: My game run really slow when using sf::Text ? : (
« on: August 02, 2012, 03:21:33 pm »
When you run it from Visual C++ the debugger is usually attached to the executable, that may be the reason of the slowdown. It should not have this kind of impact nevertheless...

Even when you restart your machine it doesn't work better? What kind of hardware do you have?

Even if I restart my computer it doesn't work better, my laptop is new 2011 , I'm using win7 64bit but now I'm using the integrated graphics card ( IntelĀ® HD Graphics 3000 ) not ATI , though I can use ATI graphics card

6
Graphics / Re: My game run really slow when using sf::Text ? : (
« on: August 02, 2012, 03:15:55 pm »
Should I use ( sf::Texture and sf::Sprite ) every time I load an image ? isn't there another way ?

7
Graphics / Re: My game run really slow when using sf::Text ? : (
« on: August 02, 2012, 03:02:48 pm »
Ok , know I'm really confused , when I run the game through visual C++ it behaves slow just I explained but then I tried to run the .exe file alone by clicking on it , and it runs just fine .

I have no idea why this happens .. is the problem from Visual C++ ?

8
Graphics / Re: My game run really slow when using sf::Text ? : (
« on: August 02, 2012, 02:51:13 pm »

I just removed everything even the images and only kept the Rectangle and the text and it work perfectly !
so, I'm not sure if the problem is from the text or the images : (

9
Graphics / Re: My game run really slow when using sf::Text ? : (
« on: August 02, 2012, 02:48:03 pm »
Yes , I was actually using this code :
but I removed it since it's not really useful in this demonstration : )


sf::Event event;       
while(window.pollEvent(event)){

                if (event.type == sf::Event::Closed) {
                     window.close();
                }
}
 

10
Graphics / Re: My game run really slow when using sf::Text ? : (
« on: August 02, 2012, 02:26:25 pm »
Ok, here is a part of the game code

you can download the two images ( background and character ) from mediafire

http://www.mediafire.com/?9iiwjt6n6ij5jmi

sorry it's too big for the attachment :  )

also I can upload a video on youtube to show you the problem

I'm using Visual C++ 2008, and I'am using dynamic linking


#include <SFML/Graphics.hpp>

int main() {

    sf::RenderWindow window(sf::VideoMode(900, 550), "SFML works!");

        sf::Sprite spriteBg;
        sf::Sprite spriteHero;
        sf::RectangleShape Rect;
       
 
        sf::Text heroText("Get of my face ... ");
        sf::Text instText("Press 'Space' to speak with people, 'Z' or 'X' to rotate \n and arrows to move");
        sf::Text anonyText("?");

        sf::Image heroCharCK;
       
        sf::Texture background;
        sf::Texture heroChar;
       
        if(!heroCharCK.loadFromFile("heroChar.png")) {
                return EXIT_FAILURE;
        }
        heroCharCK.createMaskFromColor(sf::Color(255, 255, 255), 0);
        if(!background.loadFromFile("background.png")) {
                return EXIT_FAILURE;
        }
        if(!heroChar.loadFromImage(heroCharCK)) {
                return EXIT_FAILURE;
        }
               
        spriteBg.setTexture(background);
        spriteBg.setPosition(1.0f, 1.0f);

        spriteHero.setTexture(heroChar);
        spriteHero.setTextureRect(sf::IntRect(0, 0, 32, 32));
        spriteHero.setPosition(600.0f, 200.0f);

        Rect.setSize(sf::Vector2f(40, 70));
        Rect.setFillColor(sf::Color(41, 14, 152, 200));
        Rect.setPosition(100, 100);

        heroText.setPosition(spriteHero.getPosition().x + 32, spriteHero.getPosition().y);
        heroText.setCharacterSize(15);
        heroText.setStyle(sf::Text::Bold);

        instText.setPosition(200, 0);
        instText.setCharacterSize(15);
        instText.setStyle(sf::Text::Bold);

    while (window.isOpen()) {

                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) {
                                Rect.move(-3, 0);
                        }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) {
                                Rect.move(3, 0);
                        }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) {
                                Rect.move(0, -3);
                        }
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) {
                                Rect.move(0, 3);
                        }
               
        window.clear();        

        window.draw(spriteBg);
        window.draw(spriteHero);
               
        window.draw(Rect);
               
        window.draw(heroText);
        window.draw(instText);
        window.draw(anonyText);

        window.display();
    }

    return EXIT_SUCCESS;
}

 

11
Graphics / My game run really slow when using sf::Text ? : (
« on: August 02, 2012, 01:35:08 pm »
Hello,

I'm using SFML 2.0.

I only have three instances of the Text class :


sf::Text heroText("Get of my face ... ");
sf::Text instText("Press 'Space' to speak with people, 'Z' or 'X' to rotate \n and arrows to move");
sf::Text anonyText("?");
 

However, when I draw those instances like this :


window.draw(heroText);
window.draw(instText);
window.draw(anonyText);
 

the program at first run slow, but then after like 15 seconds it return to it's normal speed.
So why when I remove the window.draw functions it run at normal speed , but when I use them it run slow at first ?

Pages: [1]