Intro to Ray GL Kris Zarns What it

  • Slides: 12
Download presentation
Intro to Ray. GL Kris Zarns

Intro to Ray. GL Kris Zarns

What it does Creates SDL (scene description language) files for POVRay from Open. GL

What it does Creates SDL (scene description language) files for POVRay from Open. GL & Glut code One file per frame/swap-buffer Only requires minor modification to Open. GL code Displays original Open. GL

How it works Man in the middle approach Intercepts key Open. GL calls Builds

How it works Man in the middle approach Intercepts key Open. GL calls Builds SDL code to represent them Runs Open. GL calls State machine approach Queries Open. GL for it's current state Inserts this state information into SDL code

How to use it Include the files raygl. h and raygldefs. h in that

How to use it Include the files raygl. h and raygldefs. h in that order Call raygl. Frame. Begin at the beginning of each frame Pass the output filename here, this increments internally, if using lab machines I recommend something in /temp so you don't overrun your home directory Setup camera & lighting before calling frame. Begin Call raygl. Frame. End at the end of each frame Call set. Render. Pov to turn SDL generation on

How to use POVRay For rendering a single frame try $POVRay +P +w 800

How to use POVRay For rendering a single frame try $POVRay +P +w 800 +h 600 <file> +P for pause when done +w/+h set window size +F[C, N, P, S, T] creates an output file of type (Compressed Targa-24, PNG, PPM, System(bmp), or Targa-24) -F turns file output off +o<file> lets you set the output file name See POVRay documentation 2. 1. 2 for more options

Things it supports directly Camera and scene Primitives glu. Perspective, glu. Look. At gl.

Things it supports directly Camera and scene Primitives glu. Perspective, glu. Look. At gl. End, gl. Begin, gl. Vertex[3 i, 3 f, 3 d] Points, triangle strips, quad strips, polygons Models glu. Disk, glu. Sphere, glu. Cylinder glut. Solid. Cone, glut. Solid. Cube, glut. Solid. Sphere, glut. Solid. Torus

Things it supports indirectly Matrix Transformations Material properties This is in place, but was

Things it supports indirectly Matrix Transformations Material properties This is in place, but was not tested during the last course Texturing Current matrix is polled at gl. Begin, so all transforms are supported Coding is nearing completion Lighting Support for multiple lights of all types in any color

Things to avoid Avoid making open. GL calls between gl. Begin/End Avoid moving lights

Things to avoid Avoid making open. GL calls between gl. Begin/End Avoid moving lights or camera mid frame Avoid placing lights inside of objects Avoid using an orthogonal view Avoid using non-planar polygons Avoid nested calls to code containing frame. Begin/frame. End Avoid using display lists, they're not currently supported

Using Open. GL texture objects Create a list of texture names gl. Gen. Textures

Using Open. GL texture objects Create a list of texture names gl. Gen. Textures Bind a new texture name To create each texture Load the texture gl. Bind. Texture gl. Tex. Image 2 D gl. Build 2 DMip. Maps To use a texture Gl. Bind. Texture – bind the name of the texture Bind texture zero to stop texturing

Texturing in Ray. GL Use texture objects as previously described During the loading of

Texturing in Ray. GL Use texture objects as previously described During the loading of the texture create an Image struct with the file name and texture data, see raygl. h Pass the image struct to raygl. Custom. Loaded. Texture Adjust texture properties using raygl. Scale. Texture, raygl. Translate. Texture, and raygl. Texture. Type Continue using textures as normal

Requests for new functionality Contact me to see if there is work in progress

Requests for new functionality Contact me to see if there is work in progress Be prepared to explain how you plan to use it and why Discuss with Dr. Marsh if work on this is worthy of extra credit

Bugs Compile with -wall Check gl. Error If you are getting a segmentation fault,

Bugs Compile with -wall Check gl. Error If you are getting a segmentation fault, consider first if your code may be misallocating memory Please read the open. GL spec before asking questions Please provide a minimal test case if you find a problem with raygl I can be reached by email at kzarns@gmail. com