210 likes | 419 Views
OpenGL. Jorge Cuevas. The Open Graphics Library is a cross-language, multi-platform application-programming interface for rendering 2D and 3D vector graphics developed by Silicon Graphics Inc. (SGI) in 1991. .
E N D
OpenGL Jorge Cuevas
The Open Graphics Library is a cross-language, multi-platform application-programming interface for rendering 2D and 3D vector graphics developed by Silicon Graphics Inc. (SGI) in 1991.
It is widely used in CAD, virtual reality, scientific visualization, information visualization, flight simulation, and video games. OpenGL is managed by the non-profit technology consortium Khronos Group.
Popularity • Quality of its official documentation. • Openspecification: anyone can download the spec for free as opposed to ISO standards and specifications, which cost money to access.
Typically used to interact with a Graphics processing unit to perform some functions faster than is possible in software running on the general-purpose CPU. • Current release: 4.4 (July 2013)
Large glue code repository: • JavaScript binding • WebGL • C bindings, WGL, GLX, and CGL (the C binding provided by iOS, and the Java and C bindings provided by Android)
Platform-independent • Underlying windowing system takes care of obtaining and managing an OpenGL context. • Providing no APIs related to input, audio, or windowing.
Mesa 3D • Open source implementation of OpenGL. • Can do pure software rendering • Can use hardware acceleration on Linux by taking advantage of the Direct Rendering Infrastructure.
1980s: • Developing software that could function with a wide range of graphics hardware was a real challenge. • Software developers wrote custom interfaces and drivers for each piece of hardware.
1990s: • SGI was a leader in 3D graphics for workstations with IRIS GL API. • Eventually turned into OpenGl • Transferedcontrol of the OpenGL API standard to the KhronosGroup
Writing an OpenGL Application • Pick your language • Initialize OpenGL
Writing an OpenGL Application • 3. Get functions
OpenGL Code Sample • import org.lwjgl.opengl.*; • import org.lwjgl.util.glu.*; • import glapp.*; • public class GLApp_Demo_HelloWorld extends GLApp{ • public static void main(String args[]) { • GLApp_Demo_HelloWorld demo = new GLApp_Demo_HelloWorld(); • demo.window_title = "Hello World"; • demo.displayWidth = 640; • demo.displayHeight = 480; • demo.run(); • } • public void setup() • { • } • public void draw() { • GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); • GL11.glMatrixMode(GL11.GL_MODELVIEW); • GL11.glLoadIdentity(); • GLU.gluLookAt( • 0f, 0f, 10f, • 0f, 0f, 0f, • 0f, 1f, 0f); • GL11.glBegin(GL11.GL_TRIANGLES); • GL11.glVertex3f( 0.0f, 1.0f, 0.0f); • GL11.glVertex3f(-1.0f,-1.0f, 0.0f); • GL11.glVertex3f( 1.0f,-1.0f, 0.0f); • GL11.glEnd(); • } • }
Alternativesto OpenGL: • directx • Direct3d • OpenGl • openCl • mantle