Using OpenGL in C - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

Using OpenGL in C

Description:

Using OpenGL in C#. by Joshua Shelfer. Setting It Up. www.taoframework.com. Install the Setup file ... Easy to set up. Cons: Gl., Glut., And Glu. can be ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 7
Provided by: joshuas9
Category:
Tags: opengl | setup | using

less

Transcript and Presenter's Notes

Title: Using OpenGL in C


1
Using OpenGL in C
  • by Joshua Shelfer

2
Setting It Up
  • www.taoframework.com
  • Install the Setup file
  • Or
  • Download the Zip file
  • Open lib\win32deps and copy freeglut.dll
  • Paste freeglut.dll into WINDOWS\System

3
Getting Started
  • Open your .NET solution
  • Click Project gt Add Reference
  • If you installed, find the three Tao GL and GLUT
    files under .NET tab
  • If not, find these dlls under the browse tab
    (located in the bin folder of the Zip file).
    Keep in mind, the dlls will have to be in the
    same directory as the Exe file in order for it to
    run.
  • Tao.Freeglut.dll
  • Tao.OpenGL.dll
  • Tao.OpenGL.Glu.dll

4
Required Code
  • Add these lines of code
  • using Tao.FreeGlut
  • using Tao.OpenGl

5
Example Code
  • Main function
  • Glut.glutInit()
  • Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE
    Glut.GLUT_RGB)
  • Glut.glutInitWindowSize(INITIAL_WIDTH,
    INITIAL_HEIGHT)
  • Glut.glutInitWindowPosition(0, 0)
  • Glut.glutCreateWindow("Tic Tac Toe")
  • Glut.glutDisplayFunc(tictactoe.display)
  • Glut.glutMouseFunc(tictactoe.mouseHandler)
  • Glut.glutMotionFunc(tictactoe.motionHandler)
  • Glut.glutReshapeFunc(tictactoe.reshapeHandler)
  • Init function
  • Gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f)
  • Gl.glColor3f(0.0f, 0.0f, 0.0f)
  • Gl.glMatrixMode(Gl.GL_PROJECTION)
  • Gl.glLoadIdentity()
  • Glu.gluOrtho2D(0.0, 50.0, 0.0, 50.0)
  • Gl.glMatrixMode(Gl.GL_MODELVIEW)

6
Pros and Cons
  • Pros
  • Inherent benefits of C
  • OOP
  • Easy to set up
  • Cons
  • Gl., Glut., And Glu. can be cumbersome to type
  • User must have freeglut.dll in WINDOWS\System
    folder
Write a Comment
User Comments (0)
About PowerShow.com