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

Author Topic: Font drawing gives GL_INVALID_VALUE[Fixed?]  (Read 2883 times)

0 Members and 1 Guest are viewing this topic.

jefvel

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Font drawing gives GL_INVALID_VALUE[Fixed?]
« on: August 04, 2011, 09:36:58 pm »
Hello. I am trying to make a textrenderer, that renders text with sfml2.0 using a renderwindow and that. The problem is, that when I try to do it, it will output "An internal OpenGL call failed in Renderer.cpp (142) : GL_INVALID_VALUE, a numeric argument is out of range".
But, if I add some code to the main loop that draws some text directly to the window, it all works suddenly, even the textrenderer. I have no idea why it behaves like this. Does anyone else here know?
Thanks.

therocode

  • Full Member
  • ***
  • Posts: 125
    • View Profile
    • Development blog
Font drawing gives GL_INVALID_VALUE[Fixed?]
« Reply #1 on: August 04, 2011, 10:06:32 pm »
I am also working on the same project as jefvel.

This is the code we add to the main loop that makes the text renderer's text rendering work. However, this code itself gives the same error:
http://pastebin.com/nNfFtERW

So with this code-snipped commented out, the text renderer breaks and gives the openGL error to the terminal. With it, the snipped itself breaks with that error, but the text renderer works.

The extra snippet is run before the text renderer.

We are using sf::RenderWindow for rendering and we draw stuff on it with raw openGL before rendering the text on it (in the case of the snippet, the text is rendered before the openGL rendering is done)

If we comment out our main loop that runs our whole game engine structure and replace it with this: http://pastebin.com/svFQb3RA
then it works flawlessly, drawing the text.

Can there be any conflicting openGL code in the rest of our rendering system that conflicts with the text rendering of sfml?

therocode

  • Full Member
  • ***
  • Posts: 125
    • View Profile
    • Development blog
Font drawing gives GL_INVALID_VALUE[Fixed?]
« Reply #2 on: August 07, 2011, 12:39:49 am »
Noone knows? D:

jefvel

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Font drawing gives GL_INVALID_VALUE[Fixed?]
« Reply #3 on: August 08, 2011, 07:28:07 pm »
for those who also get this somehow, I think I found a solution.
RenderWindow has methods called "saveGLStates" and "RestoreGLStates", which you have to use when mixing raw openGL commands and the sfml drawing commands. Just use them and you'll be fine. Or something.
Bye!

 

anything