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

Author Topic: GL_INVALID_ENUM at image creation  (Read 7452 times)

0 Members and 1 Guest are viewing this topic.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
GL_INVALID_ENUM at image creation
« on: June 01, 2010, 05:07:57 pm »
I have encountered a very strange behaviour. This simple code:
Code: [Select]
#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
sf::Image image;
bool created = image.Create(30, 40, sf::Color(0,0,0,0));

std::cout << "Success? " << std::boolalpha << created << std::endl;
}

leads to the following output:
Code: [Select]
An internal OpenGL call failed in image.cpp (633) : GL_INVALID_EUM, an unaccepta
ble value has been specified for an enumerated agument
An internal OpenGL call failed in image.cpp (634) : GL_INVALID_EUM, an unaccepta
ble value has been specified for an enumerated agument
Success? true

"EUM" and "agument" are not typographic errors, GLCheck.cpp contains the correct strings. I seriously don't know how that can happen. :shock:

However, the actual problem is those failed OpenGL calls. These two lines in sf::Image::CreateTexture() cause the problem:
Quote
   GLCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
    GLCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));

I'm using the newest SVN revision (1523) of SFML2 on Windows 7 and Microsoft Visual Studio 2008 SP1, I just recompiled SFML. Any ideas?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
GL_INVALID_ENUM at image creation
« Reply #1 on: June 01, 2010, 05:23:20 pm »
What is your graphics card? Do you know which version of OpenGL it supports?
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
GL_INVALID_ENUM at image creation
« Reply #2 on: June 01, 2010, 05:53:29 pm »
I have got a NVIDIA GeForce 6100 nForce 405. According to the Windows Device Manager, its drivers are up to date.

I don't know about the supported OpenGL version, how can I find it out? I haven't come across any useful information on the internet (nor on the NVIDIA homepage). But I've been working with SFML on this computer for two years without any problems... Did the used OpenGL version recently change?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
GL_INVALID_ENUM at image creation
« Reply #3 on: June 02, 2010, 12:02:30 am »
Not really, but I added GL_CLAMP_TO_EDGE which is supported in OpenGL 1.2 only (and except for this one, SFML is compatible with OpenGL 1.1).

But I think that your graphics card supports OpenGL 1.2...
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
GL_INVALID_ENUM at image creation
« Reply #4 on: June 02, 2010, 05:02:19 pm »
Ok... So should I just ignore the warnings (or comment the two lines out)?

I could also try to download and install  the driver despite of Windows's claim that it would be up to date. Do you think this might help?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
GL_INVALID_ENUM at image creation
« Reply #5 on: June 02, 2010, 06:15:03 pm »
Yes, you can try that.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
GL_INVALID_ENUM at image creation
« Reply #6 on: June 02, 2010, 07:24:56 pm »
Thanks for your tips.

I have reinstalled the graphics card's driver, but the situation has remained exactly the same. It appears unlikely to me that my graphics card wouldn't support OpenGL 1.2, since this version is more than 10 years old. I actually have no idea...
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
GL_INVALID_ENUM at image creation
« Reply #7 on: June 02, 2010, 08:13:02 pm »
I checked your GPU with OpenGL extension viewer, and indeed it doesn't seem to support the extension needed for GL_CLAMP_TO_EDGE (GL_SGIS_texture_edge_clamp), although it supports GL 2.0 features such as fragment & vertex programs (shaders).

Anyway, I guess I can add a test and switch back to GL_CLAMP when GL_CLAMP_TO_EDGE is not supported.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
GL_INVALID_ENUM at image creation
« Reply #8 on: June 02, 2010, 08:29:45 pm »
Ah, thank you very much! I didn't even know about OpenGL extension viewer.

In how far would the user see a difference between GL_CLAMP and GL_CLAMP_TO_EDGE? As far as I know, those parameters specify the coordinate system of texture mapping, but what impact do they have on SFML's graphical output? I'm just curious... ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
GL_INVALID_ENUM at image creation
« Reply #9 on: June 02, 2010, 08:53:49 pm »
Sometimes the sprites show a border (when bilinear filtering and decimal coordinates are involved).
With GL_CLAMP, the color of this border is totally unrelated to the pixels of the sprite, producing a visual artifact.
With GL_CLAMP_TO_EDGE, OpenGL duplicates the adjacent row/column to create the border, so it is invisible to the user.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
GL_INVALID_ENUM at image creation
« Reply #10 on: June 02, 2010, 09:16:09 pm »
Okay, thank you for the explanation. For the next time, I'll probably just comment those two lines out in order to concentrate on important issues. In case you need me to do some tests, just tell me. ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
GL_INVALID_ENUM at image creation
« Reply #11 on: July 27, 2010, 01:00:42 pm »
Update: Now I've tried another driver that was only just released, and the problem doesn't appear anymore. Apparently, the graphics card supports GL_CLAMP_TO_EDGE.

Besides, the new driver dramatically increases performance of some SFML games that haven't been compiled under Windows 7, and that were unplayable before the update. Also a error message concerning not supported antialiasing disappeared. :)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
GL_INVALID_ENUM at image creation
« Reply #12 on: July 27, 2010, 01:21:08 pm »
Wow... wonderful ;)
Laurent Gomila - SFML developer