OpenGL: C and D same code - different results

dyh why.you.need at my.email
Tue Feb 6 04:43:21 PST 2007


recently I've tried few OpenGL examples ported from C to D (on win32)
and have run into strange problems.

Translated example was built against same C libs as original, using same
(translated from platform sdk) headers. Resulted binary is using same dlls
as original. But there are some differences:

1. Behavior
In original calls glIndexi() has *no* effect. In translation has.
In original calls glColor3f() has effect. In translation has *not*.
In original initial color is white. In translation it is kind of brown.

2. Performance
original example performs noticeably faster than translated one.

No matter what compiler switches I've tried (-O, -inline, -release, etc).
Example is extremely simple, and i do not see any possibilities to have any
difference in performance. There is no GC used - there are no memory
allocations array slice at all. Actually there are no array usage. In fact
there is nothing at all except opengl api calls. And it is literally same
library in both example and translation.

Here is code (~300 lines) 
original (C) http://paste.dprogramming.com/dpfwrsgw.php
translation (D) http://paste.dprogramming.com/dpu768pr.php.

Any tips from opengl experts?




More information about the Digitalmars-d mailing list