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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - yingche

Pages: [1]
1
Graphics / Re: a bug of sfml graphical module
« on: March 12, 2016, 08:02:33 am »
I write a function which is used to show a picture on screen. The function is like this:
void drawTexture(float centerX,float centerY);
When I need to draw a title texture, which means the texture should be centered, and I donnot konw the texture size, using this function will be very convenient. However, if the centerX parameter is an integer and the texture size is an odd number, the upper left corner coordinate will be a decimal. So you can see it is really a common situation.

2
Graphics / Re: a bug of sfml graphical module
« on: March 12, 2016, 05:41:26 am »
I have got new findings. Change the sentence:
s.setposition(100,60);
to
s.setposition(100.2,60);
s.setposition(100.4,60);
s.setposition(100.498,60);
s.setposition(100.502,60);
s.setposition(100.6,60);
s.setposition(100.8,60);
The results are all OK.
However,as for 100.499, 100.5, 100.501, the results are bad.
So I think it must be a bug of sfml. Please run my source code, and you must agree with me, too.

3
Graphics / Re: a bug of sfml graphical module
« on: March 12, 2016, 01:39:25 am »
First,I wonder why the center coordinate need to be an integer. I don't rotate the texture or scale it. My texture has a width of an odd number,so the center position must be a decimal. Next,it seems that sfml will dispose fractional part of left coordinate when displaying on window. So it really confuses me a lot why the bug appears.

4
Graphics / a bug of sfml graphical module
« on: March 11, 2016, 02:54:50 pm »
This is the source code:

int main()
{
   Font font;
   font.loadFromFile(String("arial.ttf"));
   RenderWindow window(VideoMode(640, 480), "1");
   Text text("8", font, 32);
   text.setColor(Color(0, 0, 0, 255));
   FloatRect r;
   r=text.getGlobalBounds();
   text.move(-r.left, 0);
   RenderTexture tex;
   tex.create(r.width, 50);
   tex.clear(Color(0, 0, 0, 0));
   tex.draw(text, RenderStates(BlendNone));
   tex.display();
   Sprite s(tex.getTexture());
   while (1){
      window.clear(Color(255, 255, 255, 255));
      s.setPosition(100, 160);//OK
      window.draw(s);
      s.setPosition(100.5, 190);//BUG
      window.draw(s);
      window.display();
      Event event;
      window.waitEvent(event);
      if (event.type == Event::Closed)break;
   }
   return 0;
}

I want to draw some text to a render target, and draw the target texture to screen. But the text on the screen
 seems abnormal.
http://pan.baidu.com/s/1bnTZ5AR
Is it a bug? If yes,I hope it can be fixed as soon as possible. After all, it is really a serious bug. Thanks very much.

5
Graphics / Re: SFML Text is incomplete when shown on window
« on: February 16, 2016, 06:14:09 am »
I'm sorry that what I said before was wrong. Both white backgroung and black background have this problem. And if the font size is set to 16,18,ect, the phenomenon is very clear.

6
Graphics / Re: SFML Text is incomplete when shown on window
« on: February 16, 2016, 01:57:27 am »
After all,the fractional part is less than one pixel. So if the font size is large, it looks nice. You can try smaller font size.

7
Graphics / Re: SFML Text is incomplete when shown on window
« on: February 15, 2016, 03:22:13 pm »
http://pan.baidu.com/s/1nurR3pZ
I just casually select a font file from the folder "c:\windows\fonts". You can try other files, and most of them have this problem.
Thank you so much for helping me :D

8
Graphics / Re: SFML Text is incomplete when shown on window
« on: February 15, 2016, 11:27:17 am »
In my opinion, the reason may due to a conversion between float type and int type. The fractional part lost, so the letters display incompletely. I think the error is not due to freetype library, but SFML itself.

9
Graphics / Re: SFML Text is incomplete when shown on window
« on: February 15, 2016, 10:27:02 am »
http://pan.baidu.com/s/1qXb6jlq
I upload the screenshot to netdisk.
In the image,the right and bottom of every letter is strange. Have a look at the right of letter 'g','H','p', and the bottom of 'g','e'. The picture has been stretched. The fontsize is 20.

10
Graphics / Re: SFML Text is incomplete when shown on window
« on: February 15, 2016, 09:57:29 am »
I have tried a lot of times,but I still cannot add a screenshot here. The button "insert image" doesn't work! Help me!

11
Graphics / Re: SFML Text is incomplete when shown on window
« on: February 12, 2016, 02:09:11 pm »
I just write a simple program to show the problem. I know I should clear,draw and display every frame. I just want to know:
When I use black text and white background, the edge of every letter is strange. I can describe the phenomenon in this way. A letter is printed on a paper,and you cut the paper in order to remove the margin,but you cut a little bit more. As a result, the letter is incomplete. The text on the screen is like this. My English is not good,but I hope I have described the problem clearly.
I really think it is a bug. I think it may due to the transformation between float type and int type,but I'm not sure.

12
Graphics / Re: SFML Text is incomplete when shown on window
« on: February 12, 2016, 11:47:12 am »
int main()
{
   RenderWindow window(VideoMode(640, 480), "1");
   Font font;
   font.loadFromFile(String("system.ttf"));
   Text text("aaabbbcccdddeeefffgggHHH", font, 22);
   text.setColor(Color::Black);
   text.setPosition(10.4, 20.3);
   window.clear(Color::White);
   window.draw(text);
   window.display();
   while (1){
      Event event;
      window.waitEvent(event);
      if (event.type == Event::Closed)break;
   }
   return 0;
}

This is the source code. I don't konw why I cannot add image here, maybe the browser doesn't support it.

13
Graphics / SFML Text is incomplete when shown on window
« on: February 12, 2016, 11:31:58 am »
I drew some text on window using Text class. The text color was black, and the background color of window was white. Then something strange occured: the text shown on window was incomplete! But if the text color is white, and the background color of window is black, evething is OK. I don't konw whether I have found a bug.

Pages: [1]