20 7月 2010

[VS2005] error C3861: 'exit': identifier not found

when I try to use some example codes of OpenGL, I'll sometimes get the compile error
"error C3861: 'exit': identifier not found" from the keyboard subroutine:


  • void keyboard(unsigned char key, int x, int y){
  • switch(key){
  • case 27:
  • exit(0);
  • break;
  • }
  • }

Finally, I found the solution that is to add the include information on the top of the cpp file.
#include < stdlib.h >

The original discussion thread is from Windows Forums, and solution is provided by Brian Kramer.

19 7月 2010

Use VS2005 on Windows7

VS2005 is my primary IDE to coding on C\C++, OpenGL. When I install it on Win7, the conflict appears. 
This is the first time that I felt the official suggestion so powerful.
According to the steps as below, I can use the VS2005 right now.

First, I install the service pack 1 of VS2005 for WinXP. Present file version is:
VS80sp1-KB926601-X86-ENU.

Then the second step, 
install the service pack for Vista or later Windows OS. Present file version is: 
VS80sp1-KB932232-X86-ENU.

I have tried it and it does work! so blog this for you or me in the future.

07 7月 2010

How to post source codes onto blogger

when I want to post the practice result of OpenGL to my Blogger, I google some websites and find a 'okay' method for the previous post.

Chinese guidance: 

在Blogger內貼source code

And a interpreting platform: 
It works, use this first. 

little practice of two viewports

Practice of "Try this" in Red-Book chapter 3.

Target: 
Modify an existing program so that an object is drawn twice, in different Viewports.

Answer:
void reshape (int w, int h)
{
   glClear (GL_COLOR_BUFFER_BIT);
   glColor3f (1.0, 1.0, 1.0);
   
   glViewport (0, 0, (GLsizei) w/2, (GLsizei) h);
   glMatrixMode (GL_PROJECTION);
   glLoadIdentity ();
   glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
   glMatrixMode (GL_MODELVIEW);
   glLoadIdentity (); 
   gluLookAt (0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
   glScalef (1.0, 2.0, 1.0);      /* modeling transformation */ 
   glutWireCube (1.0);

   glViewport ((GLsizei) w/2, 0, (GLsizei) w/2, (GLsizei) h);
   glMatrixMode (GL_PROJECTION);
   glLoadIdentity ();
   glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
   glMatrixMode (GL_MODELVIEW);
   glLoadIdentity (); 
   gluLookAt (0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
   glScalef (1.0, 2.0, 1.0);      /* modeling transformation */ 
   glutWireCube (1.0);

    glFlush ();
}

Another amazing OpenGL project.

Again, after a hard and tired study, an amazing project will appear on my monitor, let me stick here and can't speak out how shock I felt.


This OpenGL project is made by Nate Robins. I knew this project from the so-called Red-book of OpenGL programming, OpenGL programming guide 7th edition.


How beautiful tool to demo some basic theories of OpenGL APIs, like transformation and lighting.



If you like OpenGL, just go to download and try it.
maybe you'll pronounce a voice of "WoW"..like I did few minutes ago.  :P

error: VS2005 MSVCR80D.dll

This isn't first time I run into this error: "can't find msvcr80d.dll" when I try to use the simple C code from books' author.
In the past, I only knew that came from IDE's version difference. But haven't tried to solve it. ( I use Visual studio 2005 )

I found the good solutions for this issue.   /* Original Post */

One of solutions I used and have proved it to be workable:
=> Change the project's location from FAT disk to NTFS.  

(Thanks the biggest NB company Q gave me a old enough NB with FAT disk.. :(  )

other solutions from the original website are as below but NOT be verified yet!!!
1.)  project properties-->manifest tool-->input and output-->Embed manifest--> choose NO.--> rebuild.
2.) manifest tool-->General Item-->Use Fat32 work-around-->YES.-->rebuild.