Jump to content

  • Log In with Google      Sign In   
  • Create Account


Weird Graphics Bug


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 11 July 2013 - 10:29 PM

Hello, I ran my game and a tile is not what it should be. I checked to see if I was using the right file, and I am, and I re-saved the file but it does not seem to work. Does anybody have any idea why this is happening?

 

Original Tile: Origonal.PNG

 

Bugged Tile(in-game): weird bug.PNG

 

Thank you for any help.


Edited by Crusable, 11 July 2013 - 10:30 PM.

"C spilled his beer all over C++'s shirt. Outraged, C++ shouted, "Good god, man! Have you no class?"

"Your mother is so fat that the recursive function that was used to calculate her mass created a stack overflow"

 

 


Sponsor:

#2 Sik_the_hedgehog   Crossbones+   -  Reputation: 1494

Like
2Likes
Like

Posted 11 July 2013 - 10:45 PM

What are you using to draw it?

 

My first guess would be that the texture coordinates are wrong (more specifically, the vertical coordinates). If you're dealing with textures, it may be worth checking that.


Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

#3 radioteeth   Prime Members   -  Reputation: 918

Like
0Likes
Like

Posted 11 July 2013 - 10:52 PM

You're going to need to help us help you, and be more exacting in your description of the problem. What is loading the image, what format is the image, what is being used to draw the image, and what is using whatever is being used to draw the image as a tile. For all we know you could be using HTML and making a webpage.


Edited by radioteeth, 11 July 2013 - 10:52 PM.


#4 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 12 July 2013 - 12:07 AM

I am using Gimp to make the images and they are all PNG files. This image is part of a sheet. I am using SFML and C++. The object using the image is a sf::VertexArray of type sf::Quads with 4 elements. The Image itself is a sf::Texture. This specific texture is part of an animated object and the first image works properly as well as all the others on the sheet. 

 

here is the code for mapping the texture choords:

	m_sfObjBox[0].texCoords = sf::Vector2f(m_fCurrentFrame * m_sfSize.x, m_fCurrentFrame * m_sfSize.y);
	m_sfObjBox[1].texCoords = sf::Vector2f((m_fCurrentFrame * m_sfSize.x) + m_sfSize.x, m_fCurrentFrame * m_sfSize.y);
	m_sfObjBox[2].texCoords = sf::Vector2f((m_fCurrentFrame * m_sfSize.x) + m_sfSize.x, (m_fCurrentFrame * m_sfSize.y) + m_sfSize.y);
	m_sfObjBox[3].texCoords = sf::Vector2f(m_fCurrentFrame * m_sfSize.x, (m_fCurrentFrame * m_sfSize.y) + m_sfSize.y);

m_fCurrentFrame is either 0 or 1 because there is only two frames in this animation. m_sfSize is a sf::Vector2f with both x and y being 32. m_sfObjBox is the sf::VertexArray.

 

Edit: I did not see sik_the_hedghog's post and I just looked at it. I see my error.


Edited by Crusable, 12 July 2013 - 12:14 AM.

"C spilled his beer all over C++'s shirt. Outraged, C++ shouted, "Good god, man! Have you no class?"

"Your mother is so fat that the recursive function that was used to calculate her mass created a stack overflow"

 

 


#5 fanaticlatic   Members   -  Reputation: 458

Like
0Likes
Like

Posted 12 July 2013 - 08:16 AM

As others have said this looks like uv coordinates are wrong. You want to map the whole texture to the rectangle correct?

 

Assuming your rendering as triangle strips try implementing the following pseudocode:

 

vert 1.texcoord = 0,0

vert 2.texcoord = 0,1

vert 3.texcoord = 1,1

vert 4.texcoord = 1,0

 

If that doesn't work try shifting the coords between the different verts, one combination should work for you.

 

 

Good luck.


"I have more fingers in more pies than a leper at a bakery!"




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS