1 / 12

Intro to RayGL

Kris Zarns. Intro to RayGL. What it does. Creates SDL (scene description language) files for POVRay from OpenGL & Glut code One file per frame/swap-buffer Only requires minor modification to OpenGL code Displays original OpenGL. How it works. Man in the middle approach

aderyn
Download Presentation

Intro to RayGL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Kris Zarns Intro to RayGL

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

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

  4. How to use it • Include the files raygl.h and raygldefs.h in that order • Call rayglFrameBegin 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 frameBegin • Call rayglFrameEnd at the end of each frame • Call setRenderPov to turn SDL generation on and off

  5. How to use POVRay • For rendering a single frame try $POVRay +P +w800 +h600 <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

  6. Things it supports directly • Camera and scene • gluPerspective,gluLookAt • Primitives • glEnd, glBegin, glVertex[3i,3f,3d] • Points, triangles, triangle strips, quad strips, polygons • Models • gluDisk, gluSphere, gluCylinder • glutSolidCone, glutSolidCube, glutSolidSphere, glutSolidTorus

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

  8. Things to avoid • Avoid making openGL calls between glBegin/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 frameBegin/frameEnd • Avoid using display lists, they're not currently supported

  9. Using OpenGL texture objects • Create a list of texture names • glGenTextures • To create each texture • Bind a new texture name • glBindTexture • Load the texture • glTexImage2D • glBuild2DMipMaps • To use a texture • GlBindTexture – bind the name of the texture • Bind texture zero to stop texturing

  10. Texturing in RayGL • 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 rayglCustomLoadedTexture • Adjust texture properties using rayglScaleTexture, rayglTranslateTexture, and rayglTextureType • Continue using textures as normal

  11. 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

  12. Bugs • Compile with -wall • Check glError • If you are getting a segmentation fault, consider first if your code may be mis-allocating memory • Please read the openGL 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

More Related