22 10月 2010

'GL_BGR' : undeclared identifier

During the implementation of homework #02, I think it's better to be familiar to Picture Drawing and Texture Mapping first.


When I use the GL_BGR in "glDrawPixels()", it appear this compile error from VC++.


Solution is : 
try GL_BGR_EXT if it still dosnt work, you need to download updated GLext.h files from SGI or nVidia/ATi devloper relations. 
 by Silvermace in the GameDev Forum.

Why did we need to use GLext.h???  The OpenGL Website says:

Core API and Extension Header Files
Because extensions vary from platform to platform and driver to driver, OpenGL developers can't expect interfaces for all extensions to be defined in the standard gl.hglx.h, and wgl.h header files. Additional header files - glext.h,glxext.h, and wglext.h - are provided here
Why  did we need to use BGR instead of RGB ??
Because the actual storage format of each pixel in Windows system is BGR, not RGB.
Just a debug record.
 

Let's get the show on the road.

The course is still there...
The homework is still there... 
Some years went past, and I'm ready to try it again.


When fell over on graduate school, 
I didn't even know what "runtime", "callback function", and "instance" is..
So rookie on programming, that's my second year to the software world.


I believe I CAN.
----------------------------------------------------------------------------------------------------


The homework: You are required to do the following things in homework #1: 



  • Load a 3D model file of TRI format.
    Draw it in wireframe mode and view it in perspective view.
     
  • You should provide object rotation mode and camera rotation mode, and implement basic transformations such as rotation, translation, scaling and shear. 
  • The camera (eye) can be moved around and into the model. 
  • Clipping is required. Try to show the difference between clipping and non-clipping. 
  • ** You can not use functions gluPerspective and glFrustum !!  
And the course website is here, Interactive Computer Graphics in National Taiwan University.   


Final, I complete the homework again. This time I did that after reading some chapters of several books, instead of just copy one example code content of some Chinese book.


------------------------------------------------------------------------------------------------
Post this article after the due date of the homework this year may be more appropriate. 
Hope this helps some people that hesitate to or shy of asking questions to TAs.

05 10月 2010

[Extract] set up environment for OpenGL and GLUT on VC++ 2010 Express

Those steps are extracted from the good blog Here! and Here!, written by Nafee M Sadh's.
Write records here just for fear that if the original blog is removed someday.


Key Steps to create Win32 console application:

  • Select "Empty Project" in the wizard dialog.
  • In the Project Property, Configuration Properties  Linker  Input, Type “opengl32.lib;glu32.lib” in Additional Dependencies.
  • For above step, remember to select the "All configurations" to set the debug and release environment at the same time.

Key Step to set up GLUT environment:


  • Download the original GLUT library from Nate Robins’ site. (for my case, the zip package will generate one .h file, two .lib files, two .dll files after upzipped.) 
  • put the files as below: (VS2010) ( I copy these three lines form the original blog..)
    glut.h to the folder C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl\
    glut32.lib to the folder C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\
    glut32.dll to the folder C:\Windows\System32\
Try it, and don't forget to visit the original blog for more useful information. :P