Jump to content

  • Log In with Google      Sign In   
  • Create Account


Weird artifacts and Frame Independent Movement


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
No replies to this topic

#1 Toshio   Members   -  Reputation: 135

Like
0Likes
Like

Posted 16 August 2012 - 07:42 AM

Greetings. I have two problems here.

First off, I'm using OpenGL with SDL.

The first problem are weird lines around the transparent PNG picture as shown in the screenshot:
screenshot.png

This is the PNG picture:
catanimate.png

How can I make the lines disappear?

The second problem is Frame Independent Movement. I got it all set up, and I thought it worked until a lot of things went happening at the same time. At some places entities move very fast, at some very slow, depending on what's rendering on screen and what logic is currently happening.

Here is some code:

this is main.cpp:
Uint32 delta = SDL_GetTicks();
	SDL_Event event;
	g.OnInit();
	while(g.running)
	{
		if(SDL_PollEvent(&event))
		{
			g.OnEvent(&event);
		}
		g.OnLoop(SDL_GetTicks() - delta);
		delta = SDL_GetTicks();
		g.OnRender();
	}

and this is how the player, for example, moves:
x += xVel * (delta / 1000.0f);

Thank you for your help Posted Image

Sponsor:



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