Click to see the big picture and try to port the engine to Linux over the past two days. It is still quite effective that I have used the Linux system to generate the Ubuntu9.04 engine project using makefile, the code: blocks is used to test the project diagram. For details about how to write makefile, we will not detail the porting process and some tips. First, write the makefile, use apt-get to install the dependent library file (if any. Here, fre is used for my project.
Click to view the chart
The attempt to port the engine to Linux over the past two days is still quite effective.
My Linux system is Ubuntu 9.04
The engine project is generated using makefile, and the code: blocks is used to test the project diagram. How to Write makefile is not described in detail here.
The porting process and some experiences will be shared with you:
First, write the makefile and use apt-get to install the dependent library file (if any. Here, freeimage, freetype, OIS and so on are used in my project)
Make once to see what problems
For example, if the Windows header file is referenced and the Win32 function is called, it is defined as "isolated" by the platform macro. What is implemented in linux is left blank.
Rendering forms and Renderer should be two relatively independent concepts in the engine, which are implemented separately.
In Linux, I used the X11 function to create a rendering form. Here I encountered a conflict between the definition of X11 and freetype, and finally handled it like this:
View plaincopy to clipboardprint?
··· · 50 ······· · 90 ····· · 140 · 150
# If defined _ PLATFORM_LINUX
Namespace X11 // prevent the type name of X11 from conflict with FreeType
{
# Include
# Include
# Include
# Include
}
# Endif // # if defined _ PLATFORM_LINUX
# If defined _ PLATFORM_LINUX
Namespace X11 // prevent the type name of X11 from conflict with FreeType
{
# Include
# Include
# Include
# Include
}
# Endif // # if defined _ PLATFORM_LINUX
Use a namespace to include the entire X11 definition, and add the "X11:" prefix to future calls.
The OpenGL Renderer is dynamically loaded in the form of dll under Win32, And the so file is generated in linux.
Note that do not use the ld command instead of g ++ to generate the so file, otherwise, an "undefined symbol _ dso_handle" error will be generated when the so file is called (this problem has plagued me for a while, it is mainly caused by unfamiliar compilation in linux: P)
In the OpenGL Renderer, The glx function is used to replace the wgl function of win32. The main functions are the initialization, destruction, and SwapBuffers of the Renderer.
Note that g ++ and vs are different in terms of syntax. I encountered an example of the declaration of template instantiation.
Basically, my code will be able to run.
This article is from the CSDN blog. For more information, see the source:Http://blog.csdn.net/aosyang/archive/2009/08/23/4474261.aspx