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

Author Topic: OpenGL call failed in RenderTarget.cpp?  (Read 3039 times)

0 Members and 1 Guest are viewing this topic.

Jamie_Edwards

  • Newbie
  • *
  • Posts: 7
    • View Profile
OpenGL call failed in RenderTarget.cpp?
« on: December 23, 2015, 03:29:41 pm »
Hi guys,

So I'm now using CodeLite to develop my SFML game, and also reading from the SFML Game Development book and have hit a little bit of a hitch in the third chapter called "World".

This is the github for the chapter: https://github.com/SFML/SFML-Game-Development-Book/tree/master/03_World

Now onto my error... I've copied what's both in the book and the github word for word in terms of code (I've added extra functions here and there to break the code into more understandable parts for me).

Now it all comes out error and warning free, but when I go to run the program I get a black window and the following runtime error:
An internal OpenGL call failed in RenderTarget.cpp(418).
Expression:
   glViewport(viewport.left, top, viewport.width, viewport.height)
Error description:
   GL_INVALID_VALUE
   A numeric argument is out of range.
 

Now I've looked around the internet and found out that that error tends to lead to an out-of-date graphics card... But I've a very new Lenovo IdeaPad Flex 10 running Ubuntu 15.10.

Also when I do the following in the main Game class:
sf::Texture m_texture;
sf::Sprite m_sprite;

m_texture.loadFromFile("/Path/To/Texture/Resource.png");

m_sprite.setTexture(m_texture);

m_window.clear();
m_window.draw(m_sprite);
m_window.display();
 

The texture displays fine... I don't understand what could be going wrong... Any ideas?

Edit:-

I also placed the following into my Game::run() function to check the major version of OpenGL my graphics card can provide:
sf::ContextSettings settings = m_window.getSettings();
        std::cout << settings.majorVersion << "." << settings.minorVersion << std::endl;
 

and it came out with a value of 3.0.
« Last Edit: December 23, 2015, 03:43:14 pm by Jamie_Edwards »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: OpenGL call failed in RenderTarget.cpp?
« Reply #1 on: January 01, 2016, 01:41:24 am »
What OS are you running? What GPU do you have? Is your GPU driver uptodate?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mr_Blame

  • Full Member
  • ***
  • Posts: 192
    • View Profile
    • Email
Re: OpenGL call failed in RenderTarget.cpp?
« Reply #2 on: January 05, 2016, 04:51:54 pm »
After searching i can say that he has probably Intel HD Graphics gpu and ubuntu, also posting code of this program would be nice.

PupperGump

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: OpenGL call failed in RenderTarget.cpp?
« Reply #3 on: February 04, 2023, 07:30:41 pm »
I've found that if using Visual Studio it will tend to throw this error for absolutely no reason even while the given views display properly. Try rebuilding the entire project or rescanning the solution so any precompiled nonsense errors get tossed.