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

Author Topic: Bitmap font rendering, problem with "transparency hiding opaque"  (Read 1825 times)

0 Members and 3 Guests are viewing this topic.

Doodlemeat

  • Guest
Hello.
I am trying to render a bitmap font that is loaded from a file.
I render all the glyphs into the same vertex buffer while each glyph having its own QUAD(6 vertices).
The result I am getting is this:


This is because I am using kerning to lessen the distance between characters.
I think the solution for my problem is to use a different z-valuefor each quad, but since there are so many characters, I cant manually choose which characters gets a higher z-value than the other.
Or should I make something with my blending? Because since all vertices are in the same buffer, the blending doesn't get used before everything is drawn, am I right?
What would I do?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Bitmap font rendering, problem with "transparency hiding opaque"
« Reply #1 on: January 14, 2015, 07:45:26 am »
Quote
Because since all vertices are in the same buffer, the blending doesn't get used before everything is drawn, am I right?
You're wrong ;)
Blending is applied directly to each pixel being drawn to the back buffer, there's no "intermediate" buffer that holds an unblended pre-rendered version of your vertex array.

If the glyph background is transparent, then what you show is most likely a texture coordinate issue.
Laurent Gomila - SFML developer

Doodlemeat

  • Guest
Re: Bitmap font rendering, problem with "transparency hiding opaque"
« Reply #2 on: January 14, 2015, 11:32:25 am »
Ok, my mistake. But I know that my texture coordinates are all correct. What I am doing now is fiddling around with the vertex positions. Can it be so simple that I am using the wrong blending style? :)

Since I am using Directx11 to draw I think that their blending is different than OpenGL.
Values I am using right now:

src-color = SRC_ALPHA
dest-color = ONE_MINUS_SRC_ALPHA
src-alpha = ONE
dest-alpha = ONE
src-operation = ADD
dest-operation = ADD

Does that makes any sense to you? It is explained roughly here

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Bitmap font rendering, problem with "transparency hiding opaque"
« Reply #3 on: January 14, 2015, 11:44:21 am »
Quote
I am using Directx11 to draw
??? How is this related to SFML?
Laurent Gomila - SFML developer

Doodlemeat

  • Guest
Re: Bitmap font rendering, problem with "transparency hiding opaque"
« Reply #4 on: January 14, 2015, 11:45:14 am »
My problem is not related to SFML at al, just rendering, that is why I choose the General subforum ;)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Bitmap font rendering, problem with "transparency hiding opaque"
« Reply #5 on: January 14, 2015, 12:18:03 pm »
But this is the SFML forum... even general questions must be related to SFML.

Sorry but you'll have to find a more relevant forum, the SFML community is not going to help you solve your DirectX issues.
Laurent Gomila - SFML developer

Doodlemeat

  • Guest
Re: Bitmap font rendering, problem with "transparency hiding opaque"
« Reply #6 on: January 14, 2015, 01:12:49 pm »
Hold on now. Who are you to speak for the entire community about that. I doubt people wont help me because this is not SFML related. Please, if there is anything more to the subject that you can help me with, do so.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Bitmap font rendering, problem with "transparency hiding opaque"
« Reply #7 on: January 14, 2015, 01:26:49 pm »
It has always been the case that non-SFML-related question have not their place here. We do not intend to be yet another general purpose forum.....
SFML / OS X developer

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Bitmap font rendering, problem with "transparency hiding opaque"
« Reply #8 on: January 14, 2015, 01:34:29 pm »
And even in the case that someone really really bored feels like offering help, who is supposed to have experience with DirectX here? If people use DirectX they probably wouldn't frequent this forum much anyway. You are asking the wrong target audience ;).

Please don't misunderstand us. We like to help. We just feel like you are wasting time here while you could have probably gotten more and better help by asking somewhere else in the first place. We don't want to drive people away, we just encourage them to seek help in the most efficient manner, and yours, I'm afraid, isn't very efficient.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).