I see a lot of the same questions asked in these forums. I also know online examples don’t always give a clear picture of how to do something. Nothing like clean, well commented code to help you see how it is done. This engine only uses OpenGL as a rasterizer, everything else is in software. You did want to learn the hard way, didn’t you? Not to worry, it’s not all that hard.
Loading models, lighting, textures and collision/reaction are just a few things it does. You can use BMP, tga, gif & jpg for your textures. The example has you running through a simple map FPS style. I wrote a program that parsers Wavefront OBJ files and makes native files the engine loads so your free to design complicated models for easy loading.
Going through the door ways is a little sticky. Need to design the door ways a little differently. For this simple example, it will do for now.
There’s a file by the name of “File description.txt” that describes each file in the zip. Have fun.
Originally posted by howie:
[b]I see a lot of the same questions asked in these forums. I also know online examples don’t always give a clear picture of how to do something. Nothing like clean, well commented code to help you see how it is done. This engine only uses OpenGL as a rasterizer, everything else is in software. You did want to learn the hard way, didn’t you? Not to worry, it’s not all that hard.
Loading models, lighting, textures and collision/reaction are just a few things it does. You can use BMP, tga, gif & jpg for your textures. The example has you running through a simple map FPS style. I wrote a program that parsers Wavefront OBJ files and makes native files the engine loads so your free to design complicated models for easy loading.
Going through the door ways is a little sticky. Need to design the door ways a little differently. For this simple example, it will do for now.
There’s a file by the name of “File description.txt” that describes each file in the zip. Have fun. [/b]
Unfortunately, I use OpenGL with Cygwin. Is there any easy way to modifiy your codes such that I can use them with cygwin?
I don’t know what Cygwin is but yes, this would be very easy. The 3D library files are kept general and are not tied to anything. The file “Example.cpp” is for working with Windows and the 3d Library files. Ignore the Window handling parts and look at how the 3D library files are used (CMeshTri, CTextureLib, CLightList, CMatrix).
Specificly look at functions…
InitGLwindow()
LoadGameObjects()
GameLoop()
RenderBuffer()
ReactToCollision()
GetUserImput()
in Example.cpp
This engine is all code. No LIB’s and DLL’s are used. Spend some time going over Example.cpp, going through the code, reading the comments. Then work you way through the 3D library files the same way to get a feel for how all this is done.
Could be. I’m not sure. Good C++ design suggests all data needs to be protected and only set via class functions. Speed is everything in our field so making some variables public helps in the speed department.
Originally posted by howie: I don’t know what Cygwin is but yes, this would be very easy. The 3D library files are kept general and are not tied to anything. The file “Example.cpp” is for working with Windows and the 3d Library files. Ignore the Window handling parts and look at how the 3D library files are used (CMeshTri, CTextureLib, CLightList, CMatrix).
cygwin is a *NIX like implement on MS Windows.
Usually, a project under Linux has a Makefile for compiling. You sources don’t have a Makefile. I don’t know to compile it. What compile options do you use?
Originally posted by howie: Could be. I’m not sure. Good C++ design suggests all data needs to be protected and only set via class functions. Speed is everything in our field so making some variables public helps in the speed department.
You could use inline functions to set and get protected variables. Then you have clean C++ code and speed.
ypsd, maybe you can write a conversion as an exersize!
Thanks! The conversion code is there. The file is “CObjParser.cpp”. Parsing a text based file format is not that hard, it just gets messy fast.
You could use inline functions to set and get protected variables.
There is overhead in calling a function, even if it is inline. The way an inline is compiled down to assembly differs from compiler to compiler and sometimes it’s handled like a regular function. The variables that I made public are usually arrays and we are only talking about a few of them.
I uploaded a new zip file with some changes. All the code for the converter is there.
Originally posted by howie: There is overhead in calling a function, even if it is inline. The way an inline is compiled down to assembly differs from compiler to compiler and sometimes it’s handled like a regular function. The variables that I made public are usually arrays and we are only talking about a few of them.
It depends on your compiler settings. Only using the inline-keyword in the code won’t help.
I just made a little sample with VC++ with a class variable d which is set/get via functions and as comparison directly (variable is public). The assembler code is the same:
For this engine, since the main goal is to show how things are done, I don’t want to hide the data too much. It’s easer to see how it works when the implemintation is not hidden.