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

Author Topic: Text with disappearing characters with the dotNet binding  (Read 3362 times)

0 Members and 1 Guest are viewing this topic.

TobiasW

  • Newbie
  • *
  • Posts: 10
    • View Profile
Text with disappearing characters with the dotNet binding
« on: March 02, 2013, 04:48:15 am »
Hello!

I have the problem described in sf::Text disappearing characters [SFML 2.0].

The workaround solution mentioned over there is to call glFlush(). Is that possible from the dotNet binding? If not, how can I work around the problem here?

Cheers,
Tobias

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Text with disappearing characters with the dotNet binding
« Reply #1 on: March 02, 2013, 09:59:24 am »
Quote
The workaround solution mentioned over there is to call glFlush(). Is that possible from the dotNet binding?
Why not? It's an OpenGL function, not a SFML one.
Laurent Gomila - SFML developer

TobiasW

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Text with disappearing characters with the dotNet binding
« Reply #2 on: March 02, 2013, 04:45:29 pm »
Well, where do I find it? Another thread I found tells me to include <SFML/OpenGL.hpp> - how do I do that for C#? Or what do I have to do there to access the function?

Apologies if that question is really elementary, I have some experience in C# and C++, but virtually none in using one from the other (as seems is needed here).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Text with disappearing characters with the dotNet binding
« Reply #3 on: March 02, 2013, 05:10:12 pm »
Isn't there an official OpenGL wrapper for C#? Or maybe you should just load the "glFlush" function from the "opengl32.dll" library with P/Invoke.
Laurent Gomila - SFML developer

TobiasW

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Text with disappearing characters with the dotNet binding
« Reply #4 on: March 02, 2013, 06:02:25 pm »
I tried to do it with OpenTK - it wanted me to have a context though, but OpenTK.Graphics.GraphicsContext.CurrentContext was always null, creating a context proved futile (probably because the SFML window already has a context) and creating a dummy context (via GraphicsContext.CreateDummyContext()) was pretty useless as one can't call MakeCurrent() on that one.

I figured that might be similar with other OpenGL wrappers, so I tried the P/Invoke. Works fine, thanks!

Just for reference for people searching for this, you simply need this piece of code:

Code: [Select]
[DllImport("opengl32.dll")]
private static extern void glFlush();

...and now you can call glFlush() in that class.

Thanks for your help, Laurent!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Text with disappearing characters with the dotNet binding
« Reply #5 on: March 02, 2013, 09:52:46 pm »
I'm glad you finally made it work :)
Laurent Gomila - SFML developer

 

anything