Curves and Curved Surfaces: Bezier patch Brian Sharp, 9/28/98 brian_sharp@cognitoy.com Interactive Deformation Additions by Jay Stocker 4/18/2002 rabbit@cc.gatech.edu Brian Sharps Bezier patch surface program was modified so that it could be used to more interactively illustrate how Bezier surfaces are created and shaped by the control points. Usage: (controls are case-insensitive) - and + increase or decrease the tessellation granularity. v toggles the display of just the patch the patch and its basis functions. f toggles the size of the basis functions -- from an inset window to fullscreen. c toggles the display of control points. [ and ] decrease and increase the number of control points, respectively. r regenerates random points. p toggles between drawing the patch as a line strip or as points. ADDITIONS: e toggles edit mode z generates a flat control sheet y cycles textures EDIT MODE CONTROLS Shift + Left Click + Drag controls the Z value of the current control point Ctrl + Left Click + Drag controls the X and Y values of the current control point g cycles control point grid mode ( only visible in wireframe and point modes ) Arrow Keys move control point edit box to select the current control point Compilation and execution specifics: The executable was created with Microsoft Visual C++ 6.0 by building the included prj4 workspace. When running you must have a copy of glut32.dll present with the prj4.exe or in your Windows system directory. You must have the 5 texture files, tex*.raw, in the same directory as the executable. Code additions: + Added the class EditMover, which is a derivative of CamerMover used when in EditMode + All other major functional additions are to the bezsurf.cpp file. + Minor changes made to main.cpp > All Code by Jay Stocker is maked by an "//ADDITION" comment Summary of functions added to bezsurf.cpp: (modified existing functions not listed) void bump_control(bool pos) void registerEditControls() void useTexture( int t ) void changeControl( int du, int dv ) void specialKey( int keyHit, int x, int y) void drawControlGrid() void drawControlBox() Comments: A lot of time was spend trying to figure out exactly what was going on in this program, which I personally would not call simplistic. It was also a crash course in a lot of nifty OpenGL that I didn't know. The only real problem I was having was rendering a wireframe control point grid with a fully rendered surface. The reason for this is that to maintain using the camera perspective I was running through his rendering pipeline. Since I use a GL_QUAD_STRIP to simplify drawing the grid, if the mode is FILL, than this get's filled too. Instead of a complex workaround (or a simple one i couldn't figure out) I decided that it wasn't too much of a loss to only be able to see the control grid in LINE and POINT modes. On a personal note, I think being able to switch between event handler callbacks on the fly is very, very useful. NOTE: Some textures (namely the second one) look better with lighting toggled off. tex0.raw was provided originally by Brian Sharp under the name texture00.raw tex1.raw - tex4.raw were created by Jay Stocker