Back to 6 years before, I took a class in my school call "3D max Design"
which is my first time using CAD tool
still remember I were running in 256~512MB Pentium 3 computers which usually lag and freeze....
after that class I left opengl behind...
主題介紹
What is OpenGL? Why Glut?
OpenGL (Open Graphics Library) is a standard specification defining a cross-language, cross-platform API for writing applications that produce 2D and 3D computer graphics.
Glut is a free utility which support OpenGL. There are different version which can finish your project or start your program in different OS, including Win, Mac, Unix, Android system.
程式設計與寫作方法、執行結果呈現
助教您好,程式利用不同函式庫,如在您電腦上跑不動,請直接找我!!!!!
Homework requirement:
build a 2D model structure
Extra Finish part (Version alpha1):
- C struct
- 3D model structure
- lighting
- special effect + depth of field effect
- auto 360 rotate
- swap cache
- Multithread in CPU
- allow manual window resize
- F1 fullscreen, Esc to leave
Demo Video of Version alpha1
(Ram used <19MB CPU usage<1% GPU used 7% @ Core 160Mhz & Ram 250Mhz )
useage including "camera recording"
Code line: 508 Finished in 10, March (one week before deadline)
OpenGL3.2, Intel Q9450, Vapor-X HD 4850, 2GB RAM(only use 2GB for testing)
Coming Version: alpha2 already coding for few days
- C++ class & C struct
-
Multithread Highly Anti-aliasing
- free move camera
- Fully Error message
- Lock Framerate
- stable & less memory allocate (spend me too much time on it)
- Minimize CPU&GPU usage(not finish)
心得與討論
The hard part of the homework is the structure part specially the stairs one it's not easy to make it connection well with other part
Dev-c++ ERROR LIST(which i face in developing my homework):
Problem 1 - MinGW
If Devc++ library including MinGW(default set in Devc++ after you install it with MinGW)
which will make an error say can't find function in MinGW
to fix this go to compiler options -> Directories -> Libraries delete everything on the list
which Force devc++ serach library in default directory
Problem 2 - Fail to upgrade devc++
To solve thisdownload glut-src and copy files to /lib, it works
Other way to solve the problem is to uninstall and then remove Devc++ and it directory
but be careful!!!!!all you path such as libraries may go wrong or gone after you reinstall!!!!
problem 3 - Linker ERROR & std error & GLUT_ATEXIT_HACK error & In function `_mingw_CRTStartup': Linker Error........
made you you got these in front of everything
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glut.h>
#define GLUT_DISABLE_ATEXIT_HACK
Everytime when you start new project
Go to Project -> Project Options -> Parameter -> linker
both works for C or C++
copy the bold text and paste them to linker, a space must between each linker
check the all *.a file path in your hard drive before you add it!!!
if compiler shows "could not find -xxxxx" means you didn't have the library file,
wrong word or in a wrong directory...
below are
poplar library using in OPENGL program
-lglaux -lmingw32 -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32
-lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lglut32 -lglu32 -lopengl32 -lm -lwinmm -lstdc++
extra library
-lglew32 -lglew32s
lib/libglu32.a lib/libglut.a lib/libglut32.a lib/libopengl32.a
if you using
GLM library plz add these
if you using
QT library plz add these
if you using QGLViewer library plz add these
if you using
freeglut library plz add these
lib/libfreeglut.a
if you using
sfml library plz add these
-lsfml-graphics -lsfml-window -lsfml-audio -lsfml-system
if you using
SDL plz add these
-lSDLmain -lSDL -lSDL_image
Download libraries
GLM library http://glm.g-truc.net/ http://glm.g-truc.net/glm.pdf
QT library http://qt-project.org
freeglut library http://freeglut.sourceforge.net
Problem 4- [Linker error] undefined reference to `Initialize(GL_Window*, Keys*)' or [Linker error] undefined reference to `Deinitialize()'
This is maybe not missing a linker is missing Initialize or Deinitialize function, those fuction must be inside your main.cpp not only .h
Problem 5 - Code are right compiler show Multiple Definition
delete all .a and .o file compile again
Problem 6 - Code are right compiler show build error 1
solve: remove the project create a new project and add the old files back,
include a wrong linker may cause this problem
Problem 7 - glut32.dll missing when excult .exe file
a easy way is copy glut32.dll from glut-src(download from http://user.xmission.com/~nate/glut.html ) and paste to same directory under .exe,
you can find the missing dll here http://www.dll-files.com/
Problem 8 - only this error message " .drectve `-aligncomm:"___hexdig_D2A",5' unrecognized "
Ignore it your .exe file already compile
Problem 9 - error message "The procedure entry point glRotatef could not be located in the dynamic link library OPENGL.dll (无法定位程序输入点glRotatef与动态链接库oengl.dll) " when execute .exe
Check your linker in project option
Delete this in the linker list -lglut, /lib/libglut.a and replace it with -lglut32 and /lib/libglut32.a
Thanks for Google
hope Devc++ will have update which latest version is 4.9.9.2 release 7 years before...... :-(