CMPS-3480 Computer Graphics
Lab-6
Overview:
1. Log into Odin, using the -YC options. example: ssh myname@odin -YC 2. Change to your 3480/6 folder. Copy the lab files now... cp /home/fac/gordon/p/3480/code/6/* . Compile and run the program: make ./lab6 Press 5We will do some coding together to turn the pyramid into a smooth cone or cylinder. Get ready to code! //Vertical synchronization code case XK_v: { g.vsync = !g.vsync; //vertical synchronization //https://github.com/godotengine/godot/blob/master/platform/ //x11/context_gl_x11.cpp static PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = NULL; glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)glXGetProcAddressARB( (const GLubyte *)"glXSwapIntervalEXT"); GLXDrawable drawable = glXGetCurrentDrawable(); if (g.vsync) { glXSwapIntervalEXT(x11.dpy, drawable, 1); } else { glXSwapIntervalEXT(x11.dpy, drawable, 0); } break; }
We will open and learn to use Blender. We will build a model in blender, export it, then display it where the cube is rotating. Get ready for some blender.
Homework is... 1. Get your cylinder built correctly. Building a smooth-looking cylinder using 10 or less points-on-a-circle will get you extra points. You will have to give a normal to each vertex rather than each triangle. This is called Phong shading. It is described in our text books and many articles online. 2. Put a texture on the cube in menu item #6. Apply the texture to all 6 sides of the cube. Use a texture image that makes sense for a cube. I recommend using a texture image that you produced yourself using your phone camera and Gimp. 3. Put a texture on your cylinder. Apply a texture such as a soda can. You may find a texture map image online, but you may also make your own texture image. Sample program with a texture... ----------------------------------------------------------------- /home/fac/gordon/p/3480/code/frameworks/background/background.cpp ----------------------------------------------------------------- Do not use any images that are copyrighted or have watermarks. Making your own texture images is best. Take a picture with your phone. Here is my own textured cylinder made of bricks. The texture is from the fireplace in my house.I used just 20 points-on-a-circle. The texture image dimensions are 1024 x 256 pixels. Here is my texture image
Here are my cylinders on key-5 with textures from google. Phong shading with top and bottom surfaces.
textures...
![]()
This is a Phong-shaded cylinder. Just 12 points-on-a-circle. No edges are visible on the cylinder's surface.
I will describe Phong shading in class, then you will add it to your homework.
3480/6/lab6.cpp Makefile