seed r773 - in trunk: . examples examples/opengl
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r773 - in trunk: . examples examples/opengl
- Date: Mon, 19 Jan 2009 21:08:57 +0000 (UTC)
Author: racarr
Date: Mon Jan 19 21:08:57 2009
New Revision: 773
URL: http://svn.gnome.org/viewvc/seed?rev=773&view=rev
Log:
Add OpenGL examples.
Added:
trunk/examples/opengl/
trunk/examples/opengl/Makefile.am
trunk/examples/opengl/glut-teapot.js (contents, props changed)
trunk/examples/opengl/triangle-actor.js (contents, props changed)
Modified:
trunk/configure.ac
trunk/examples/Makefile.am
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Mon Jan 19 21:08:57 2009
@@ -248,6 +248,7 @@
examples/glib/Makefile
examples/browser/Makefile
examples/turtle/Makefile
+examples/opengl/Makefile
modules/Makefile
modules/example/Makefile
modules/sqlite/Makefile
Modified: trunk/examples/Makefile.am
==============================================================================
--- trunk/examples/Makefile.am (original)
+++ trunk/examples/Makefile.am Mon Jan 19 21:08:57 2009
@@ -3,6 +3,7 @@
clutter-transitions \
glib \
browser \
+ opengl \
turtle
if BUILD_SEED_EXAMPLES
Added: trunk/examples/opengl/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/examples/opengl/Makefile.am Mon Jan 19 21:08:57 2009
@@ -0,0 +1,10 @@
+if BUILD_SEED_EXAMPLES
+gldir=$(datadir)/doc/seed/examples/glib
+gl_DATA = \
+ glut-teapot.js
+ triangle-actor.js
+endif
+
+
+## File created by the gnome-build tools
+
Added: trunk/examples/opengl/glut-teapot.js
==============================================================================
--- (empty file)
+++ trunk/examples/opengl/glut-teapot.js Mon Jan 19 21:08:57 2009
@@ -0,0 +1,53 @@
+#!/usr/local/bin/seed
+Seed.import_namespace("GL");
+Seed.import_namespace("GLUT");
+
+
+var mat_specular = [1.0,1.0,1.0,1.0];
+var mat_shininess = [50.0];
+var light_position = [0.0,0.0,-1.0,0.0];
+
+GLUT.Init(null, null);
+
+GLUT.InitDisplayMode(GLUT.DEPTH | GLUT.RGBA | GLUT.DOUBLE);
+
+
+GLUT.InitWindowSize(640, 480);
+
+GLUT.CreateWindow("Oh dear god");
+
+
+GLUT.DisplayFunc(function()
+ {
+ with (GL)
+ {
+ Clear(DEPTH_BUFFER_BIT | COLOR_BUFFER_BIT);
+ PushMatrix();
+ Begin(TRIANGLES);
+ Color3f(1,0,0);
+ Vertex3f(-1,-1,0);
+ Color3f(0,1,0);
+ Vertex3f(1,-1,0);
+ Color3f(0,0,1);
+ Vertex3f(0,1,0);
+ End();
+ PopMatrix();
+ }
+ GLUT.SolidTeapot(0.5);
+ GLUT.SwapBuffers();
+ });
+
+
+GL.ClearColor(0.0,0.0,0.0,0.0);
+GL.ShadeModel(GL.SMOOTH);
+
+//GL.glMaterialfv(GL.FRONT, GL.SPECULAR, mat_specular);
+//GL.glMaterialfv(GL.FRONT, GL.SHININESS, mat_shininess);
+GL.Lightfv(GL.LIGHT0, GL.POSITION, light_position);
+
+GL.Enable(GL.LIGHTING);
+GL.Enable(GL.LIGHT0);
+
+
+GLUT.MainLoop();
+
Added: trunk/examples/opengl/triangle-actor.js
==============================================================================
--- (empty file)
+++ trunk/examples/opengl/triangle-actor.js Mon Jan 19 21:08:57 2009
@@ -0,0 +1,36 @@
+#!/usr/local/bin/seed
+Seed.import_namespace("Clutter");
+Seed.import_namespace("GL");
+
+Clutter.init(null, null);
+
+var s = new Clutter.Stage();
+
+var b = new Clutter.Rectangle();
+
+b.width = b.x = s.width/2;
+
+b.y = 250;
+
+s.add_actor(b);
+
+b.signal["paint"].connect(function(actor)
+ {
+ with(GL)
+ {
+ PushMatrix();
+ Scalef(200,200,1);
+ Begin(TRIANGLES);
+ Color3f(1,0,0);
+ Vertex3f(-1,-1,0);
+ Color3f(0,1,0);
+ Vertex3f(1,-1,0);
+ Color3f(0,0,1);
+ Vertex3f(0,1,0);
+ End();
+ PopMatrix();
+ }
+ });
+
+s.show();
+Clutter.main();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]