POV-Ray : Newsgroups : povray.programming : POV-Ray 3.5 & VS.NET 2003 Server Time
22 Dec 2024 17:29:29 EST (-0500)
  POV-Ray 3.5 & VS.NET 2003 (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Ryan Lamansky
Subject: POV-Ray 3.5 & VS.NET 2003
Date: 11 Mar 2004 21:34:43
Message: <405121c3$1@news.povray.org>
Microsoft Visual Studio .NET 2003 is a hot topic in the C++ world.  Lots 
of people have lots to say about.  Unfortunately, one thing being said 
is that POV-Ray 3.5 won't build on it.

With a few modifications, it actually is possible :)  Below are 
step-by-step instructions to take the POV-Ray 3.5 source code from 
www.povray.org and make it build in VS.NET 2003.

Not only does it build, but it actually runs very well (producing a 
smaller, slightly faster .EXE than the released POV-Ray).  It takes 
about an hour to apply the changes (and then it works forever :)

-Install the release version of POV-Ray 3.5 (it registers DLLs you 
need).
-Open VS.NET 2003.
-Choose "Open Project"
-Navigate to The "VC6" folder to find the "Povray.dsw" file.  Open this.
-A warning is presented regarding the conversion of the file.  Choose 
"Yest To All".
-If you see a source control pop-up, click "Ok".  Choose "Work 
Disconnected" from the next pop-up.
-Remove all projects but these: "povray", "jpeg", "libpng", "tiff", 
"zlib".  These projects make up the core of POV-Ray, the most important 
part.
-For fun, try a build at this point.  You get 105 "Build Errors" in your 
task list.  Most of them are duplicates.
-The first error is caused by  Line 87 in "Windows Source\Windows 
Headers\ztimer.h".  Chage <iostream.h> to <iostream>.
-If you decide to build again, it'll take a very long time and report 
1308 errors... Joy!
-Once again, these are mostly duplicates.  In "ztimer.h", comment out 
lines 134 and 174 (they're never actually used).
-Building now goes much more quickly, and yields 59 errors.  That's a 
little better :)
-Open up "POV-Ray Core\Core Headers\optout.h" to comment out line 49.  
You're strongly encouraged to update line 50 to a name.  "POV-Ray 3.5 
built with VS.NET 2003" is a good suggestion :)
-Building now produces 39 errors.
-Open up "Windows Source\Windows Headers\pvengine.h".  Comment out Line 
54, change the definition value on the next line to your name or maybe 
"Visual Studio .NET 2003".
-The next build has 29 errors.
-The next easily-fixed on is in "Windows Source\pvengine.c".  Comment 
out line 109.
-28 errors.  Now it's crunch time.  All of the remaining errors are 
caused by the same situation: mixed parameter types to a function call, 
resulting in VS.NET being unable to decide which one to use.
-The fix for all of these is to up-cast one of the parameters to the 
type of the larger one.  It's slightly different in each case, so I've 
documented the exact lines you have to change to get through this.

(I decided to preserve spaces/tabs, which may cause wrapping in some 
newsreaders)

"POV-Ray Core\image.cpp", line 594
   if(fabs(Image->Colour_Map[x].Filter) > EPSILON) //Before
   if(fabs((float)Image->Colour_Map[x].Filter) > EPSILON) //After
Same file, line 596
   if(fabs(Image->Colour_Map[x].Transmit) > EPSILON) //Before
   if(fabs((float)Image->Colour_Map[x].Transmit) > EPSILON) //After
Same file, line 620
       if (fabs(Image->data.rgb16_lines[y].transm[x]) > EPSILON) 
//Before
       if (fabs((float)Image->data.rgb16_lines[y].transm[x]) > EPSILON) 
//After
Same file, line 636
      if(fabs(Image->data.rgb8_lines[y].transm[x]) > EPSILON) //Before
      if(fabs((float)Image->data.rgb8_lines[y].transm[x]) > EPSILON) 
//After
Same file, line 682
  *v = fmod(y * Image->height, Image->height); //Before
  *v = fmod(y * Image->height, (double)Image->height); //After
Same file, line 969
      *u = fmod(x * Image->width, Image->width); //Before
      *u = fmod(x * Image->width, (double)Image->width); //After
Same file, line 973
      *v = fmod(x * Image->height, Image->height); //Before
      *v = fmod(x * Image->height, (double)Image->height); //After
