2012年3月31日 星期六

hw2 - 技術為先,美感後現 (update 1)

主題介紹
Using opengl to implement building 1


程式設計與寫作方法、執行結果呈現
Homework requirement:
  building 1 - 3D model structure

Extra Finish part (Version alpha2,  basic on alpha 1.0, new main function):
   - C++ class & C struct (during gl is not O.O. )
  - Texturing
  - lighting
  -  special effect + depth of field effect
  - Multi-thread Highly Anti-aliasing
   - F1 full screen, Esc to leave
  - free move camera
  - Lock Frame-rate
   - swap cache
   - Multi-thread in CPU with Minimize CPU&GPU usage
  -  Error message
  - stable & less memory allocate




Demo Video of Version alpha2
 (Ram used < 20.7 MB CPU usage< 25 % GPU used 0 % @ Core 160-500Mhz & Ram 250Mhz )
useage including "camera recording"
Code line: 1209 Finished in 20, March
  OpenGL 3.2, Intel Q9450, Vapor-X HD 4850, 4GB RAM
blogger decrease my video quailty


Version alpha 2.5 (using module of alpha 2.0, including new library, new main function)
 - 3D cloud and sky (cloud position and height are random)
 - live time sky system (if you set different time, sky will be not the same)
  - allow manual window resize



Demo Video of Version alpha2.5
 (Ram used < 71.6 MB CPU usage< 25 % GPU used 0 % @ Core 160Mhz & Ram 250Mhz )
useage including "camera recording"
Code line: 3,497(including library header) - Finished in 22, April
OpenGL 3.2, Intel Q9450, Vapor-X HD 4850, 4GB RAM
blogger decrease my video quailty

Alpha 2.5 sky system



To 助教:  如果缺少library, 至版本2.5沒法compile,  請看我在portal 上載的檔案
(共有3個, 最後一個為上面影片的原始畫質檔)

心得與討論 
This homework free move camera is available, by unknown reason it didn't work on my previous main function. In order to express my sincerity, write a new main function...

There are library allow us to run the program in multi-GPU, but only support Nvidia, SGI those factory standard graphic card. Also there is no multi-GPU VGA card on my hard...

My next idea is using VGA graph Acceleration, which mean run it in graphic card

2012年3月10日 星期六

Homework 1 -Hi my old friend OpenGL


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...... :-(

2012年3月3日 星期六

class 1 study OpenGL via GLUT + import 3D max model

we have start write C program using Dec-C++
including GLUT library ( http://www.opengl.org/resources/libraries/glut/ )

teacher add web links about Dreamwork, workstation graph cards

In the class i have a question
"Using program is not easy way to 'draw' a details 3D model and texturing"
then i search about connections with OpenGL and Autodesk 3D max
i found out we can using openGl to import 3D max model which means problem solve!!