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

Author Topic: A weird message when loading a file to Texture !  (Read 1859 times)

0 Members and 1 Guest are viewing this topic.

virus7

  • Newbie
  • *
  • Posts: 11
    • View Profile
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

The Hatchet

  • Full Member
  • ***
  • Posts: 135
    • View Profile
    • Email
Re: A weird message when loading a file to Texture !
« Reply #1 on: June 16, 2013, 03:37:05 pm »
Try putting
sf::ContextSettings settings = Window.getSettings();
std::cout << settings.majorVersion << "." << settings.minorVersion << std::endl;
right before your while() loop to see what version of OpenGL your card supports.  SFML requires a card to support OpenGL 1.2 at minimum I think?  my card on this machine uses 1.4 and all the graphics calls work fine.

otherwise, code works fine for me, I did add

Window.clear();

before you draw anything, otherwise you get horrible flickering.


virus7

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: A weird message when loading a file to Texture !
« Reply #2 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  ;)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: A weird message when loading a file to Texture !
« Reply #3 on: June 16, 2013, 06:34:15 pm »
Update your graphics card drivers.
Laurent Gomila - SFML developer