Wednesday, June 22, 2011
Tuesday, June 21, 2011
Free C and C++ books
(http://www.lighthouse3d.com/2011/06/free-c-and-c-books/)
Some freely available books, some out of print, some still available in online stores, others in plain HTML.
Thinking in C++ 2nd Edition (2 Volumes) by Bruce Eckel - This is probably the most famous one. There is also a printed version on sale.
An Introduction to GCC, by Richard M. Stallman - A GNU C and C++ manual for those who want ot get started with the GNU compilers, gcc and g++.
Nectarine City Handbook of C Programming Style by Joseph Miklojcik – A book on writing clear code.
The C Book by Mike Banahanm Declan Brady and Mark Doran – The online version of “The C Book”, published by Addison Wesley in 1991 (no longer in print)
Introduction to C Programming by Rob Miles – A online introductory C book.
C Elements of Style by Steve Oualline – Building good programming style
C++ Annotations by Frank B. Broken – Moving from C to C++
Some free books. (like OpenGL® Shading Language, Third Edition)
http://my.safaribooksonline.com/book/programming/opengl/9780321669247/firstchapter#X2ludGVybmFsX0ZsYXNoUmVhZGVyP3htbGlkPTk3ODAzMjE2NjkyNDcvMTg2
Some free books.
http://citizen428.net/archives/434
Some freely available books, some out of print, some still available in online stores, others in plain HTML.
Thinking in C++ 2nd Edition (2 Volumes) by Bruce Eckel - This is probably the most famous one. There is also a printed version on sale.
An Introduction to GCC, by Richard M. Stallman - A GNU C and C++ manual for those who want ot get started with the GNU compilers, gcc and g++.
Nectarine City Handbook of C Programming Style by Joseph Miklojcik – A book on writing clear code.
The C Book by Mike Banahanm Declan Brady and Mark Doran – The online version of “The C Book”, published by Addison Wesley in 1991 (no longer in print)
Introduction to C Programming by Rob Miles – A online introductory C book.
C Elements of Style by Steve Oualline – Building good programming style
C++ Annotations by Frank B. Broken – Moving from C to C++
Some free books. (like OpenGL® Shading Language, Third Edition)
http://my.safaribooksonline.com/book/programming/opengl/9780321669247/firstchapter#X2ludGVybmFsX0ZsYXNoUmVhZGVyP3htbGlkPTk3ODAzMjE2NjkyNDcvMTg2
Some free books.
http://citizen428.net/archives/434
Monday, June 20, 2011
OpenGL Depth Test
(http://glprogramming.com/red/chapter10.html)
The depth buffer is generally used for hidden-surface elimination. If a new candidate color for that pixel appears, it's drawn only if the corresponding object is closer than the previous object. In this way, after the entire scene has been rendered, only objects that aren't obscured by other items remain. Initially, the clearing value for the depth buffer is a value that's as far from the viewpoint as possible, so the depth of any object is nearer than that value. If this is how you want to use the depth buffer, you simply have to enable it by passing GL_DEPTH_TEST to glEnable() and remember to clear the depth buffer before you redraw each frame. (See "Clearing Buffers.") You can also choose a different comparison function for the depth test with glDepthFunc().
Depth Test
For each pixel on the screen, the depth buffer keeps track of the distance between the viewpoint and the object occupying that pixel. Then if the specified depth test passes, the incoming depth value replaces the one already in the depth buffer.The depth buffer is generally used for hidden-surface elimination. If a new candidate color for that pixel appears, it's drawn only if the corresponding object is closer than the previous object. In this way, after the entire scene has been rendered, only objects that aren't obscured by other items remain. Initially, the clearing value for the depth buffer is a value that's as far from the viewpoint as possible, so the depth of any object is nearer than that value. If this is how you want to use the depth buffer, you simply have to enable it by passing GL_DEPTH_TEST to glEnable() and remember to clear the depth buffer before you redraw each frame. (See "Clearing Buffers.") You can also choose a different comparison function for the depth test with glDepthFunc().
- void glDepthFunc(GLenum func);
- Sets the comparison function for the depth test. The value for func must be GL_NEVER, GL_ALWAYS, GL_LESS, GL_LEQUAL, GL_EQUAL, GL_GEQUAL, GL_GREATER, or GL_NOTEQUAL. An incoming fragment passes the depth test if its z value has the specified relation to the value already stored in the depth buffer. The default is GL_LESS, which means that an incoming fragment passes the test if its z value is less than that already stored in the depth buffer. In this case, the z value represents the distance from the object to the viewpoint, and smaller values mean the corresponding objects are closer to the viewpoint.
OpenGL Transformation
http://www.songho.ca/opengl/gl_transform.html
GL_PROJECTION matrix and GL_MODELVIEW matrix
GL_PROJECTION matrix and GL_MODELVIEW matrix
GLUT intro.
OpenGL Utility Toolkit (GLUT)
- http://www.xmission.com/~nate/glut.html
- Ver: 3.7.6 (Nov 8, 2001)!
- Init GLUT and create window
// init GLUT and create window
glutInit(&argc, argc);
glutInitWindowPosition(1,1);
glutInitWindowSize(640, 480);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("CreateWindow");
// register callbacks
glutDisplayFunc(renderScene);
// enter GLUT event processing cycle
glutMainLoop();
}
void renderScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex3f(-.5, -.5,0);
glVertex3f(.5, 0,0);
glVertex3f(.0, .5,0);
glEnd();
glutSwapBuffers();
}
- The render function and callback registration
- GLUT event processing loop
Preparing the window for a reshape
- By default the perspective assumes that the ratio width/height is 1 and draws accordingly. So when the ratio is changed the perspective gets distorted. Therefore, every time the ratio changes the perspective needs to be recomputed.
- GLUT provides a way to define which function should be called when the window is resized, i.e. to register a callback for recomputing the perspective. Furthermore, this function will also be called when the window is initially created so that even if you’re initial window is not square things will look OK.
void changeSize(int w, int h)
{
if (h == 0)
h = 1;
float ratio = 1.0 * w / h;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, w, h);
gluPerspective(45, ratio, 0.0, 100);
glMatrixMode(GL_MODELVIEW);
//glLoadIdentity();
}
Animation
- The first thing we must do is to tell GLUT that when the application is idle, the render function should be called. This causes GLUT to keep calling our rendering function therefore enabling animation. GLUT provides a function, glutIdleFunc, that lets you register a callback function to be called when the application is idle.
Saturday, June 18, 2011
Decompose Homography
http://urbanar.blogspot.com/2011/04/from-homography-to-opengl-modelview.html
https://gist.github.com/740979/97f54a63eb5f61f8f2eb578d60eb44839556ff3f
http://cobweb.ecn.purdue.edu/~kak/courses-i-teach/ECE661/
http://www.daesik80.com/matlabcode/matlabcode.htm
http://www.clemson.edu/ces/crb/students/vilas/index.htm
http://opencv-users.1802565.n2.nabble.com/Getting-R-and-T-from-homography-or-Fundamental-matrixes-td2319709.html
An Invitation to 3D Vision
http://vision.ucla.edu//MASKS/chapters.html
Hartley and Zisserman
http://www.robots.ox.ac.uk/~vgg/hzbook/
https://gist.github.com/740979/97f54a63eb5f61f8f2eb578d60eb44839556ff3f
http://cobweb.ecn.purdue.edu/~kak/courses-i-teach/ECE661/
http://www.daesik80.com/matlabcode/matlabcode.htm
http://www.clemson.edu/ces/crb/students/vilas/index.htm
http://opencv-users.1802565.n2.nabble.com/Getting-R-and-T-from-homography-or-Fundamental-matrixes-td2319709.html
An Invitation to 3D Vision
http://vision.ucla.edu//MASKS/chapters.html
Hartley and Zisserman
http://www.robots.ox.ac.uk/~vgg/hzbook/
Friday, June 17, 2011
some errors.
________________________________________________________________________________
Prob:
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdlib.h(353): error C2381: 'exit' : redefinition; __declspec(noreturn) differs
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\gl\glut.h(146) : see declaration of 'exit'
Sol:
Reorder the includes.
#include <stdlib.h>
#include <GL/glut.h>
________________________________________________________________________________
Prob:
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\gl\glew.h(84): fatal error C1189: #error : gl.h included before glew.h
Sol:
Reorder the includes.
#include <GL/glew.h>
#include <GL/glut.h>
________________________________________________________________________________
Prob:
Depending on glEnable(GL_DEPTH_TEST);
________________________________________________________________________________
Prob:
Shouldn't I use 0 for the 'near' value of glPerspective(45, ratio, 0, 1000) ?
Prob:
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdlib.h(353): error C2381: 'exit' : redefinition; __declspec(noreturn) differs
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\gl\glut.h(146) : see declaration of 'exit'
Sol:
Reorder the includes.
#include <stdlib.h>
#include <GL/glut.h>
________________________________________________________________________________
Prob:
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\gl\glew.h(84): fatal error C1189: #error : gl.h included before glew.h
Sol:
Reorder the includes.
#include <GL/glew.h>
#include <GL/glut.h>
________________________________________________________________________________
Prob:
Depending on glEnable(GL_DEPTH_TEST);
________________________________________________________________________________
Prob:
Shouldn't I use 0 for the 'near' value of glPerspective(45, ratio, 0, 1000) ?
Subscribe to:
Posts (Atom)