Archived

This topic is now archived and is closed to further replies.

jubbbird

Newb seeking aid...

Recommended Posts

This is a very beginning sort of query... Ive managed to follow the first 10 or so tutorials, and im impressed with how easy u guys have made it for me so far. However, having written the beginnings of a tetris clone, i have tested it on two other machines, besides my XP machine. One was my girlfriends old laptop running 98, and another was my work pc running 2k. On both, the general speed of the game was much faster, as if the game was limited at a certain framerate on my machine, but not on the others. THis caused the slow moving blocks onm y machine to scream down the screen at unplayable speeds on the other machines. 2k worked ok if i ran it in as window... The other problem, was that the blocks i was drawing have no texture as of yet, so they actually appear as solid shapes. However, as they move down the screen, they form tiny splits between themselves, which doesnt happen on my XP machine. Im wondering wot the difference is, and why something so trivial and simple can happen. I have since discovered other APIs such as Mesa which people keep recommending, but to be hoenst i dont understand. At the moment im just using the libraries that were included in VC6, and id like to think that it would work just fine... but it seems that i cant even get a simple tetris game to work on all machines. Generally my question is, which OpenGL API should I be usin,and how does it all work dammit! Thanx very much in advance

Share this post


Link to post
Share on other sites
Ok. The speed issue has to do with the way you program the movement of the blocks. My guess is that you have something like :

blockPosition+=1;

If you do this, the movement will depend on the speed the comp can render each frame. To fix it, you have to tie the movement with the time elapsed. Example:

blockPosition+=(timeGetTime()/1000);

You will just have to mess around with that 1000 to make it the speed you want.

About the "splits" in the polygons, I would have to say that that is a problem with video drivers. Try updating them and see what happens.

And just stick with OpenGL.

Share this post


Link to post
Share on other sites
You surely have a good implimentation of OpenGL with your video card''s drivers already, so you don''t need to deal with Mesa. Also, it seems that the other people have VSync off (so that the framerate can go above the monitor''s refresh rate, wich is a waste of power, and would explain the splits, because you''d render several frames in one refresh and they may get only partly done) However, even making sure you''re game turns VSync on won''t fix everything, because people use different refresh rates, so it is a good idea to base you''re movement on a timer, rather than the framerate.

Share this post


Link to post
Share on other sites
Sounds like VSync (waiting for the monitor to tell the video card it is clear before drawing again, limiting framerates to the refresh rate of the monitor) is turned on in the XP machine. If it was turned off, it would probably cause increased framerates and the "tearing" between your blocks would likely occur. Now I don''t know much (anything) about OpenGL, so I can''t tell you how you might disable/enable VSync in your application, but I would look into this if I were in your situation.

Also, you may want to include some code to sync the application to a certain framerate in your main game loop. You can do this with something like

//beginning of function
DWORD time=timeGetTime()

//other stuff

//end of function
while (timeGetTime()-time<30); //causes framerate to stick to about 32 fps







"Skepticism.... that great rot of the intellect." - V.H.
Bah, what does HE know?


Albekerky Software

Share this post


Link to post
Share on other sites
Wow, cheers guys.

Ive not tried any of that out, but im sure to do so in the next few days after hours. Im also sure that all these ideas will sort me out, and im glad that i can stick with stanar OpenGL, i cant be arsed to fart about with loads of crap just to draw some blocks...

Thanx very much, appreciate it

Share this post


Link to post
Share on other sites