Advertisement

VC question

Started by September 28, 2000 08:05 AM
3 comments, last by LaBasX2 24 years, 1 month ago
Hi! I have just written a little routine that fills a viewport with some color. It looks like this: for (int i = 0; i < width * height * 3; i++) { pixels = 255; } I've tested the speed of this routine (compiled it as a dll, release of course) and got 52 fps in a delphi program which calls the dll. Then I coded the same routine in delphi and got 69 fps!!! That shocked me quite a bit since I always thought that VC would be faster as delphi. I tried to play around with the VC compiler options but I only found one thing which gave me a real speed improvement: disabling antialiasing, which gives me some stunning 320 fps Well but I don't know what aliasing is. Can anyone please explain me? And does it have any disadvantages when I disable it? Thanks Edited by - LaBasX2 on 9/28/00 8:11:19 AM
I haven''t a clue what aliasing is... yet. But that''s ok, because that''s not why I''m replying... I''m replying because I thought it would be faster to just use the glClear(GL_COLOR_BUFFER_BIT) function... Wouldn''t it be faster??? I don''t actually know, just guessing, but try it.

S.
Advertisement
Aliasing is the jagged steps that you get when you draw a line on a digital device (such as a computer monitor). A line is actually made up of an infinite number of points, but since there aren''t an infinite number of pixels you can use between two points, you just have to use the closest approximation.

Antialiasing is the process of refining this approximation so it more closely resembles the true line, removing the jaggedness or ''staircase'' effect in a line (or polygon edge).

I''d guess that the reason that turning off antialiasing gives such a speed increase is that it doesn''t have to exhaustively test a shiteload of pixels to see if they can be smoothed ??
Antialiasing when you''re clearing the viewport with one colour is pretty pointless anyway (there''s no edges to smooth), so I guess you can get awy with turning it off... *shrug*

Well... there''s my quasi-educated guess

------------------------------------------------------
"You need a weapon. Look around you... can you construct some sort of rudimentary lathe?"
- Guy Fleegman, Security Officer, NSEA Protector
Hi!

No, I don''t mean anti-aliasing but the compiler option you can
find in the optimization section.

Furthermore I''m not using OpenGL but I''m trying to code a software renderer.

Thanks for your replies
That was very interesting. I looked up MSDN and this is what I found:

An alias is a name that refers to a memory location that is already referred to by a different name. Aliasing can slow your application considerably. It reduces register storage space for variables. The Assume No Aliasing (/Oa) option tells the compiler that your program does not use aliasing. The Assume Aliasing Across Function Calls (/Ow) option tells the compiler that no aliasing occurs within function bodies but might occur across function calls. After each function call, pointer variables must be reloaded from memory.
The following code fragment could have an aliasing problem:

i = -100;
while( i < 0 )
{
i += x + y;
*p = i;
}
Without /Oa or /Ow, the compiler must assume that x or y could be modified by the assignment to *p and cannot assume that x + y is constant for each loop iteration. If you specify /Oa or /Ow, the compiler assumes that modifying *p cannot affect either x or y and x + y can be removed from the loop

This topic is closed to new replies.

Advertisement