|
|
|
|||||||||||
|
|
|
![]() |
|
|
|
|||||||
|
|
|
|
|
|
||||||||
|
|
|
|||||||||||
|
|
|
|
|
|||||||||
How to draw a cube using GLUTAfter reading this opengl tutorial you should have a fair idea on how to create predefined opengl shapes, specifically cubes using glut. Glut has many different preset 3d shapes for use in opengl which I will list below. You will be able to create both solid and wire opengl cubes with a single line of code. In glut we are given a group of different 3D shapes to play with The 2 is the length of the sides, as it is a cube, all sides are the same. (for these 3, the more slices and stacks, the smoother the surface.) alternatively there is also the Wire version which is done by replacing There is also a little teapot when playing with different effects, so that glutSolidTeapot(size); If you have any questions, just email swiftless@gmail.com :-) #include <GL/gl.h> void cube (void) { void display (void) { void reshape (int w, int h) { int main (int argc, char **argv) { Download C++ Source Code for this Tutorial Download Visual Basic Source Code for this Tutorial |
|
|||||||||||
|
|
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright 2008, Donald Urquhart |
||||||||||||