Use Ogre for game development in vc6

Source: Internet
Author: User





Visual c ++ 6.0 developed by Microsoft is the most easy-to-use and mature development tool in history. Vc6 has won the favor of programmers with its small and light sizes. In the age of Vs, many programmers still use vc6 as a development tool. The popularity of vc6 is evident. Unfortunately, vc6 has a disadvantage, that is, it cannot develop ogre applications. The link for online tutorials is outdated. I also searched for a lot of information and finally configured it almost all morning, but still failed several times, but it does not affect the overall situation.
Ogre is an extremely complex project. It uses many third-party libraries, such as boost and stlport. Therefore, compiling ogre is also a complicated process. Especially in vc6, the lack of stlport support makes it necessary to re-compile the stlport library. Of course, the DirectX SDK issue is also involved.
Complete list:
Stlport 4.6.2
DirectX sdks 8.0 & 9.0
Ogre 1, 0.13
Ogre depencies 0.13
Therefore, ogre compilation is divided into three parts.
I. Compile stlport
Stlport is an extension library of VC. It is integrated into VC only after vc7, vc.net. That is to say, vc6 does not support stlport, so we have to let it support it on our own.
Go to the stlport official website http://www.stlport.org/to download the stlportdatabase. Here I use 4.6.2. Decompress the package to a directory, such as D: \ stlport. Click Start-run, type cmd, open the command prompt, switch to the $ stlport_dir \ src directory, type "nmake-F vc6.mak", and compile stlport. Note: before running the command, make sure that the nmake path is added to the environment variable. It does not matter if it is not added. Go to the VC installation directory, which contains vc98-"bin, drag vcvars32.bat in the bin folder to the Command window, and press enter to set the nmake path. Wait a few minutes and the compilation is complete.
2. Install DirectX SDK
Install DirectX x. x SDK (X indicates the version number) instead of DirectX aug08. Vc6 only supports version 8.0 or 9.0 and does not support later versions. (I do not know when I compiled It. I Got DirectX aug08 and made a lot of errors.) refer to the article blog.csdn.net/asasj57/article/details/5641161 on csdn.
The installation behind the download is not easy to explain. Simply extract the package and run setup.exe to install it.
3. Compile ogre
Now the most critical thing is to download the Ogre 0.13 and ogre0.13 dependent libraries from the Ogre official website. Decompress the downloaded ogre file to a folder, such as D: \ ogresdk. Decompress the Ogre dependency, copy the dependencies and samples folders to ogrenew, and overwrite the folders with the same name. Open the project file ogre. DSW in ogrenew.
Select Tools-opyions, open the Options dialog box, switch to the directories tab, and configure include files and library files respectively.
Include files:
1. installation directory of c: \ dxsdk \ include \ DirectX 9.0
2. D: \ ogresdk \ ogrenew \ ogremain \ include
3. D: \ ogresdk \ ogrenew \ dependencies \ include
4. D: \ stlport
PS: the order of these items must not be wrong. Otherwise, some inexplicable problems may occur.
Library files:
1. c: \ dxsdk \ Lib \ DirectX 9.0 installation directory
2. D: \ ogresdk \ ogrenew \ ogremain \ Lib \ debug
3. D: \ ogresdk \ ogrenew \ dependencies \ Lib
4. D: \ stlport \ Lib
Similarly, the order cannot be changed.
As for whether to install DirectX 8.0, it is recommended that you install it to avoid unnecessary errors. After the installation is complete, add the include folder and Lib folder to the last one in the vc6 directory. Now there is no problem. Click the build menu-> batch build, select build in the displayed dialog box, and then ogre starts automatic compilation.

In my case, after compilation, several projects failed, and all of them were prompted.

[Plain]View plaincopy
  1. D: \ stlport \ STL \ type_traits.h (361): Fatal error c1076: Compiler limit: Internal heap limit reached; Use/ZM to specify a higher limit

I don't know if this is a problem with the stlport version. Please feel free to contact me. But thanks to these errors, we can continue.

After more than 20 minutes, the ogre compilation is complete. Let's verify whether the compilation is successful.
Create a Win32 console application project named ogre demo. Select an empty project and click Finish.
Configure our project: select project-> Settings, open the project option dialog box, switch to the link tab, select input in the category list box, and enter ogremain in the text box below. lib (do not include _ d. The static link library we compiled does not contain _ d ). Enter libcd. Lib in the following ignore libraries and click "OK.
In fact, it is best to enter the DLL and Lib paths after your ogre compilation in the working directory, which is generally $ ogre_dir \ samples \ common \ Debug. Of course, if it is a release version, enter release. In this way, you do not need to copy this file to that directory every time you generate an EXE file. (According to the author: although this is more convenient, it will always lead to some inexplicable errors through the author's test)
Now let's continue our test. Create a CPP file and type the following code in it:

class test : public ExampleApplication  {  public:      void createScene()      {          mSceneMgr->setAmbientLight(Ogre::ColourValue(1,1,1));            Ogre::Entity *ent=mSceneMgr->createEntity("head","robot.mesh");          Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();          headNode->attachObject(ent);      }  };  int main()  {      test app;      app.go();      return 0;  }  

If nothing happens, a robot is displayed on the screen.

So far, our ogre compilation is successful.

-------------------------------------------------------------------------

Conclusion:

Although there are several projects that have not been compiled successfully, they are mainly focused on those tools, such as xmlconver, milkshapeexporler, meshupgrader, and matrialupgrader. However, after some exploration, the compilation was successful. The specific method is as follows: The following errors are commonly prompted for these projects,

D: \ stlport \ L \ type_traits.h (361): Fatal error c1076: Compiler limit: Internal heap limit reached; Use/ZM to specify a higher limit

The solution is simple. Right-click the project that has not been compiled, for example, milkshapeexporler, select Settings, open the Project Settings dialog box, and type "/zm500" in project options ", then click "OK" to complete the settings and finally compile... Successful!

Use Ogre for game development in vc6

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.