Sign in to follow this  
CPPNick

Wait for retrace

Recommended Posts

Hi, Im writing a little software rendering program just to draw textured polygons to the screen. I have everything working, but it "tears" really bad when drawing. I have read that this is a v-sync issue. I have also read that directX has a function called "WaitForRetrace" or something like that right? I don't want to use directX or anything external in my project. Right now, its all just regular windows GDI stuff and the math. Is there a way to waitforretrace without external stuff like OpenGL or DirectX? I was reading one of Denthors of Asphixia's" tutorials and it gave the following function to wait for retrace: http://www.gamedev.net/reference/articles/article356.asp procedure WaitRetrace; assembler; { This waits for a vertical retrace to reduce snow on the screen } label l1, l2; asm mov dx,3DAh l1: in al,dx and al,08h jnz l1 l2: in al,dx and al,08h jz l2 end; The tutorial said that it was running in mode 13h. Is the above function only for that mode? or can it work for me? I am using C++ 9.0 Express. from what I understand, I can include asm code in my win32 application by doing this: _asm{ ect, ect } Thanks for any help! Nick

Share this post


Link to post
Share on other sites
Quote:
Original post by CPPNick
Hi, Im writing a little software rendering program just to draw textured polygons to the screen. I have everything working, but it "tears" really bad when drawing. I have read that this is a v-sync issue. I have also read that directX has a function called "WaitForRetrace" or something like that right? I don't want to use directX or anything external in my project. Right now, its all just regular windows GDI stuff and the math. Is there a way to waitforretrace without external stuff like OpenGL or DirectX? I was reading one of Denthors of Asphixia's" tutorials and it gave the following function to wait for retrace:

http://www.gamedev.net/reference/articles/article356.asp

procedure WaitRetrace; assembler;
{ This waits for a vertical retrace to reduce snow on the screen }
label
l1, l2;
asm
mov dx,3DAh
l1:
in al,dx
and al,08h
jnz l1
l2:
in al,dx
and al,08h
jz l2
end;

The tutorial said that it was running in mode 13h. Is the above function only for that mode? or can it work for me?

I am using C++ 9.0 Express.
from what I understand, I can include asm code in my win32 application by doing this:
_asm{
ect, ect
}

Thanks for any help!
Nick


It should fail in Windows.

Read This
http://www.compuphase.com/vretrace.htm

Then decide if its worth avoiding OpenGL or DirectX.

Share this post


Link to post
Share on other sites
Pretty sure that for v-sync you'd have to use the WaitForRetrace function or the equivalent (wglSwapIntervalEXT) from OpenGL. To get info about what the graphics card is doing you need to talk to it through the driver, and OpenGL/DirectX are the standard ways of doing that.

-me

Share this post


Link to post
Share on other sites
Thanks for the link, I understand now that it will have to go without vsync =)
Its just a really simple project..not worth making drivers for and all that.
thx again, Nick

edit: is there a "mark as solved" button on here somewhere?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this