Same file, line 986
      *u = fmod(y * Image->width, Image->width); //Before
      *u = fmod(y * Image->width, (double)Image->width); //After
Same file, line 990
      *v = fmod(y * Image->height, Image->height); //Before
      *v = fmod(y * Image->height, (double)Image->height); //After
Same file, line 1003
      *u = fmod(z * Image->width, Image->width); //Before
      *u = fmod(z * Image->width, (double)Image->width); //After
Same file, line 1007
      *v = fmod(z * Image->height, Image->height); //Before
      *v = fmod(z * Image->height, (double)Image->height); //After

"POV-RAY Core\pattern.cpp", line 242
   value = pow(value, TPat->Exponent); //Before
   value = pow(value, (double)TPat->Exponent); //After

"POV-Ray Core\lighting.cpp", line 1933
    Intensity = pow(fabs(Cos_Angle_Of_Incidence), Finish->Brilliance); 
//Before
    Intensity = pow(fabs(Cos_Angle_Of_Incidence), 
(double)Finish->Brilliance); //After
Same file, line 2112
    Intensity = Finish->Phong * pow(Cos_Angle_Of_Incidence, 
Finish->Phong_Size); //Before
    Intensity = Finish->Phong * pow(Cos_Angle_Of_Incidence, 
(double)Finish->Phong_Size); //After
Same file, line 2209
      Intensity = Finish->Specular * pow(Cos_Angle_Of_Incidence, 
Finish->Roughness); //Before
      Intensity = Finish->Specular * pow(Cos_Angle_Of_Incidence, 
(double)Finish->Roughness); //After
Same file, line 4110
          Att = 1.0 + pow(Intersect->Depth / Interior->Fade_Distance, 
Interior->Fade_Power); //Before
          Att = 1.0 + pow(Intersect->Depth / Interior->Fade_Distance, 
(double)Interior->Fade_Power); //After
Same file, line 4400
          k = 1.0 + pow(Ray_Intersection->Depth / 
Interior->Fade_Distance, Interior->Fade_Power); //Before
          k = 1.0 + pow(Ray_Intersection->Depth / 
Interior->Fade_Distance, (double)Interior->Fade_Power); //After
Same file, line 4747
          Att = 1.0 + pow(Intersection->Depth / 
Interior->Fade_Distance, Interior->Fade_Power); //Before
          Att = 1.0 + pow(Intersection->Depth / 
Interior->Fade_Distance, (double)Interior->Fade_Power); //After

"POV-Ray Core\colutils.cpp", line 121
    Colour[pTRANSM]  = 1.0 - pow((1.0 - Colour[pTRANSM]), 
opts.GammaFactor); //Before
    Colour[pTRANSM]  = 1.0 - pow((1.0 - Colour[pTRANSM]), 
(double)opts.GammaFactor); //After

"POV-Ray Core\photons.cpp", line 892
    photonOptions.photonSpread *= 
sqrt(Light->Area_Size1*Light->Area_Size2); //Before
    photonOptions.photonSpread *= 
sqrt((float)(Light->Area_Size1*Light->Area_Size2)); //After

"POV-Ray Core\fnintern.cpp", line 349 (Don't ask me what this code 
does...)
  12*r2*PARAM_Z*(27*ph*ph-24*z2*ph+ 
36*sqrt(2)*PARAM_Y*PARAM_Z*(y2-3*x2)+4*z2*z2)+ //Before
  12*r2*PARAM_Z*(27*ph*ph-24*z2*ph+ 
36*sqrt((float)2)*PARAM_Y*PARAM_Z*(y2-3*x2)+4*z2*z2)+ //After
Same file, line 351
  108*sqrt(2)*PARAM_X*PARAM_Z*(x2-3*y2)+4*z2*z2) ); //Before
  108*sqrt((float)2)*PARAM_X*PARAM_Z*(x2-3*y2)+4*z2*z2) ); //After
Same file, line 585
  x1=fabs(fmod(fabs(PARAM_X), sqrt(3))-sqrt(3)/2); //Before
  x1=fabs(fmod(fabs(PARAM_X), sqrt(3.0))-sqrt(3.0)/2); //After
Same file, line 587
  x2=sqrt(3)/2-x1; //Before
  x2=sqrt(3.0)/2-x1; //After
