www.digitalmars.com         C & C++   DMDScript  

c++ - OpenGL/GLUT program built in MSVC doesn't work in DMC

reply reiter nomadics.com (Mac Reiter) writes:
I have developed a landscape rendering engine in OpenGL, using the
GLUT toolkit for simplified setup and user interaction.  Development
was done with MSVC 5, and has been used considerably by several people
on various machines.

I attempted to bring this project to DMC through the IDDE.  I created
a new console application, spliced my main() over the auto-generated
one, and included all of my source files and the GLUT32.LIB link
library (which had been passed through COFF2OMF as described
elsewhere).

Rather than a scene of rolling green hills and red buildings, slowly
fading into the foggy distance, I am now presented with a solid gray
screen.  No matter how I rotate the camera, I get a solid gray screen.
If I switch my program to an overhead view, I can get a solid cyan
screen.

Also, on some runs, my Vector3D template class (holds a 3 element
array of the given type, provides cross product, normalization into
unit vectors, etc) starts complaining that it can't normalize a
zero-length vector (which is entirely true).  I find this odd, because
I never generate any zero length vectors, except (apparently) under
this compiler.

Since I know that DMC is designed for numerical calculations, with
options for fast math and accurate math, I have begun to wonder if I
am simply setting something wrong in my floating point options.  After
all, 3D calculations can easily go unstable and be prone to
representation roundoff errors.  If my fog density was calculated as
too high, I wouldn't be able to see anything.  If my Vector3D class
can't perform math properly, all of my matrix operations are going to
stick points in interesting places.  Etc and so forth.  If some kind
of fast and "good enough" floating point is being used, I could end up
with all kinds of strange results.

Are there any warnings I should be aware of when bringing code that is
heavy in floating point calculations from MSVC to DMC?  I have tried
with and without the "inline 8087" option.

I have attempted to debug the problem, but cannot make sense of the
debugger.  I can't get it to tell me the value of a local automatic
variable of type int -- "Query Value" tells me that it is an invalid
address, and I can't seem to get any kind of watch expression to
understand what variable I am talking about.

Also, I have tried in various projects to enable the "Strict ANSI
Conformance" option.  In every case, I get an error on my #include
<windows.h> line that says "unterminated string".  The error goes away
when I turn off the ANSI compliance option.

If it matters any, I am running an Athlon XP under Windows 98SE.  DMC
is configured to generate Pentium optimized code for a Win95 target.

Sorry for packing so many questions in one post -- I intended to
separate them, but got jumped with work projects and had to lump them
together here...

Any help would be appreciated,
Mac
Jan 29 2002
parent "Walter" <walter digitalmars.com> writes:
Do you use any long doubles, long longs, unsigned long longs, or inline
assembly?
Feb 04 2002