Same file, line 609
  x1=fabs(fmod(fabs(PARAM_X), sqrt(3))-sqrt(3)/2); //Before
  x1=fabs(fmod(fabs(PARAM_X), sqrt(3.0))-sqrt(3.0)/2); //After
Same file, line 611
  x2=sqrt(3)/2-x1; //Before
  x2=sqrt(3.0)/2-x1; //After

If you have made all of the above changes correctly, then you'll have 
POV-Ray 3.5 building in VS.NET 2003!

Now that you've reached this point, the next logical step is to put all 
of Microsoft's new compiler optimizations to work.

-Switch your project into the "Release" configuration.
-Go to Project->povray Properties.
-From this initial screen, change "Whole Program Optimization" to "Yes".
-Open the "C\C++" folder.
-Choose "Optimization" from the expanded items list.  Make the following 
changes:
--Global Optimization: Yes
--Inline Function Expansion: Any Suitable
--Enable Intrinsic Functions: Yes
--Favor Size or Speed: Favor Fast Code
--Omit Frame Pointers: Yes
--Optimize for Processor: (Think about this before deciding) Pentium 4 
and Above.
--Optimize for Windows Application: Yes
-Go to the "Code Generation" item.  Make these changes:
--Enable String Pooling: Yes
--Buffer Security Check: No
--Enable Enhanced Instruction Set: (Think about this before deciding) 
Streaming SIMD Extensions 2
--Go to the Precompiled Header item.  Change "Create/Use Precompiled 
Header" to "Not Using Precompiled Headers".
-Expand the "Linker" item list.
--Go to the "Optimization" item, and (think before doing) change 
"Optimize for Windows 98" to "No".

The last step is to build your VS.NET 2003 fully-optimized POV-Ray 3.5.  
Because of all the optimizations, the build will take longer than 
before.

In the solution explorer, right-click the "povray" project and choose 
"Set as Startup Project".  Press Control+F5 to run it.  Use your 
personalized copy to run "%official povray install 
folder%\scenes\advanced\benchmark.pov" and compare it with the official 
release.  The speed is quite good... on my machine (P4 2.26, 512MB, 
WinXP), my custom build did it (using recommended command-line options) 
in slightly -less- time than the official POV-Ray :)

None of the source code changes in this document should break POV 
functionality in any way, so it should be safe to merge them into the 
main source tree.

If I'm still around when POV-Ray 3.6 is released and it's still not 
VS.NET 2003 compatible, I'll update this document.

-Ryan


Post a reply to this message

From: Chris Cason
Subject: Re: POV-Ray 3.5 & VS.NET 2003
Date: 12 Mar 2004 03:19:31
Message: <40517293@news.povray.org>
"Ryan Lamansky" <Spa### [at] kardaxcom> wrote in message
news:405121c3$1@news.povray.org...

>If I'm still around when POV-Ray 3.6 is released and it's still not VS.NET 2003
>compatible, I'll update this document.

The current 3.6 beta (http://www.povray.org/beta/) is built with VS.NET 2003.

regards,

-- Chris


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: POV-Ray 3.5 & VS.NET 2003
Date: 12 Mar 2004 07:56:35
Message: <4051b383@news.povray.org>
In article <405121c3$1@news.povray.org> , "Ryan Lamansky" 
<Spa### [at] kardaxcom> wrote:

> If I'm still around when POV-Ray 3.6 is released and it's still not VS.NET
> 2003 compatible, I'll update this document.

This has alreday been discussed:

From: "JenniferJ" <nomail@nomail>
Date: Wed,  7 Jan 2004 14:58:11 EST
Newsgroups: povray.unofficial.patches
Message-ID: <web.3ffc64d3e05b701c9fd50ea0@news.povray.org>
Subject: Support VC .NET
Xref: news.povray.org povray.unofficial.patches:9082

<http://news.povray.org/*/thread/%3Cweb.3ffc64d3e05b701c9fd50ea0%40news.povr
ay.org%3E/>

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Ryan Lamansky
Subject: Re: POV-Ray 3.5 & VS.NET 2003
Date: 12 Mar 2004 12:10:45
Message: <4051ef15$1@news.povray.org>
"Chris Cason" <new### [at] deletethispovrayorg> wrote in message
news:40517293@news.povray.org...
>
> "Ryan Lamansky" <Spa### [at] kardaxcom> wrote in message
news:405121c3$1@news.povray.org...
>
> >If I'm still around when POV-Ray 3.6 is released and it's still not
VS.NET 2003
> >compatible, I'll update this document.
>
> The current 3.6 beta (http://www.povray.org/beta/) is built with VS.NET
2003.
>
> regards,
>
> -- Chris

Great :-)

-Ryan


Post a reply to this message

From: Ryan Lamansky
Subject: Re: POV-Ray 3.5 & VS.NET 2003
Date: 12 Mar 2004 12:16:04
Message: <4051f054$1@news.povray.org>
Discussed, perhaps.  But not resolved, the way I see it.

There's no doubt in my mind that the default VS.NET 2003's C++ compiler is
sub-par, but it can be made to work with POV-Ray with minimal difficulty, so
I did. The fact that the code it produced is about 5% faster than the
POV-Ray 3.5 official release is interesting, but I presume POV-Ray 3.6 is
compiled with a newer version of Intel's compiler, so it should regain the
lead.

-Ryan


Post a reply to this message

From: Slime
Subject: Re: POV-Ray 3.5 & VS.NET 2003
Date: 12 Mar 2004 14:50:17
Message: <40521479$1@news.povray.org>
> There's no doubt in my mind that the default VS.NET 2003's C++ compiler is
> sub-par

Why's that?

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

From: Ryan Lamansky
Subject: Re: POV-Ray 3.5 & VS.NET 2003
Date: 17 Mar 2004 09:57:13
Message: <40586749$1@news.povray.org>
Though I have a strong undestanding of C++ syntax, I have minimal experience
(C# is my specialty).

Over the past two years I have seen nearly all praise toward VS.NET's C++
implementation paired with an equal amount of criticism.  Even though I'm
not very experienced with it, I trust in the opinions of so many others.

I want to be good at C++, as it has some important advantages over C#.  A
big part of my reasons for modifying POV 3.5 to work with VS.NET 2003 is to
start building up my C/C++ experience.  I have since spent a lot of time
studying the code.  (I think the x_FIELDS-style macros are
brilliant--they're used to provide a degree of object-oriented programming
in C.)  I've already had some ideas for performance optimizations, but I'll
need to gain a better understanding of the big picture before I can safely
try anything.

-Ryan

"Slime" <slm### [at] slimelandcom> wrote in message
news:40521479$1@news.povray.org...
> > There's no doubt in my mind that the default VS.NET 2003's C++ compiler
is
> > sub-par
>
> Why's that?
>
>  - Slime
> [ http://www.slimeland.com/ ]
>
>


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: POV-Ray 3.5 & VS.NET 2003
Date: 17 Mar 2004 15:33:29
Message: <4058b619$1@news.povray.org>
In article <40586749$1@news.povray.org> , "Ryan Lamansky" 
<Spa### [at] kardaxcom> wrote:

> I want to be good at C++, as it has some important advantages over C#.  A
> big part of my reasons for modifying POV 3.5 to work with VS.NET 2003 is to
> start building up my C/C++ experience.  I have since spent a lot of time
> studying the code.

Well, the POV-Ray source code is definitely not a good example of C++ code.
Even the C used could be better given the almost two decades the oldest
parts are old now.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Ryan Lamansky
Subject: Re: POV-Ray 3.5 & VS.NET 2003
Date: 19 Mar 2004 08:46:41
Message: <405af9c1@news.povray.org>
> Well, the POV-Ray source code is definitely not a good example of C++
code.
> Even the C used could be better given the almost two decades the oldest
> parts are old now.

Cause and Effect.

Despite any deficiencies, POV-Ray is unique among all C programs.  Few are
as aged, fewer are open-source to any degree, and none produce the
visually-amazing results.  I think it's something that any contributer
should be proud of :-)

For these reasons, POV-Ray interests me more than any other C application
out there.

-Ryan


Post a reply to this message

From: Luis Fernando
Subject: Re: POV-Ray 3.5 & VS.NET 2003
Date: 2 May 2004 16:10:01
Message: <web.40955508c2ea3d5c697c007d0@news.povray.org>
Regards Ryan

Was usefull the instructions given to compile for VS NET2003, we do it and
everithing works fine, i hope you can help me with this issue, where in the
source code can i redefine the project as a win32 console mode project ,
with the intention to not display any window, and only save the rendered
file as operating in background mode, can be done this ??

Thanks in advance for yout attention, i hope you answer my question.

Att.
Luis Vargas
Guayaquil - Ecuador


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.