<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-909871506456690785</id><updated>2012-02-16T14:48:16.852-08:00</updated><category term='SQL'/><category term='for loop'/><category term='funny'/><category term='web'/><category term='facebook chat server'/><category term='boost'/><category term='ldirectord documentation'/><category term='parsing'/><category term='functions'/><category term='settings'/><category term='open source'/><category term='api'/><category term='syntax'/><category term='using'/><category term='javascript html tag'/><category term='FQL'/><category term='firefox'/><category term='audio'/><category term='elder scrolls oblivion'/><category term='apps'/><category term='shader programs'/><category term='installer'/><category term='app'/><category term='performance'/><category term='c++'/><category term='drawarrays'/><category term='motion tracking'/><category term='variables'/><category term='64 bit'/><category term='asp'/><category term='opencv'/><category term='case sensitive'/><category term='macintosh'/><category term='foreach'/><category term='java'/><category term='opencl'/><category term='DLL'/><category term='lambda'/><category term='server settings'/><category term='Chat'/><category term='gpu'/><category term='NFS'/><category term='pyopengl'/><category term='PostgreSQL'/><category term='multiple uv islands'/><category term='desktop'/><category term='load balancing'/><category term='alert'/><category term='software'/><category term='glsl'/><category term='html'/><category term='linking'/><category term='texture mapping'/><category term='depth texture'/><category term='external'/><category term='ubuntu'/><category term='Intel'/><category term='pyopencl'/><category term='google'/><category term='file formats'/><category term='facial tracking'/><category term='coordinates'/><category term='uv'/><category term='oblivion'/><category term='masq'/><category term='javascript'/><category term='def'/><category term='glsl texture mapping'/><category term='web servers'/><category term='geometry shader'/><category term='tag'/><category term='wine'/><category term='game engine'/><category term='vertex'/><category term='osx'/><category term='application'/><category term='wavefront'/><category term='openGL'/><category term='Programming'/><category term='for'/><category term='python'/><category term='multitexturing'/><category term='mass effect 2'/><category term='load balance'/><category term='fable'/><category term='debian'/><category term='vcrun6'/><category term='html 5'/><category term='physics'/><category term='canvas'/><category term='Book'/><category term='Empathy'/><category term='Facebook'/><category term='foreach equivalent'/><category term='fragment'/><category term='html tags'/><category term='hardware'/><category term='database'/><category term='apache'/><category term='linux'/><category term='facebook chat server settings'/><category term='oss'/><category term='general purpose GPU'/><category term='ldirectord'/><category term='Face'/><category term='winetricks'/><category term='defining functions'/><category term='optimizations'/><category term='64 bit os'/><category term='PHP'/><category term='runs in wine'/><category term='obj'/><category term='GPGPU'/><category term='computer vision'/><category term='servers'/><category term='kernel'/><category term='audio data api'/><category term='server'/><category term='gcc'/><category term='compiling'/><category term='mozilla'/><category term='mfc42'/><category term='javascript external'/><category term='data'/><category term='elder scrolls'/><category term='PID'/><category term='scheduling'/><title type='text'>Programming Linux Games</title><subtitle type='html'>Programming in C, C++, PHP, Python, Java, SQL, Assembly, Javascript. Linux in Debain, ubuntu. Mac OSX. Games, running wine, programming, troubleshooting, openGL, glsl, GPGPU, General Purpose GPU programming.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>31</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-8863041912264848097</id><published>2011-03-01T20:28:00.000-08:00</published><updated>2011-03-01T20:54:13.295-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='glsl'/><category scheme='http://www.blogger.com/atom/ns#' term='gpu'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='geometry shader'/><category scheme='http://www.blogger.com/atom/ns#' term='pyopengl'/><category scheme='http://www.blogger.com/atom/ns#' term='openGL'/><title type='text'>PyOpenGL Geometry Shaders - Python and OpenGL Geometry Shader</title><content type='html'>&lt;h2&gt;Geometry Shaders using PyOpenGL - Implementation&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Extending our shader from a previous post, &lt;a href="http://programminglinuxgames.blogspot.com/2010/03/using-glsl-in-python-pyopengl.html" title="Using GLSL in Python PyOpenGL OpenGL"&gt;Using GLSL in Python PyOpenGL&lt;/a&gt; we can simply add geometry shaders if your video card supports such a beast.&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Geometry Shader Class in Python&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The following is a shader class written in Python. Its based on our previous shader class except weve made some additions to support &lt;strong&gt;Geometry Shaders&lt;/strong&gt;. We will start with the includes&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;from OpenGL.GL import *&lt;br /&gt;from OpenGL.GLU import *&lt;br /&gt;from OpenGL.GL.ARB.framebuffer_object import *&lt;br /&gt;from OpenGL.GL.EXT.framebuffer_object import *&lt;br /&gt;from OpenGL.GL.ARB.vertex_buffer_object import *&lt;br /&gt;from OpenGL.GL.ARB.geometry_shader4 import *&lt;br /&gt;from OpenGL.GL.EXT.geometry_shader4 import *&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Not sure how many of these are actually used in this class, but they are there in case. The file contains other opengl related classes so they are there. Next I will show the class itself&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class shader(node) :&lt;br /&gt; def __init__(self, filename):&lt;br /&gt;  node.__init__(self)&lt;br /&gt;  self.filename = filename&lt;br /&gt;  self.load()&lt;br /&gt;  &lt;br /&gt; def load(self, debug=False):&lt;br /&gt;  fh = open(self.filename)  &lt;br /&gt;  self.source = {'vertex': '', 'fragment':'', 'geometry':''}&lt;br /&gt;  write = None&lt;br /&gt;  for line in fh :&lt;br /&gt;   if line == '[[vertex-program]]\n' : &lt;br /&gt;    write = 'vertex'&lt;br /&gt;   elif line == '[[fragment-program]]\n' : &lt;br /&gt;    write = 'fragment'&lt;br /&gt;   elif line == '[[geometry-program]]\n' : &lt;br /&gt;    write = 'geometry'&lt;br /&gt;   else :&lt;br /&gt;    self.source[write] += line&lt;br /&gt;    &lt;br /&gt;  self.draw = self.init&lt;br /&gt;  if debug :&lt;br /&gt;   print self.source['vertex']&lt;br /&gt;   print self.source['fragment']&lt;br /&gt;   print self.source['geometry']&lt;br /&gt; &lt;br /&gt;    &lt;br /&gt;&lt;br /&gt; def init(self):&lt;br /&gt;  ##compile and link shader&lt;br /&gt;  self.vs = self.fs = self.gs = 0&lt;br /&gt;&lt;br /&gt;  self.vs = glCreateShader(GL_VERTEX_SHADER)&lt;br /&gt;  self.fs = glCreateShader(GL_FRAGMENT_SHADER)&lt;br /&gt;  self.gs = glCreateShader(GL_GEOMETRY_SHADER_EXT)&lt;br /&gt;&lt;br /&gt;  glShaderSource(self.vs, self.source['vertex'])&lt;br /&gt;  glShaderSource(self.fs, self.source['fragment'])&lt;br /&gt;  glShaderSource(self.gs, self.source['geometry'])&lt;br /&gt;&lt;br /&gt;  glCompileShader(self.vs)&lt;br /&gt;  log = glGetShaderInfoLog(self.vs)&lt;br /&gt;  if log: print 'Vertex Shader: ', log&lt;br /&gt;&lt;br /&gt;  glCompileShader(self.gs)&lt;br /&gt;  log = glGetShaderInfoLog(self.gs)&lt;br /&gt;  if log: print 'Geometry Shader: ', log&lt;br /&gt;&lt;br /&gt;  glCompileShader(self.fs)&lt;br /&gt;  log = glGetShaderInfoLog(self.fs)&lt;br /&gt;  if log: print 'Fragment Shader: ', log&lt;br /&gt;&lt;br /&gt;  self.prog = glCreateProgram()&lt;br /&gt;&lt;br /&gt;  glAttachShader(self.prog, self.vs)&lt;br /&gt;  glAttachShader(self.prog, self.fs)&lt;br /&gt;  glAttachShader(self.prog, self.gs)&lt;br /&gt;&lt;br /&gt;  glLinkProgram(self.prog)&lt;br /&gt;  &lt;br /&gt;  glUseProgram(self.prog)&lt;br /&gt;  &lt;br /&gt;  self.draw = self.use&lt;br /&gt;&lt;br /&gt; def use(self):&lt;br /&gt;  glUseProgram(self.prog)&lt;br /&gt;  uniform_location = glGetUniformLocation(self.prog, "time")&lt;br /&gt;  glUniform1i(uniform_location, pygame.time.get_ticks())&lt;br /&gt;&lt;br /&gt; def end(self):&lt;br /&gt;  glUseProgram(0)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Explaination of OpenGL Geometry Shader GL_GEOMETRY_SHADER_EXT&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;First difference is in the shader.load function. We have added code to load the actual source code for the shader. Secondly we create the shader with:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;self.gs = glCreateShader(GL_GEOMETRY_SHADER_EXT)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;GL_GEOMETRY_SHADER_EXT seems to be the only one defined for me. We contine normally now. The main additions are to the shader source code.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;OpenGL Geometry Shader source code&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Each section of the code is marked by delimters [[vertex-program]], [[fragment-program]], and [[geometry-program]]. Below is the source code&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[[vertex-program]]&lt;br /&gt;uniform int time;&lt;br /&gt;&lt;br /&gt;void main(void) {&lt;br /&gt; gl_TexCoord[0] = gl_MultiTexCoord0;&lt;br /&gt; gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;[[geometry-program]]&lt;br /&gt;#version 150&lt;br /&gt;#extension GL_EXT_geometry_shader4 : enable&lt;br /&gt; &lt;br /&gt;layout(triangles) in;&lt;br /&gt;layout(line_strip, max_vertices = 20) out;&lt;br /&gt;&lt;br /&gt;void emit(vec4 vertex) {&lt;br /&gt; gl_Position = vertex;&lt;br /&gt; EmitVertex();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void main(void) {&lt;br /&gt; vec4 avg = vec4(0., 0., 0., 0.);&lt;br /&gt; int i;&lt;br /&gt; for(i=0; i&lt; gl_VerticesIn; i++){&lt;br /&gt;  avg += gl_PositionIn[i];&lt;br /&gt; }&lt;br /&gt; avg /= (gl_VerticesIn * 1.0);&lt;br /&gt; &lt;br /&gt; vec4 mid1 = (gl_PositionIn[0] + gl_PositionIn[1]) / 2.0;&lt;br /&gt; vec4 mid2 = (gl_PositionIn[1] + gl_PositionIn[2]) / 2.0;&lt;br /&gt; vec4 mid3 = (gl_PositionIn[2] + gl_PositionIn[0]) / 2.0;&lt;br /&gt; &lt;br /&gt; emit(gl_PositionIn[0]);&lt;br /&gt; emit(mid1);&lt;br /&gt; emit(mid3);&lt;br /&gt; emit(mid2);&lt;br /&gt; emit(mid1);&lt;br /&gt; emit(gl_PositionIn[1]);&lt;br /&gt; emit(mid2);&lt;br /&gt; emit(gl_PositionIn[2]);&lt;br /&gt; emit(mid3);&lt;br /&gt; emit(gl_PositionIn[0]);&lt;br /&gt; &lt;br /&gt; EndPrimitive();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[[fragment-program]]&lt;br /&gt;uniform sampler2D texture_0;&lt;br /&gt;&lt;br /&gt;void main (void)  {&lt;br /&gt; vec4 cvec = texture2D(texture_0, gl_TexCoord[0].xy);&lt;br /&gt; gl_FragColor = cvec;&lt;br /&gt; gl_FragColor.a = 1.0;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Caveats with OpenGL Geometry Program, it always uses triangles&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Something that took me awhile to figure out is that the geometry shader always works in triangles. I couldn't figure out why quads was not defined in GLSL. I was using GL_QUADS so I naturally figured it would exist. It does not. Internal OpenGL pipeline converts to triangles here. Maybe this is common knowledge, maybe it is not. Someone can feel free to correct me.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Other interesting things are the extra lines there&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#version 150&lt;br /&gt;#extension GL_EXT_geometry_shader4 : enable&lt;br /&gt; &lt;br /&gt;layout(triangles) in;&lt;br /&gt;layout(line_strip, max_vertices = 20) out;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The top comments are required for me. The first function layout() show the input, triangles as mentioned earlier. The next specifies output, which is line strip. I did this to show the effect of the shader, it will draw line strips instead of triangle_strip which would make more sense in the real world perhaps.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-8863041912264848097?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/8863041912264848097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2011/03/pyopengl-geometry-shaders-python-and.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/8863041912264848097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/8863041912264848097'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2011/03/pyopengl-geometry-shaders-python-and.html' title='PyOpenGL Geometry Shaders - Python and OpenGL Geometry Shader'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-567570203914440790</id><published>2010-11-19T14:12:00.000-08:00</published><updated>2010-11-19T14:16:15.450-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='desktop'/><category scheme='http://www.blogger.com/atom/ns#' term='kernel'/><category scheme='http://www.blogger.com/atom/ns#' term='scheduling'/><title type='text'>Faster and More Responsive Desktop in Linux</title><content type='html'>&lt;h1&gt;Faster Linux Desktop - Changing the scheduling paradigm to increase responsiveness for desktop useage&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;Came across an interesting article about speeding up the desktop usage in linux by altering the threading and process scheduling algorithm.&lt;br /&gt;&lt;br /&gt;More details can be found here : &lt;a href="http://blogs.computerworld.com/17371/the_linux_desktop_may_soon_be_a_lot_faster"&gt;http://blogs.computerworld.com/17371/the_linux_desktop_may_soon_be_a_lot_faster&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;My question is would this change performance for servers that have no graphical user interface running IE xorg? It looks like it won't!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-567570203914440790?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/567570203914440790/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/11/faster-and-more-responsive-desktop-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/567570203914440790'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/567570203914440790'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/11/faster-and-more-responsive-desktop-in.html' title='Faster and More Responsive Desktop in Linux'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-3510806635580557905</id><published>2010-11-19T13:12:00.000-08:00</published><updated>2010-11-19T13:35:39.560-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='debian'/><category scheme='http://www.blogger.com/atom/ns#' term='PostgreSQL'/><category scheme='http://www.blogger.com/atom/ns#' term='server settings'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><category scheme='http://www.blogger.com/atom/ns#' term='servers'/><title type='text'>Postgres unable to start with shmget. SHMMAX too small</title><content type='html'>&lt;h1&gt;Error Starting PostgreSQL, Could not create shared memory segment errors&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;If you have a large PostgreSQL configuration that supports many concurrent requests, you may find yourself starting it as you have increased the shared_buffers parameter or max_connections parameter, and it fails to start. &lt;br /&gt;&lt;br /&gt;The error message will say something like could not create shared memory segment, Failed system call was shmget. This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. SHMMAX too small.&lt;br /&gt;&lt;br /&gt;Here is the exact error message I got:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;debian-testing:~# /etc/init.d/postgresql-8.3 start&lt;br /&gt;Starting PostgreSQL 8.3 database server: mainThe PostgreSQL server failed to start. Please check the log output: 2010-11-17 13:53:34 EST FATAL: could not create shared memory segment: Invalid argument 2010-11-17 13:53:34 EST DETAIL: Failed system call was shmget(key=5432001, size=147382272, 03600). 2010-11-17 13:53:34 EST HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. To reduce the request size (currently 147382272 bytes), reduce PostgreSQL's shared_buffers parameter (currently 16384) and/or its max_connections parameter (currently 503). If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for. The PostgreSQL documentation contains more information about shared memory configuration. failed!&lt;br /&gt; failed!&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;PostgreSQL Debian increase SHMMAX&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;In order to increase the maximum amount of shared memory a linux program can access, we need to adjust kernel parameters. Since we are using Debian they are available in /etc/sysctl.conf. This should be similar for many linux distributions.&lt;br /&gt;&lt;br /&gt;We simple edit this file:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;sudo vim /etc/sysctl.conf&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;or if you have GNOME running&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;sudo gedit /etc/sysctl.conf&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And either search for the line or add the line (most likely will have to add) :&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;kernel.shmmax = 147382272&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note the number here is the same as "size" in this system call, shown in my error message above: shmget(key=5432001, size=147382272, 03600)&lt;br /&gt;&lt;br /&gt;Now we have to put these settings into effect by running the command&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;sysctl -p&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And now we start PostgreSQL up without the error:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;debian-testing:~# /etc/init.d/postgresql-8.3 start&lt;br /&gt;Starting PostgreSQL 8.3 database server: main.&lt;br /&gt;debian-testing:~#&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-3510806635580557905?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/3510806635580557905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/11/postgres-unable-to-start-with-shmget.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/3510806635580557905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/3510806635580557905'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/11/postgres-unable-to-start-with-shmget.html' title='Postgres unable to start with shmget. SHMMAX too small'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-2403049860394867926</id><published>2010-11-18T16:03:00.000-08:00</published><updated>2010-11-18T16:15:00.417-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='facial tracking'/><category scheme='http://www.blogger.com/atom/ns#' term='computer vision'/><category scheme='http://www.blogger.com/atom/ns#' term='motion tracking'/><category scheme='http://www.blogger.com/atom/ns#' term='opencv'/><title type='text'>Intel OpenCV Open Source Computer Vision Software</title><content type='html'>&lt;h1&gt;Face Tracking, Motion Tracking, OpenCV - Free Computer Vision Library&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;Was looking into how to do face tracking and possibly motion tracking. With face tracking I was hoping I could find a way to track facial expressions, ie the eyebrow position, mouth position, as is done with many CG characters nowadays. OpenCV is an open library by Intel that allows you to carry out various computer vision tasks. Facial tracking is one of the demos that comes with OpenCV.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;How OpenCV's facial tracking works can be described in great detail&lt;/h2&gt;&lt;br /&gt;You can find out more about how OpenCV's facial tracking works here : &lt;a href="http://www.cognotics.com/opencv/servo_2007_series/part_3/sidebar.html"&gt;http://www.cognotics.com/opencv/servo_2007_series/part_3/sidebar.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Check out Intel's OpenCV library - computer vision&lt;/h2&gt;&lt;br /&gt;Check out the a wiki for more detailed information here : &lt;a href="http://opencv.willowgarage.com/wiki/"&gt;http://opencv.willowgarage.com/wiki/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Face Tracking OpenCV - Cool demo on youtube&lt;/h2&gt;&lt;br /&gt;&lt;a href="http://www.youtube.com/watch?v=AUhFjG-WSPE"&gt;http://www.youtube.com/watch?v=AUhFjG-WSPE&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-2403049860394867926?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/2403049860394867926/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/11/intel-opencv-open-source-computer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/2403049860394867926'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/2403049860394867926'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/11/intel-opencv-open-source-computer.html' title='Intel OpenCV Open Source Computer Vision Software'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-2523824447288388701</id><published>2010-11-16T14:28:00.000-08:00</published><updated>2010-11-16T14:37:36.518-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='html 5'/><category scheme='http://www.blogger.com/atom/ns#' term='audio data api'/><category scheme='http://www.blogger.com/atom/ns#' term='audio'/><category scheme='http://www.blogger.com/atom/ns#' term='mozilla'/><title type='text'>Mozilla's HTML 5 Audio API Draft</title><content type='html'>&lt;h1&gt;HTML 5 - Mozilla's Draft for the Audio API&lt;/h1&gt;&lt;br /&gt;&lt;h2&gt;Defining an Enhanced API for Audio (Draft Recommendation) by Mozilla&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Was looking into writing a html 5 script that can generate tones given a frequency (ie 440 hz for 'A') . Alas, it seems out of my reach for now as Mozillas Audio Writing API does not appear to work in my version of firefox. Cmon people lets get moving!&lt;br /&gt;&lt;br /&gt;&lt;a href="https://wiki.mozilla.org/Audio_Data_API" title="official mozilla audio data api documentation"&gt;https://wiki.mozilla.org/Audio_Data_API&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;Cool Examples&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://audioscene.org/scene-files/yury/examples/piano.html"&gt;Toy Piano&lt;/a&gt;&lt;br /&gt;&lt;a href="http://audioscene.org/scene-files/yury/tts/index.html"&gt;Javascript text-to-speech engine&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Let me know if any of these work for you, because they don' work for me :(&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-2523824447288388701?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/2523824447288388701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/11/mozillas-html-5-audio-api-draft.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/2523824447288388701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/2523824447288388701'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/11/mozillas-html-5-audio-api-draft.html' title='Mozilla&apos;s HTML 5 Audio API Draft'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-1884766152872794271</id><published>2010-11-08T22:18:00.000-08:00</published><updated>2010-11-08T22:19:36.046-08:00</updated><title type='text'>Site Launch</title><content type='html'>&lt;h1&gt;Sheet-Music-Tabs.com&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;New site has been launched. Lets watch the SEO value... lots of competition out there&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sheet-music-tabs.com/" title="Sheet-Music-Tabs.com homepage"&gt;Sheet-Music-Tabs.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sheet-music-tabs.com/bands/T/The+Rodeo+Carburettor+tabs/38218/Speed+of+Flow+tabs.html" title="Speed of Flow tabs by The Rodeo Carburettor tabs"&gt;New! Speed of Flow tabs by The Rodeo Carburettor&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-1884766152872794271?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/1884766152872794271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/11/site-launch.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/1884766152872794271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/1884766152872794271'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/11/site-launch.html' title='Site Launch'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-7304738063634369104</id><published>2010-09-13T12:27:00.001-07:00</published><updated>2010-09-20T19:53:48.033-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ldirectord'/><category scheme='http://www.blogger.com/atom/ns#' term='NFS'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='debian'/><category scheme='http://www.blogger.com/atom/ns#' term='load balancing'/><category scheme='http://www.blogger.com/atom/ns#' term='masq'/><category scheme='http://www.blogger.com/atom/ns#' term='ldirectord documentation'/><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><category scheme='http://www.blogger.com/atom/ns#' term='load balance'/><category scheme='http://www.blogger.com/atom/ns#' term='web servers'/><category scheme='http://www.blogger.com/atom/ns#' term='servers'/><title type='text'>Load Balancing Web Servers using ldirectord</title><content type='html'>&lt;h1&gt;Web Server Load Balancing&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Summary&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Using ldirectord to set up load balancing in apache, using debian linux as my distro, should also work on ubuntu or any other distro for that matter (bsd, red hat, etc). See below for links to the documentation. This setup is done using ldirectord's masq mode, which is basically ip masquerading function using iptables.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Let's Begin&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Im just going to take a few mins to explain my load balancing set up. What we have is 1 router, the default gateway, connected to the internet, and also connecting to an internal network. Standard set up really.&lt;br /&gt;&lt;br /&gt;What we want to do is set up load balancing with 2 (or more, our case we have 4) apache servers.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;First step - download ldirectord&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://horms.net/projects/ldirectord/" title="ldirectord homepage"&gt;http://horms.net/projects/ldirectord/&lt;/a&gt; (ldirectord) is a daemon that will route traffic to a certain host based on whatever load balancing algorithm you choose. Some examples of algorithms are round robin, where it selects the next host every time, or least connections, route to the host with the least number of open connections. There are a few other options that are covered in the &lt;a href="http://linux.die.net/man/8/ldirectord" title="ldirectord man page"&gt;ldirectord documentation (man page)&lt;/a&gt; and specifically for the algorithms is in the IPVSADM man page under -s (scheduler) &lt;a href="http://linux.die.net/man/8/ipvsadm" title="ipvsadm man page"&gt;located here (http://linux.die.net/man/8/ipvsadm)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Note that ldirectord is now a sub project of linux HA project called Heartbeat. It is available as a part of that package available here &lt;a href="http://www.linux-ha.org/wiki/Main_Page" title="heartbeat homepage"&gt;http://www.linux-ha.org/wiki/Main_Page&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The reason for this is ldirectord is used as a part of that package. It is also useable on its own as I will show you.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Ldirectord set up&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;What we have to do next is set up ldirectord after we manage to get it compiled. Here is an example of a /etc/ha.d/ldirectord.cf:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;# Global Directives&lt;br /&gt;checktimeout=10&lt;br /&gt;checkinterval=2&lt;br /&gt;autoreload=no&lt;br /&gt;logfile="local0"&lt;br /&gt;quiescent=yes&lt;br /&gt;&lt;br /&gt;# Virtual Server for HTTP&lt;br /&gt;virtual=10.1.1.10:80&lt;br /&gt;        real=10.1.1.21:80 masq&lt;br /&gt;        real=10.1.1.22:80 masq&lt;br /&gt;        real=10.1.1.23:80 masq&lt;br /&gt;        real=10.1.1.12:80 masq&lt;br /&gt;        service=http&lt;br /&gt;        request="ldirectord.html"&lt;br /&gt;        receive="Test Page"&lt;br /&gt;        scheduler=wlc&lt;br /&gt;        protocol=tcp&lt;br /&gt;        checktype=negotiate&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As you can see, we have set this ldirectord program up on the host located at 10.1.1.10 which is a physical machine. Using Heartbeat you can set up a virtual IP address and have 2 or more machines take over that address when the main one goes down, but that is for another article. We are strictly focusing on setting up ldirectord here.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Setting up the load balanced machines&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;On each of the load balanced machines (10.1.1.21, 22, 23, and 12) we need to set the default gateway to 10.1.1.10 (the ip address of the load balancer) Please adjust accordingly to your network. This can be done using the following command on debian linux and most other types&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;route add default gw 10.1.1.10&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Next we have set up our ldirectord to check each machine by loading the page "ldirectord.html" shown above. So really it will be trying to access the page http://10.1.1.21/ldirectord.html. We have set up a regular expression as well above saying "Test Page". As long as this url returns this string somewhere, the host will be considered "up" by ldirectord. After we have set everything up, it should be good to go.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Running ldirectord&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Please make sure your config file is in /etc/ha.d/ldirectord.cf because the script will be searching there for it. Next run ldirectord by typing&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;/usr/bin/perl /usr/sbin/ldirectord start&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You should make a init.d script for this. After you have run ldirectord, typing &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;ipvsadm -L&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;should give you some information on its status.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;s5:/etc/ha.d# ipvsadm -L&lt;br /&gt;IP Virtual Server version 1.2.1 (size=4096)&lt;br /&gt;Prot LocalAddress:Port Scheduler Flags&lt;br /&gt;  -&gt; RemoteAddress:Port           Forward Weight ActiveConn InActConn&lt;br /&gt;TCP  s5.np.local:www wlc&lt;br /&gt;  -&gt; s4.np.local:www              Masq    1      6          2245      &lt;br /&gt;  -&gt; s7.np.local:www              Masq    1      5          2275      &lt;br /&gt;  -&gt; s3.np.local:www              Masq    1      4          2563      &lt;br /&gt;  -&gt; s9.np.local:www              Masq    1      6          2074&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here it shows that all hosts are up (their "Weight" is each 1) and have active connections running to them. &lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Setting up external routing&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Now just have your router point all web traffic to 10.1.1.10:80 and you should have full load balancing. Note there are other problems such as how are you going to make sure they are all synchronized. You can use tools such as rsync, or use NFS to mount a share that contains all your files on each of the slave servers (our approach). The NFS approach seems to work nicely, however if you are hosting webservers for file transfers it may become a bottleneck so make sure your internet network is fast (1000 mbit) and tweaking NFS settings to your liking.&lt;br /&gt;&lt;br /&gt;Thank you, your comments are welcome!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-7304738063634369104?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/7304738063634369104/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/09/load-balancing-web-servers-using.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/7304738063634369104'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/7304738063634369104'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/09/load-balancing-web-servers-using.html' title='Load Balancing Web Servers using ldirectord'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-5073189950703569975</id><published>2010-09-13T09:35:00.000-07:00</published><updated>2010-09-13T11:14:18.406-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='file formats'/><category scheme='http://www.blogger.com/atom/ns#' term='wavefront'/><category scheme='http://www.blogger.com/atom/ns#' term='parsing'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='pyopengl'/><category scheme='http://www.blogger.com/atom/ns#' term='obj'/><title type='text'>Parsing Wavefront .obj using Python</title><content type='html'>&lt;h1&gt;Wavefront OBJ File Format Parsing in Python&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--&lt;br /&gt;google_ad_client = "pub-9811013802250997";&lt;br /&gt;/* 336x280, created 9/13/10 */&lt;br /&gt;google_ad_slot = "4719113129";&lt;br /&gt;google_ad_width = 336;&lt;br /&gt;google_ad_height = 280;&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"&lt;br /&gt;src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;I thought I would share some simple parsing information about the wavefront .OBJ file format using python. The thing I like about this format is that it is stored in plain text, and easy to use if you are writing simple 3D game engines, or just 3D modeling programs.&lt;br /&gt;&lt;br /&gt;You can use this parser to load wavefront files using python, and possibly to view the wavefront obj file.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Overview of the wavefront .OBJ file format&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Based on &lt;a href="http://en.wikipedia.org/wiki/Obj" title="Wikipedia OBJ file format specification overview"&gt;http://en.wikipedia.org/wiki/Obj&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Basically, our approach is to go line by line through the file. If the line starts with a "v", we are dealing with a vertex. If the line starts with a "vt" then we are dealing with a texture coordinate (u, v, optionally w). "n" means normal. "f" means its a face index. These are a bit special, but not too difficult to grasp. Our exported models that are from &lt;a href="http://www.blender.org/" title="blender homepage"&gt;blender&lt;/a&gt; will all have normal vectors, and texture coordinates (make sure you specify the texture coordinates in blender or there will be none). The "f" lines will look like this:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;where "v1" is the vertex array index, "vt1" is the texture coordinate index, and "vn1" is the normals array index. This particular face is a triangle. I recommend storing triangles, and quads in 2 different arrays. They can both reference your vertex/texture coordinate/normals array.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Very important note before we begin&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;The index format in the .OBJ Wavefront file format is 1 based, not 0 based. Thus, we should subtract 1 from the actual number in order to get a 0 based index, and make it compatible with python lists or any array type.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#do the loading of the obj file&lt;br /&gt;def load_obj(filename) :&lt;br /&gt; V = [] #vertex&lt;br /&gt; T = [] #texcoords&lt;br /&gt; N = [] #normals&lt;br /&gt; F = [] #face indexies&lt;br /&gt;&lt;br /&gt; fh = open(filename)&lt;br /&gt; for line in fh :&lt;br /&gt;  if line[0] == '#' : continue&lt;br /&gt; &lt;br /&gt;  line = line.strip().split(' ')&lt;br /&gt;  if line[0] == 'v' : #vertex&lt;br /&gt;   V.append(line[1:])&lt;br /&gt;  elif line[0] == 'vt' : #tex-coord&lt;br /&gt;   T.append(line[1:])&lt;br /&gt;  elif line[0] == 'vn' : #normal vector&lt;br /&gt;   N.append(line[1:])&lt;br /&gt;  elif line[0] == 'f' : #face&lt;br /&gt;   face = line[1:]&lt;br /&gt;   if len(face) != 4 : &lt;br /&gt;    print line&lt;br /&gt;    #raise Exception('not a quad!')&lt;br /&gt;    continue&lt;br /&gt;   for i in range(0, len(face)) :&lt;br /&gt;    face[i] = face[i].split('/')&lt;br /&gt;    # OBJ indexies are 1 based not 0 based hence the -1&lt;br /&gt;    # convert indexies to integer&lt;br /&gt;    for j in range(0, len(face[i])) : face[i][j] = int(face[i][j]) - 1&lt;br /&gt;   F.append(face)&lt;br /&gt;&lt;br /&gt; return V, T, N, F&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Please not this program will give you string representations. You should loop through these arrays again and convert them to the proper format (int, float, etc).&lt;br /&gt;&lt;br /&gt;Please leave your comments&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-5073189950703569975?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/5073189950703569975/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/09/parsing-wavefront-obj-file-format-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/5073189950703569975'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/5073189950703569975'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/09/parsing-wavefront-obj-file-format-using.html' title='Parsing Wavefront .obj using Python'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-4377880026227565550</id><published>2010-08-26T11:33:00.000-07:00</published><updated>2010-08-26T12:54:30.893-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='macintosh'/><category scheme='http://www.blogger.com/atom/ns#' term='opencl'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='boost'/><category scheme='http://www.blogger.com/atom/ns#' term='pyopencl'/><category scheme='http://www.blogger.com/atom/ns#' term='osx'/><category scheme='http://www.blogger.com/atom/ns#' term='compiling'/><title type='text'>Compiling boost C++ development libraries in OSX</title><content type='html'>&lt;H1&gt;Compiling boost c++ libraries and development headers for Mac OSX&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;Hi Everyone,&lt;br /&gt;&lt;br /&gt;So I am starting to play with OpenCL. And as you all know I do love python. I have been playing with pyOpenCL package for awhile and wanted to get it set up on my Mac using OSX.&lt;br /&gt;&lt;br /&gt;It depends on an installation of Boost C++ Libraries &lt;a href="http://www.boost.org/" title="boost c++ development libraries"&gt;http://www.boost.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;first we set up a directory, and in a terminal we need to download the boost files:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;wget http://downloads.sourceforge.net/project/boost/boost/1.44.0/boost_1_44_0.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fboost%2Ffiles%2Fboost%2F1.44.0%2F&lt;br /&gt;&lt;br /&gt;bzip2 -d boost_1_44_0.tar.bz2 &lt;br /&gt;&lt;br /&gt;tar -xvf boost_1_44_0.tar&lt;br /&gt;&lt;br /&gt;cd boost_1_44_0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Configuration and Compilation&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Great now we have extracted it, lets attempt to configure, compile, and install this package. Since I have build many applications on my MacOSX, I already have lots of build tools/libraries installed (eg. gcc, xorg, wine).&lt;br /&gt;&lt;br /&gt;I was able to compile by typing at the console:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;sh bootstrap.sh&lt;br /&gt;&lt;br /&gt;./bjam&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And then I waited... Its a shame there is no configure and make so I could use "make -j 4" and utilize all 4 of my cores for compiling. Maybe bjam has that option, I am not sure and too lazy to look into the documentation. Also I believe that is a bit out of the scope of this post for now.&lt;br /&gt;&lt;br /&gt;After waiting for it to finish, we install the libraries by typing&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;sudo ./bjam install&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And then we wait some more...&lt;br /&gt;&lt;br /&gt;Finally after it is installed we can continue to try and install pyOpenCL.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Note: openCL unfortunately is not supported on my mac (Mac OS X 10.5.8 Leopard) and no amount of wishing will make it so :( However hopefully you are able to install this package (pyOpenCL) using Linux or Windows, or even Snow Leopard. Good luck!&lt;/h3&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-4377880026227565550?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/4377880026227565550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/08/compiling-boost-c-development-libraries.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/4377880026227565550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/4377880026227565550'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/08/compiling-boost-c-development-libraries.html' title='Compiling boost C++ development libraries in OSX'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-1856842866121268802</id><published>2010-07-29T12:43:00.000-07:00</published><updated>2010-09-10T14:47:07.176-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='html 5'/><category scheme='http://www.blogger.com/atom/ns#' term='html tags'/><category scheme='http://www.blogger.com/atom/ns#' term='canvas'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><title type='text'>Using Canvas in Firefox and Safari for Graphics in your Browser</title><content type='html'>&lt;h1&gt;Using the Canvas Tag&lt;/h1&gt;&lt;br /&gt;&lt;h2&gt;About the Canvas Tag&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;The canvas tag is a 2d "canvas" that can be used to draw various vector shapes. It has a fully integrated javascript API. It somewhat resembles the graphical aspects of flash. Since adobe and flash have taken some flack lately, we begin to wonder what is the future of web graphics programming APIs? Apple seems to be in a space where they want to drop support for flash. (See iPad discussions). A lot of people are behind this movement. Another example is android, which does support flash, however many people are reporting that performance is bad. &lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Why Not Use the Canvas Tag?&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Well, we can't replace flash with canvas. Flash has many other aspects such as full networking libraries, native video playback, audio, etc. Some of these things are coming along as separate modules for each browser but since there is no unified front on these modules, it seems to be lagging behind in terms of features, and even being available in the first place.&lt;br /&gt;&lt;br /&gt;Another problem is we are not seeing much support for canvas using internet explorer (one of the most widely used browsers at the moment). Firefox, Safari, Chrome and Opera all fully support it.&lt;br /&gt;&lt;br /&gt;Personally I would like to see canvas more widely used. And I think market forces may give it a bit of a push in the near future.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Demonstration of using the canvas tag. Works in Firefox and Safari&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Hi Everyone,&lt;br /&gt;&lt;br /&gt;Today I am going to demonstrate the use of the canvas tag in order to output graphics. Here is our template we will use in order to get started. This is a short script that will draw a circle at coordinates 200, 200 with a radius of 50. Below that is this code at work. It should be drawing a large blue circle if its working properly.&lt;br /&gt;&lt;br /&gt;&lt;style&gt;&lt;br /&gt;span.comment { color: #5555ff; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;Canvas Test&amp;lt;/title&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;script type=&amp;quot;application/javascript&amp;quot;&amp;gt;&lt;br /&gt;var ctx = null;&lt;br /&gt;&lt;br /&gt;function draw() {&lt;br /&gt; &lt;span class="comment"&gt;//get our canvas element&lt;/span&gt;&lt;br /&gt; var canvas = document.getElementById(&amp;quot;canvas&amp;quot;);&lt;br /&gt; &lt;span class="comment"&gt;//create our context&lt;/span&gt;&lt;br /&gt; ctx = canvas.getContext(&amp;quot;2d&amp;quot;);&lt;br /&gt; &lt;span class="comment"&gt;//set out fill color, red = 0, green = 0, blue = 200, alpha = 0.5&lt;/span&gt;&lt;br /&gt; ctx.fillStyle = &amp;quot;rgba(0, 0, 200, 0.5)&amp;quot;;&lt;br /&gt; &lt;span class="comment"&gt;//begin our arc&lt;/span&gt;&lt;br /&gt; ctx.beginPath();&lt;br /&gt; &lt;span class="comment"&gt;//draw an arc, starting at 200, 200. 50 radius, angle starts at 0, and continues to 360 degrees (a cicle), and uses counter clockwise (false)&lt;/span&gt;&lt;br /&gt; ctx.arc(200, 200, 50, 0, (Math.PI/180)*360, false);&lt;br /&gt; &lt;span class="comment"&gt;//end our path&lt;/span&gt;&lt;br /&gt; ctx.closePath();&lt;br /&gt; &lt;span class="comment"&gt;//fill in the result&lt;/span&gt;&lt;br /&gt; ctx.fill();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;  &amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body onload=&amp;quot;draw()&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;style&amp;gt;&lt;br /&gt;canvas,&lt;br /&gt;body {&lt;br /&gt; margin: 0px;&lt;br /&gt; padding: 0px;&lt;br /&gt;}&lt;br /&gt;canvas {&lt;br /&gt; border: solid 1px;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&amp;lt;canvas width=&amp;quot;800&amp;quot; height=&amp;quot;600&amp;quot; id=&amp;quot;canvas&amp;quot;&amp;gt;&amp;lt;/canvas&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here is the example at work:&lt;br /&gt;&lt;br /&gt;&lt;script type="application/javascript"&gt; var ctx = null; function draw() { var canvas = document.getElementById("canvas"); ctx = canvas.getContext("2d"); ctx.fillStyle = "rgba(0, 0, 200, 0.5)"; ctx.beginPath(); ctx.arc(200, 200, 50, 0, (Math.PI/180)*360, false); ctx.closePath(); ctx.fill(); }&lt;/script&gt;&lt;style&gt;canvas, body { margin: 0px; padding: 0px; } canvas { border: solid 1px; }&lt;/style&gt;&lt;canvas width="600" height="600" id="canvas"&gt;&lt;/canvas&gt;&lt;script type="text/javascript"&gt; draw(); &lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Please leave your comments below!&lt;/h3&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-1856842866121268802?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/1856842866121268802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/07/using-canvas-in-firefox-and-safari-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/1856842866121268802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/1856842866121268802'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/07/using-canvas-in-firefox-and-safari-for.html' title='Using Canvas in Firefox and Safari for Graphics in your Browser'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-5921591920450871092</id><published>2010-06-23T10:37:00.001-07:00</published><updated>2010-06-23T10:53:59.355-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lambda'/><category scheme='http://www.blogger.com/atom/ns#' term='defining functions'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='syntax'/><category scheme='http://www.blogger.com/atom/ns#' term='functions'/><title type='text'>Lambda functions in Python</title><content type='html'>&lt;h1&gt;Using lambda functions in python. Defining a lambda function&lt;/h1&gt;&lt;br /&gt;&lt;h2&gt;Lambda functions in python can be somewhat confusing. Here is a brief introduction&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Lambda functions are handy functions that can be defined in 1 line, and thrown away afterwards. Here is a small example of what the syntax for a normal function looks like, and what the syntax for a lambda function looks like:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;def f(x): return x * x&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And here is the same function using the lambda syntax:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;f = lambda x : x * x&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Lambda functions really come in handy when used with python functions such as filter(), map() and reduce(). Here are some examples.&lt;br /&gt;&lt;br /&gt;First we have filter. It will return a copy of a list where the function you pass returns True. This example will return only even numbers (because any number mod 2 will be equal to 0 if it is even).&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;array = [1, 2, 3, 4, 5, 6] #create an array of integers&lt;br /&gt;print filter(lambda x: x % 2 == 0, array)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Output:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[2, 4, 6] # a list containing all even numbers&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Next we will show map. It is basically a mapping of one list to another using a function (or a lambda function):&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;array = [1, 2, 3, 4, 5, 6] #create an array of integers&lt;br /&gt;print map(lambda x: x * x, array)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Output:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[1, 4, 9, 16, 25, 36] # a list containing squares of 1, 2, 3, etc&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And finally we have reduce. What this will do is convert the list into a single value. Our function will add element 0 and element 1. That result is then added to element 3, that result is then added to element 4, etc. Eg. (((((1+2) + 3) + 4) + 5) + 6) = 21&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;array = [1, 2, 3, 4, 5, 6] #create an array of integers&lt;br /&gt;print reduce(lambda x, y: x + y, array)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Output: &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;21&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And that concludes our short tutorial on creating and using lambda functions&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-5921591920450871092?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/5921591920450871092/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/06/lambda-functions-in-python.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/5921591920450871092'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/5921591920450871092'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/06/lambda-functions-in-python.html' title='Lambda functions in Python'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-1072514028606106530</id><published>2010-06-23T10:15:00.000-07:00</published><updated>2010-06-23T10:31:24.812-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='def'/><category scheme='http://www.blogger.com/atom/ns#' term='defining functions'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='syntax'/><category scheme='http://www.blogger.com/atom/ns#' term='variables'/><category scheme='http://www.blogger.com/atom/ns#' term='functions'/><title type='text'>Python: Defining a function.</title><content type='html'>&lt;h1&gt;Defining a function in python&lt;/h1&gt;&lt;br /&gt;&lt;h2&gt;Python function definitions are simple. Defining a function in python is very similar to many other languages out there. Lets try it out:&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;def hello(x) :&lt;br /&gt;     print "Hello", x&lt;br /&gt;&lt;br /&gt;hello("Bill")&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Output is as follows&lt;/h2&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Hello Bill&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Notice we used print with a comma. This allows concatenation of strings in a single line statement.&lt;br /&gt;&lt;br /&gt;An interesting property of functions in python is that you are able to assign them to variables. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;variable1 = hello # assigns the variable "variable1" to the function we created above "hello"&lt;br /&gt;variable1("Sarah")&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Will output&lt;/h2&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Hello Sarah&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That is all for now. Thanks and please add comments.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-1072514028606106530?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/1072514028606106530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/06/python-defining-function.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/1072514028606106530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/1072514028606106530'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/06/python-defining-function.html' title='Python: Defining a function.'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-3028261394702804298</id><published>2010-06-21T12:57:00.000-07:00</published><updated>2010-06-21T13:00:04.833-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='open source'/><category scheme='http://www.blogger.com/atom/ns#' term='oss'/><category scheme='http://www.blogger.com/atom/ns#' term='Facebook'/><category scheme='http://www.blogger.com/atom/ns#' term='software'/><category scheme='http://www.blogger.com/atom/ns#' term='hardware'/><category scheme='http://www.blogger.com/atom/ns#' term='servers'/><title type='text'>Technology Behind Facebook OSS Open Source</title><content type='html'>&lt;h1&gt;Facebook and OSS server software and hardware setup&lt;/h1&gt;&lt;br /&gt;&lt;h2&gt;The software and hardware behind facebook&lt;/h2&gt;&lt;br /&gt;Love it or hate it, facebook has some great, open source software behind it. It has also contributed to the open source movement quite a bit. Here is an article I found interesting.&lt;br /&gt;&lt;br /&gt;&lt;a title="The software behind facebook" href="http://royal.pingdom.com/2010/06/18/the-software-behind-facebook/"&gt;http://royal.pingdom.com/2010/06/18/the-software-behind-facebook/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-3028261394702804298?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/3028261394702804298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/06/technology-behind-facebook-oss-open.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/3028261394702804298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/3028261394702804298'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/06/technology-behind-facebook-oss-open.html' title='Technology Behind Facebook OSS Open Source'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-2121829711548279583</id><published>2010-06-14T17:08:00.000-07:00</published><updated>2010-06-14T17:16:25.677-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='facebook chat server'/><category scheme='http://www.blogger.com/atom/ns#' term='Facebook'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Empathy'/><category scheme='http://www.blogger.com/atom/ns#' term='settings'/><category scheme='http://www.blogger.com/atom/ns#' term='facebook chat server settings'/><category scheme='http://www.blogger.com/atom/ns#' term='server settings'/><category scheme='http://www.blogger.com/atom/ns#' term='Book'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><category scheme='http://www.blogger.com/atom/ns#' term='Face'/><category scheme='http://www.blogger.com/atom/ns#' term='Chat'/><title type='text'>Facebook Chat in Empathy Ubuntu Linux</title><content type='html'>&lt;h1&gt;Using Facebook Chat in Ubuntu on Empathy&lt;/h1&gt;&lt;br /&gt;&lt;h2&gt;Facebook Chat Server Settings:&lt;/h2&gt;&lt;br /&gt;To set up the configuration:&lt;br /&gt;&lt;br /&gt;Click edit-&gt;accounts, then click the Add button.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Account Type: Jabber&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Reuse existing account&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Create&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Login ID: &amp;lt;username&amp;gt;@chat.facebook.com (Note you must create a facebook username if you have not already)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Under Advanced - Server: chat.facebook.com&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Then you are finished. Make sure SSL is disabled (which should be the default). Please leave some comments! Thanks!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-2121829711548279583?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/2121829711548279583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/06/facebook-chat-in-empathy-ubuntu-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/2121829711548279583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/2121829711548279583'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/06/facebook-chat-in-empathy-ubuntu-linux.html' title='Facebook Chat in Empathy Ubuntu Linux'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-1267908966723353001</id><published>2010-04-20T19:16:00.001-07:00</published><updated>2010-04-20T19:19:08.200-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='foreach'/><category scheme='http://www.blogger.com/atom/ns#' term='for loop'/><category scheme='http://www.blogger.com/atom/ns#' term='for'/><category scheme='http://www.blogger.com/atom/ns#' term='foreach equivalent'/><title type='text'>Javascript foreach equivalent</title><content type='html'>&lt;h1&gt;Javascript foreach equivalent&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;Javascript has no foreach statement. Instead, we use the following syntax.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;var letters = ["a","b","c"];&lt;br /&gt;&lt;br /&gt;for(var i in letter) {&lt;br /&gt;    alert(letters[i]);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note the variable i, is an index into the array, and not a reference to the array element.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-1267908966723353001?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/1267908966723353001/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/javascript-foreach-equivalent.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/1267908966723353001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/1267908966723353001'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/javascript-foreach-equivalent.html' title='Javascript foreach equivalent'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-1341453193195758627</id><published>2010-04-20T18:59:00.000-07:00</published><updated>2010-04-20T19:02:28.276-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='for loop'/><category scheme='http://www.blogger.com/atom/ns#' term='for'/><category scheme='http://www.blogger.com/atom/ns#' term='alert'/><title type='text'>Javascript FOR loop</title><content type='html'>&lt;h1&gt;A for loop in Javascript&lt;/h1&gt;&lt;br /&gt;&lt;h3&gt;A for loop in java or javascript is similar to a Java or C for loop&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;for(i = 0; i &lt; 3; i++){&lt;br /&gt;   alert(i);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;the variable i is the counter variable. It starts at 0. This loop runs, which will alert 0. Next it increments i, then returns to the start.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-1341453193195758627?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/1341453193195758627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/javascript-for-loop.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/1341453193195758627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/1341453193195758627'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/javascript-for-loop.html' title='Javascript FOR loop'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-7100435932108937527</id><published>2010-04-20T18:44:00.000-07:00</published><updated>2010-04-20T18:54:20.646-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript html tag'/><category scheme='http://www.blogger.com/atom/ns#' term='tag'/><category scheme='http://www.blogger.com/atom/ns#' term='html tags'/><category scheme='http://www.blogger.com/atom/ns#' term='external'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript external'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><title type='text'>Javascript HTML tags</title><content type='html'>&lt;h1&gt;Javascript HTML&lt;/h1&gt;&lt;br /&gt;&lt;h3&gt;In order to use javascript in a html document, you need a HTML file. A typical HTML file looks like this&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;   &amp;lt;body&amp;gt;&lt;br /&gt;      This is a HTML document&lt;br /&gt;   &amp;lt;/body&amp;gt;   &lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Inline&lt;/h2&gt;&lt;br /&gt;&lt;h3&gt;You can either put your script in the html document like so&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;   &amp;lt;body&amp;gt;&lt;br /&gt;      &amp;lt;script&amp;gt;&lt;br /&gt;         alert('Hello World');&lt;br /&gt;      &amp;lt;/script&amp;gt;&lt;br /&gt;      This is a HTML document&lt;br /&gt;   &amp;lt;/body&amp;gt;   &lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;External&lt;/h2&gt;&lt;br /&gt;&lt;h3&gt;or in an external file names script.js&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;   &amp;lt;body&amp;gt;&lt;br /&gt;      &amp;lt;script language="JavaScript" src="script.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;      This is a HTML document&lt;br /&gt;   &amp;lt;/body&amp;gt;   &lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-7100435932108937527?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/7100435932108937527/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/javascript-html-tags.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/7100435932108937527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/7100435932108937527'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/javascript-html-tags.html' title='Javascript HTML tags'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-5639681203688123823</id><published>2010-04-15T17:36:00.000-07:00</published><updated>2010-04-15T17:39:47.579-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='64 bit os'/><category scheme='http://www.blogger.com/atom/ns#' term='gpu'/><category scheme='http://www.blogger.com/atom/ns#' term='64 bit'/><category scheme='http://www.blogger.com/atom/ns#' term='Intel'/><title type='text'>64 Bit OS for Intel</title><content type='html'>Found an interesting site about a new 64 bit operating system that is purely 64 bit. Seems to be an interesting project&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.losethos.com/"&gt;http://www.losethos.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Sadly there is a blurb about the GPU and how it won't be supported. This of course makes me saddest of all! Interesting 3D graphics tho in the video on the site. Wonder if the rasterization code was written from scratch?&lt;br /&gt;&lt;br /&gt;Although I wont be loading this onto all of my 64 bit servers anytime soon, it does look like an interesting beginning.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-5639681203688123823?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/5639681203688123823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/64-bit-os-for-intel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/5639681203688123823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/5639681203688123823'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/64-bit-os-for-intel.html' title='64 Bit OS for Intel'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-561444419741529738</id><published>2010-04-14T19:54:00.000-07:00</published><updated>2010-04-14T20:02:50.669-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='depth texture'/><category scheme='http://www.blogger.com/atom/ns#' term='glsl'/><category scheme='http://www.blogger.com/atom/ns#' term='texture mapping'/><category scheme='http://www.blogger.com/atom/ns#' term='glsl texture mapping'/><category scheme='http://www.blogger.com/atom/ns#' term='openGL'/><category scheme='http://www.blogger.com/atom/ns#' term='multitexturing'/><title type='text'>Depth texturing in OpenGL GLSL Shader Program</title><content type='html'>&lt;h2&gt;Depth Texturing in GLSL&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;This GLSL shader program is used to enable depth texturing. The depth texture is located under texture unit 5 as shown:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;uniform sampler2DShadow texture_5;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note we had to pass the light's translation matrix in gl_TextureMatrix element 0 as shown:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;ShadowCoord = gl_TextureMatrix[0] * gl_Vertex;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here are the shaders&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Vertex Program&lt;/h3&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;varying vec4 diffuse,ambient;&lt;br /&gt;varying vec3 normal,lightDir,halfVector;&lt;br /&gt;varying vec4 ShadowCoord;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{ &lt;br /&gt; ShadowCoord = gl_TextureMatrix[0] * gl_Vertex;&lt;br /&gt;&lt;br /&gt; /* first transform the normal into eye space and &lt;br /&gt; normalize the result */&lt;br /&gt; normal = normalize(gl_NormalMatrix * gl_Normal);&lt;br /&gt; &lt;br /&gt; /* now normalize the light's direction. Note that &lt;br /&gt; according to the OpenGL specification, the light &lt;br /&gt; is stored in eye space. Also since we're talking about &lt;br /&gt; a directional light, the position field is actually direction */&lt;br /&gt; lightDir = normalize(vec3(gl_LightSource[0].position));&lt;br /&gt;&lt;br /&gt; /* Normalize the halfVector to pass it to the fragment shader */&lt;br /&gt; halfVector = normalize(gl_LightSource[0].halfVector.xyz);&lt;br /&gt;    &lt;br /&gt; /* Compute the diffuse, ambient and globalAmbient terms */&lt;br /&gt; diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse;&lt;br /&gt; ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient;&lt;br /&gt; ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient;&lt;br /&gt;&lt;br /&gt; gl_TexCoord[0] = gl_MultiTexCoord0;&lt;br /&gt; gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Fragment Program&lt;/h3&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;varying vec4 diffuse,ambient;&lt;br /&gt;varying vec3 normal,lightDir,halfVector;&lt;br /&gt;varying vec4 ShadowCoord;&lt;br /&gt;uniform sampler2D texture_0;&lt;br /&gt;uniform sampler2DShadow texture_5;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt; vec3 n,halfV;&lt;br /&gt; float NdotL,NdotHV;&lt;br /&gt; diffuse = texture2D(texture_0, gl_TexCoord[0].xy);&lt;br /&gt; ambient = vec4(0.0, 0.0, 0.0, 0.0);&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; vec4 shadowCoordinateWdivide = ShadowCoord / ShadowCoord.w;&lt;br /&gt; shadowCoordinateWdivide.z += 0.0001;&lt;br /&gt; float distanceFromLight = shadow2DProj(texture_5, shadowCoordinateWdivide).a;&lt;br /&gt; &lt;br /&gt; vec4 tc = shadowCoordinateWdivide;&lt;br /&gt; /*&lt;br /&gt;        MultiSample depth texture&lt;br /&gt;        float s = 0.00005;&lt;br /&gt; //float s = 1.0 / 10.0;&lt;br /&gt; //float d = distanceFromLight;&lt;br /&gt; float d1 = shadow2DProj(texture_5, vec4(tc.r+s, tc.g+s, tc.b, tc.a)).a;&lt;br /&gt; float d2 = shadow2DProj(texture_5, vec4(tc.r+s, tc.g-s, tc.b, tc.a)).a;&lt;br /&gt; float d3 = shadow2DProj(texture_5, vec4(tc.r-s, tc.g+s, tc.b, tc.a)).a;&lt;br /&gt; float d4 = shadow2DProj(texture_5, vec4(tc.r-s, tc.g-s, tc.b, tc.a)).a;&lt;br /&gt; float d5 = shadow2DProj(texture_5, vec4(tc.r+s, tc.g, tc.b, tc.a)).a;&lt;br /&gt; float d6 = shadow2DProj(texture_5, vec4(tc.r+s, tc.g, tc.b, tc.a)).a;&lt;br /&gt; float d7 = shadow2DProj(texture_5, vec4(tc.r-s, tc.g, tc.b, tc.a)).a;&lt;br /&gt; float d8 = shadow2DProj(texture_5, vec4(tc.r-s, tc.g, tc.b, tc.a)).a;*/&lt;br /&gt; &lt;br /&gt; /* The ambient term will always be present */&lt;br /&gt; vec4 color = ambient;&lt;br /&gt; &lt;br /&gt; /* a fragment shader can't write a varying variable, hence we need&lt;br /&gt; a new variable to store the normalized interpolated normal */&lt;br /&gt; n = normalize(normal);&lt;br /&gt; &lt;br /&gt; /* compute the dot product between normal and ldir */&lt;br /&gt; NdotL = max(dot(n,lightDir),0.0);&lt;br /&gt;&lt;br /&gt; if (NdotL &gt; 0.0) {&lt;br /&gt;  color += diffuse * NdotL;&lt;br /&gt;  halfV = normalize(halfVector);&lt;br /&gt;  NdotHV = max(dot(n,halfV),0.0);&lt;br /&gt;  color += gl_FrontMaterial.specular * &lt;br /&gt;    gl_LightSource[0].specular * &lt;br /&gt;    pow(NdotHV, gl_FrontMaterial.shininess);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; gl_FragColor = color;&lt;br /&gt; gl_FragColor.a = diffuse.a;&lt;br /&gt; &lt;br /&gt;  float shadow = 1.0;&lt;br /&gt;  if(ShadowCoord.w &gt; 0.0) {&lt;br /&gt;   shadow = distanceFromLight &lt; shadowCoordinateWdivide.z ? 0.2 : 1.0 ;&lt;br /&gt;  }&lt;br /&gt;   &lt;br /&gt;   gl_FragColor.rgb = shadow * gl_FragColor.rgb;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-561444419741529738?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/561444419741529738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/depth-texturing-in-opengl-glsl-shader.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/561444419741529738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/561444419741529738'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/depth-texturing-in-opengl-glsl-shader.html' title='Depth texturing in OpenGL GLSL Shader Program'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-936654651948772220</id><published>2010-04-11T18:54:00.001-07:00</published><updated>2010-04-11T18:58:19.177-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PID'/><category scheme='http://www.blogger.com/atom/ns#' term='fable'/><category scheme='http://www.blogger.com/atom/ns#' term='mfc42'/><category scheme='http://www.blogger.com/atom/ns#' term='winetricks'/><category scheme='http://www.blogger.com/atom/ns#' term='DLL'/><category scheme='http://www.blogger.com/atom/ns#' term='wine'/><category scheme='http://www.blogger.com/atom/ns#' term='installer'/><category scheme='http://www.blogger.com/atom/ns#' term='vcrun6'/><title type='text'>Fable the last chapters under wine</title><content type='html'>Hi Everyone,&lt;br /&gt;&lt;br /&gt;So I am attempting to set up fable using wine v 1.1.37. During the install, I get the error message "Error loading the PID generator DLL. The DLL could not be found!".&lt;br /&gt;&lt;br /&gt;To fix, get the winetricks script.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;wget http://www.kegel.com/wine/winetricks&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Then, we need to run the script to install MFC42 package. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;winetricks vcrun6&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And voila, the installer runs no problem&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-936654651948772220?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/936654651948772220/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/fable-last-chapters-under-wine.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/936654651948772220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/936654651948772220'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/fable-last-chapters-under-wine.html' title='Fable the last chapters under wine'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-7317448861601254446</id><published>2010-04-10T19:44:00.000-07:00</published><updated>2010-09-13T09:30:42.881-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elder scrolls oblivion'/><category scheme='http://www.blogger.com/atom/ns#' term='runs in wine'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='elder scrolls'/><category scheme='http://www.blogger.com/atom/ns#' term='oblivion'/><category scheme='http://www.blogger.com/atom/ns#' term='wine'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Oblivion in Wine : Bypass Securom</title><content type='html'>&lt;h1&gt;Installing Oblivion under linux wine Ubuntu&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;Attempting to install oblivion in linux to run under wine causes some problems for me. The problem is securom, or saferom. When you attempt to install oblivion under wine (I am using Ubuntu) the installer fails. We need to find a method to bypass securom so we can use wine to play the game.&lt;br /&gt;&lt;br /&gt;Since the install files are ultimately just tucked away inside some cab files, installation without using the actual installer is possible. All you have to do is use a tool called "Unsheild".&lt;br /&gt;&lt;br /&gt;Users who are using playonlinux should still be able to use this guide, and install the game. Later use playonlinux to actually run the game.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;What you will need to set up Oblivion&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;You will only need an open terminal and an ISO version of the disk. You could try this method with the DVD itself in the drive.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Mounting the ISO&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;I had to try this method in my attempt to install oblivion from some ISOs I had saved on my hard drive. What I ended up doing was mounting the ISO to my cdrom mount point:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;sudo mount -o loop /path/to/oblivion.iso /media/cdrom&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;replacing /path/to/oblivion.iso with the path to the actual ISO file.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Setting up Unsheild&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Then you need to install "Unsheild"&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;sudo apt-get install unsheild&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Installing Oblivion&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Then you run the command to "install" the game&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;unshield -d /path/to/install/to x /media/cdrom/data1.cab&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;replacing /path/to/install/to with the path you wish to install the game. This will extract all the cab contents to the specified folder.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Running the Game&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Next we run the game&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;wine /path/to/install/to/Oblivion/OblivionLauncher.exe&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-7317448861601254446?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/7317448861601254446/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/08/oblivion-in-wine-bypass-securom.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/7317448861601254446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/7317448861601254446'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/08/oblivion-in-wine-bypass-securom.html' title='Oblivion in Wine : Bypass Securom'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-1139173144249777090</id><published>2010-04-07T12:36:00.000-07:00</published><updated>2010-06-23T10:29:09.969-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='defining functions'/><category scheme='http://www.blogger.com/atom/ns#' term='case sensitive'/><category scheme='http://www.blogger.com/atom/ns#' term='functions'/><title type='text'>PHP's case sensitivity in function names</title><content type='html'>Hi Everyone,&lt;br /&gt;&lt;br /&gt;Just thought I'd toss out a random tidbit. I've found a program that tried to define a function name that conflicted with a global function name, but not like you would expect.&lt;br /&gt;&lt;br /&gt;They used camel case for the function name, when the system defined function didn't. Unfortunately function names in PHP are NOT case sensitive, as shown in the following experiment:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;function test_func() {&lt;br /&gt;        echo 'test_func';&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function Test_Func() {&lt;br /&gt;        echo 'Test_Func';&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Running this script gives:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;bill-hamiltons-imac:~ bill$ php test.php &lt;br /&gt;&lt;br /&gt;Fatal error: Cannot redeclare test_func() (previously declared in /Users/bill/test.php:4) in /Users/bill/test.php on line 9&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So there you have it. PHP function names are not case sensitive which some of you may already know but this is obviously the proof.&lt;br /&gt;&lt;br /&gt;Thanks!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-1139173144249777090?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/1139173144249777090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/phps-case-sensitivity-in-function-names.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/1139173144249777090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/1139173144249777090'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/phps-case-sensitivity-in-function-names.html' title='PHP&apos;s case sensitivity in function names'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-3701080026687082265</id><published>2010-04-01T13:48:00.001-07:00</published><updated>2010-09-20T20:03:13.083-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='game engine'/><category scheme='http://www.blogger.com/atom/ns#' term='general purpose GPU'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='GPGPU'/><category scheme='http://www.blogger.com/atom/ns#' term='physics'/><title type='text'>Programming Games in Python</title><content type='html'>&lt;h2&gt;Programming Linux Games - Prototyping in Python&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Hi Everyone,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Its been awhile since I've posted on topics related to game programming. Basically I am here to talk about programming games in Python programming language. I have programmed in many languages including C and C++ and even developed graphics engines in these languages. Eventually I get to a point where the code is large and basically I sit pondering where to go next in order to add features, and also get lost in semantics of the languages and how I will accomplish these goals.&lt;br /&gt;&lt;br /&gt;Next I started trying out python, in order to prototype new features. I have written rather large programs in python before, and the one thing I got out of it is that its very fast for writing programs, and also very type safe. So if you try to compare and int with a float, it will raise an exception. This sounds like a headache, but really its a dream for debugging later on!&lt;br /&gt;&lt;br /&gt;Some problems you may be thinking is 1) Python is slow. Right you are, python is rather slow compared to languages like C++ and C, but only in specific cases. For example, iterating through arrays can be much faster in C and C++. Memory usage is also less because you are working with more primitive data types. Also python does constant checking of variable types, etc.&lt;br /&gt;&lt;br /&gt;When it comes to games, I feel that today's processors are very fast. Not only that, but many of the heaviest tasks are getting put onto the GPU, which has limited choice in programming languages, and they are mostly low level. Tasks like physics, rasterization are now completely done on the GPU, and now the trend seems to be even using the GPU for general processing tasks (GPGPU).&lt;br /&gt;&lt;br /&gt;Back to the point, python's speed limitations no longer apply considering we are pushing all the data to the GPU and allowing it to do all the work with its languages. There are some things left to the CPU, like event handling, playing sounds, and some basic math (debatable as to perform on GPU or CPU) which I think my quad core can handle quite easily thank you!&lt;br /&gt;&lt;br /&gt;Further more, threading in python is very easy however you still need to be very careful as to how you set up variable access etc.&lt;br /&gt;&lt;br /&gt;As I will show in future blog posts, using python for game development should become a reality because its so type safe, it allows you to program things quickly (functionally) and then allows you to push all the data to the GPU very easily. Currently I am working on a GPGPU processing program written in python, and it should come in under 1000 lines of code!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-3701080026687082265?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/3701080026687082265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/programming-games-in-python.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/3701080026687082265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/3701080026687082265'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/programming-games-in-python.html' title='Programming Games in Python'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-8250791410045698898</id><published>2010-04-01T12:13:00.001-07:00</published><updated>2010-04-01T18:29:28.319-07:00</updated><title type='text'>Wow that is a large starbuck's coffee</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://assets.starbucks.com/assets/F1AD20D3E56B47C99E920C9794F17EE4.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 577px; height: 300px;" src="http://assets.starbucks.com/assets/F1AD20D3E56B47C99E920C9794F17EE4.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Just found a link to starbucks doing some market research. Im glad they are listening to their customers but I think this size "Plenta" is a little over the top. I mean seriously you should not need that much coffee, what is that an entire pot?!? Check out the link. This is real folks!!&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.starbucks.com/blog/10113/starbucks-listens-to-customer-request-for-more-sizes.aspx" title="Starbucks introduces new coffee sizes"&gt;http://www.starbucks.com/blog/10113/starbucks-listens-to-customer-request-for-more-sizes.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Happy april fools I guess haha!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-8250791410045698898?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/8250791410045698898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/wow-that-is-large-starbucks-coffee.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/8250791410045698898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/8250791410045698898'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/04/wow-that-is-large-starbucks-coffee.html' title='Wow that is a large starbuck&apos;s coffee'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-168602422040180202</id><published>2010-03-03T12:44:00.000-08:00</published><updated>2010-06-23T22:35:44.138-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='glsl'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='using'/><category scheme='http://www.blogger.com/atom/ns#' term='linking'/><category scheme='http://www.blogger.com/atom/ns#' term='shader programs'/><category scheme='http://www.blogger.com/atom/ns#' term='pyopengl'/><category scheme='http://www.blogger.com/atom/ns#' term='openGL'/><category scheme='http://www.blogger.com/atom/ns#' term='compiling'/><title type='text'>Using GLSL programs in python pyopengl</title><content type='html'>Here is an easy straightforward example of using GLSL shader programs with pyopengl.&lt;br /&gt;&lt;br /&gt;To use this you will need to import the following:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;from OpenGL.GL import *&lt;br /&gt;from OpenGL.GLU import *&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thus we will need pyopengl package installed.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt; ##compile and link shader&lt;br /&gt; vs = fs = 0&lt;br /&gt; &lt;br /&gt; vs = glCreateShader(GL_VERTEX_SHADER)&lt;br /&gt; fs = glCreateShader(GL_FRAGMENT_SHADER)&lt;br /&gt; &lt;br /&gt; vs_source = """&lt;br /&gt;  void main(void) {&lt;br /&gt;     gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;&lt;br /&gt;  }&lt;br /&gt; """&lt;br /&gt; fs_source = """&lt;br /&gt;  void main (void)  {     &lt;br /&gt;     gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);  &lt;br /&gt;  } &lt;br /&gt; """&lt;br /&gt; glShaderSource(vs, vs_source)&lt;br /&gt; glShaderSource(fs, fs_source)&lt;br /&gt; &lt;br /&gt; glCompileShader(vs)&lt;br /&gt; log = glGetShaderInfoLog(vs)&lt;br /&gt; if log: print 'Vertex Shader: ', log&lt;br /&gt; &lt;br /&gt; glCompileShader(fs)&lt;br /&gt; log = glGetShaderInfoLog(fs)&lt;br /&gt; if log: print 'Fragment Shader: ', log&lt;br /&gt; &lt;br /&gt; prog = glCreateProgram()&lt;br /&gt; glAttachShader(prog, vs)&lt;br /&gt; glAttachShader(prog, fs)&lt;br /&gt;&lt;br /&gt; glLinkProgram(prog)&lt;br /&gt; glUseProgram(prog)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;glShaderSource(shader_id, text) is a handy python function that will load our shader for us into opengl.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I also have a handy shader class I use in my engine program. Here it is:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class shader(node) :&lt;br /&gt; def __init__(self, filename):&lt;br /&gt;  node.__init__(self)&lt;br /&gt;  fh = open(filename)  &lt;br /&gt;  self.source = {'vertex': '', 'fragment':''}&lt;br /&gt;  write = None&lt;br /&gt;  for line in fh :&lt;br /&gt;   if line == '[[vertex-program]]\n' : &lt;br /&gt;    write = 'vertex'&lt;br /&gt;   elif line == '[[fragment-program]]\n' : &lt;br /&gt;    write = 'fragment'&lt;br /&gt;   else :&lt;br /&gt;    self.source[write] += line&lt;br /&gt;    &lt;br /&gt;  self.draw = self.init&lt;br /&gt;    &lt;br /&gt; def init(self):&lt;br /&gt;  ##compile and link shader&lt;br /&gt;  self.vs = self.fs = 0&lt;br /&gt;&lt;br /&gt;  self.vs = glCreateShader(GL_VERTEX_SHADER)&lt;br /&gt;  self.fs = glCreateShader(GL_FRAGMENT_SHADER)&lt;br /&gt;&lt;br /&gt;  glShaderSource(self.vs, self.source['vertex'])&lt;br /&gt;  glShaderSource(self.fs, self.source['fragment'])&lt;br /&gt;&lt;br /&gt;  glCompileShader(self.vs)&lt;br /&gt;  log = glGetShaderInfoLog(self.vs)&lt;br /&gt;  if log: print 'Vertex Shader: ', log&lt;br /&gt;&lt;br /&gt;  glCompileShader(self.fs)&lt;br /&gt;  log = glGetShaderInfoLog(self.fs)&lt;br /&gt;  if log: print 'Fragment Shader: ', log&lt;br /&gt;&lt;br /&gt;  self.prog = glCreateProgram()&lt;br /&gt;  glAttachShader(self.prog, self.vs)&lt;br /&gt;  glAttachShader(self.prog, self.fs)&lt;br /&gt;&lt;br /&gt;  glLinkProgram(self.prog)&lt;br /&gt;  self.use()&lt;br /&gt;  self.draw = self.use&lt;br /&gt;&lt;br /&gt; def use(self):&lt;br /&gt;  glUseProgram(self.prog)&lt;br /&gt;  &lt;br /&gt; def end(self):&lt;br /&gt;  glUseProgram(0)&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-168602422040180202?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/168602422040180202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/03/using-glsl-in-python-pyopengl.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/168602422040180202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/168602422040180202'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/03/using-glsl-in-python-pyopengl.html' title='Using GLSL programs in python pyopengl'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-6930005578190876891</id><published>2010-03-03T09:21:00.000-08:00</published><updated>2010-09-13T09:35:52.783-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='drawarrays'/><category scheme='http://www.blogger.com/atom/ns#' term='coordinates'/><category scheme='http://www.blogger.com/atom/ns#' term='uv'/><category scheme='http://www.blogger.com/atom/ns#' term='wavefront'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='multiple uv islands'/><category scheme='http://www.blogger.com/atom/ns#' term='pyopengl'/><category scheme='http://www.blogger.com/atom/ns#' term='openGL'/><category scheme='http://www.blogger.com/atom/ns#' term='obj'/><title type='text'>Wavefront Obj file format, opengl vertex arrays format, and uv texture coords</title><content type='html'>&lt;h1&gt;Loading Wavefront files using Python&lt;/h1&gt;&lt;br /&gt;&lt;h2&gt;Loading .obj files into numpy arrays, then using OpenGL to draw them&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Note: for information on parsing wavefront .obj format click here&lt;br /&gt;&lt;br /&gt;Our task here is to load wavefront .obj files into numpy arrays and use them in OpenGL, or pyOpenGL of course.&lt;br /&gt;&lt;br /&gt;I am here to discuss something that has always bothered me in openGL. The fact that the vertex arrays and glDrawElements uses only 1 pointer to draw the elements, when in reality, it should use 2 (at least). This could be solved by writing special GLSL vertex shaders and using vertex textures, but that is overly complicated.&lt;br /&gt;&lt;br /&gt;Understanding the problem:&lt;br /&gt;&lt;br /&gt;The problem with indexing a vertex is the texture coordinate. If you are going to have UV islands, you will see that each vertex at that point, will have more than 1 texture coordinate. This means that there is no 1:1 mapping between a vertex, and a texture coordinate, and this breaks the 1 array indexing multiple verticies in an array, and also breaks the glDrawElements method. &lt;br /&gt;&lt;br /&gt;The solution?&lt;br /&gt;&lt;br /&gt;We basically unravel the arrays, reusing as many vertex:uv mappings as we can, but create new indexes when they differ.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Visual Examples:&lt;br /&gt;&lt;pre&gt; &lt;br /&gt;v1  v2   v3&lt;br /&gt; --- ---&lt;br /&gt;|      |      | - 2 quads connected&lt;br /&gt; --- ---&lt;br /&gt;v4  v5   v6&lt;br /&gt;&lt;br /&gt;v1 v2  v2  v3&lt;br /&gt; ---     ---     &lt;br /&gt;|      |   |      |   - UV coordinates NOT connected&lt;br /&gt; ---     ---&lt;br /&gt;v4  v5 v5   v6&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In this example may you see that v2 and v5 don't share UV coordinates, so they will need to have 4 indexies into our index array (because the index array indexes both UV coordinates and Vertex coordinates)&lt;br /&gt;&lt;br /&gt;How will we take care of this?&lt;br /&gt;&lt;br /&gt;What we are going to do is write a python parser for OBJ files, parse it into the traditional array structure that is laid out in the file. Then we are going to unravel it and create secondary arrays that will work with the glDrawElements.&lt;br /&gt;&lt;br /&gt;Code:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;from numpy import *&lt;br /&gt;import random&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#util to unravel&lt;br /&gt;indexies = dict()&lt;br /&gt;counter = -1&lt;br /&gt;def get_index(key) :&lt;br /&gt; global indexies, counter&lt;br /&gt; if key not in indexies :&lt;br /&gt;  counter += 1&lt;br /&gt;  indexies[key] = counter&lt;br /&gt;  return [False, counter]&lt;br /&gt; else :&lt;br /&gt;  return [True, indexies[key]]&lt;br /&gt;&lt;br /&gt;#do the loading of the obj file&lt;br /&gt;def load_obj(filename) :&lt;br /&gt; V = [] #vertex&lt;br /&gt; T = [] #texcoords&lt;br /&gt; N = [] #normals&lt;br /&gt; F = [] #face indexies&lt;br /&gt;&lt;br /&gt; fh = open(filename)&lt;br /&gt; for line in fh :&lt;br /&gt;  if line[0] == '#' : continue&lt;br /&gt; &lt;br /&gt;  line = line.strip().split(' ')&lt;br /&gt;  if line[0] == 'v' : #vertex&lt;br /&gt;   V.append(line[1:])&lt;br /&gt;  elif line[0] == 'vt' : #tex-coord&lt;br /&gt;   T.append(line[1:])&lt;br /&gt;  elif line[0] == 'vn' : #normal vector&lt;br /&gt;   N.append(line[1:])&lt;br /&gt;  elif line[0] == 'f' : #face&lt;br /&gt;   face = line[1:]&lt;br /&gt;   if len(face) != 4 : &lt;br /&gt;    print line&lt;br /&gt;    #raise Exception('not a quad!')&lt;br /&gt;    continue&lt;br /&gt;   for i in range(0, len(face)) :&lt;br /&gt;    face[i] = face[i].split('/')&lt;br /&gt;    # OBJ indexies are 1 based not 0 based hence the -1&lt;br /&gt;    # convert indexies to integer&lt;br /&gt;    for j in range(0, len(face[i])) : face[i][j] = int(face[i][j]) - 1&lt;br /&gt;   F.append(face)&lt;br /&gt;  &lt;br /&gt; #Now we lay out all the vertex/texcoord/normal data into a flat array&lt;br /&gt; #and try to reuse as much as possible using a hash key&lt;br /&gt;  &lt;br /&gt; V2 = []&lt;br /&gt; T2 = []&lt;br /&gt; N2 = []&lt;br /&gt; C2 = []&lt;br /&gt; F2 = []&lt;br /&gt;&lt;br /&gt; for face in F :&lt;br /&gt;  for index in face :&lt;br /&gt;   #print V[index[0]], T[index[1]], N[index[2]]&lt;br /&gt;   key = '%s%s%s%s%s' % (V[index[0]][0], V[index[0]][1], V[index[0]][2], T[index[1]][0], T[index[1]][1])&lt;br /&gt;   idx = get_index(key)&lt;br /&gt;  &lt;br /&gt;   if not idx[0] :&lt;br /&gt;    V2.append([float(V[index[0]][0]), float(V[index[0]][1]), float(V[index[0]][2])])&lt;br /&gt;    T2.append([float(T[index[1]][0]), float(T[index[1]][1])])&lt;br /&gt;    N2.append([float(N[index[2]][0]), float(N[index[2]][1]), float(N[index[2]][2])])&lt;br /&gt;    C2.append([random.random(), random.random(), random.random()])&lt;br /&gt;&lt;br /&gt;   F2.append(idx[1])&lt;br /&gt; &lt;br /&gt; print len(V) * 3 * 4, 'bytes compared to', len(V2) * 3 * 4, 'bytes'&lt;br /&gt; &lt;br /&gt; #return numpy arrays&lt;br /&gt; return [&lt;br /&gt;  array(V2, dtype=float32), &lt;br /&gt;  array(T2, dtype=float32), &lt;br /&gt;  array(N2, dtype=float32), &lt;br /&gt;  array(C2, dtype=float32), &lt;br /&gt;  array(F2, dtype=uint32)&lt;br /&gt; ]&lt;br /&gt;  &lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-6930005578190876891?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/6930005578190876891/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/03/wavefront-obj-file-format-opengl-vertex.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/6930005578190876891'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/6930005578190876891'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/03/wavefront-obj-file-format-opengl-vertex.html' title='Wavefront Obj file format, opengl vertex arrays format, and uv texture coords'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-3696807269020516898</id><published>2010-02-24T11:39:00.000-08:00</published><updated>2010-06-23T10:29:25.609-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='data'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='funny'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><category scheme='http://www.blogger.com/atom/ns#' term='asp'/><title type='text'>Funny Web Accidents</title><content type='html'>Good News Everyone, &lt;br /&gt;&lt;br /&gt;Terrible news everyone... haha. Thought I would post something funny I have found, MAN Google can be fun. Check out site site: http://www.moveandstay.com/melbourne-shopping.php&lt;br /&gt;&lt;br /&gt;Now answer the BONUS QUESTION: what does "phpects" mean?&lt;br /&gt;&lt;br /&gt;Hint (spoiler alert), ever tried replacing ASP with PHP?&lt;br /&gt;&lt;br /&gt;HAHA!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-3696807269020516898?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/3696807269020516898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/02/funny-web-accidents.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/3696807269020516898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/3696807269020516898'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/02/funny-web-accidents.html' title='Funny Web Accidents'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-3984886033543505928</id><published>2010-02-23T19:54:00.001-08:00</published><updated>2010-06-23T10:27:43.799-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gcc'/><category scheme='http://www.blogger.com/atom/ns#' term='optimizations'/><category scheme='http://www.blogger.com/atom/ns#' term='wine'/><category scheme='http://www.blogger.com/atom/ns#' term='compiling'/><title type='text'>Compiling wine with processor optimizations</title><content type='html'>Hi everyone,&lt;br /&gt;&lt;br /&gt;Just thought I would show you all a quick trick to compile wine to be as fast as it can be!&lt;br /&gt;&lt;br /&gt;You need to look into your compiler (GCC) and which flags it will support for your processor. Since I have an AMD Phenom II, I used -march=amdfam10 for GCC.&lt;br /&gt;&lt;br /&gt;Here is a link where you can find out which -march to use :&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.gentoo-wiki.com/wiki/Safe_Cflags/AMD"&gt;http://en.gentoo-wiki.com/wiki/Safe_Cflags/AMD&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Note that link is for AMD not sure where intel info is.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;CFLAGS="-march=amdfam10 -O2 -pipe -fomit-frame-pointer"&lt;br /&gt;CXXFLAGS="${CFLAGS}"&lt;br /&gt;export CFLAGS&lt;br /&gt;export CXXFLAGS&lt;br /&gt;./configure --disable-test&lt;br /&gt;make depend &amp;&amp; make&lt;br /&gt;sudo make install&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And we're done!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-3984886033543505928?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/3984886033543505928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/02/compiling-wine-with-processor.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/3984886033543505928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/3984886033543505928'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/02/compiling-wine-with-processor.html' title='Compiling wine with processor optimizations'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-3277726618623809554</id><published>2010-02-18T14:24:00.001-08:00</published><updated>2010-09-20T19:58:19.607-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='application'/><category scheme='http://www.blogger.com/atom/ns#' term='app'/><category scheme='http://www.blogger.com/atom/ns#' term='Facebook'/><category scheme='http://www.blogger.com/atom/ns#' term='api'/><category scheme='http://www.blogger.com/atom/ns#' term='apps'/><category scheme='http://www.blogger.com/atom/ns#' term='FQL'/><title type='text'>Using Facebook API and using FQL</title><content type='html'>&lt;h1&gt;Using FQL Facebook Query Language&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Preliminary&lt;/h2&gt;&lt;br /&gt;So you've made a facebook application, and you want to start using FQL to query all sorts of interesting things from Facebook's massive database of users&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Facebook FQL Programming APIs&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;There are many API's available for facebook to access the FQL language. Some are for PHP and there are some for python (my favourite).&lt;br /&gt;&lt;br /&gt;Aparently there is also one available using HTTP at the following url:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;https://api.facebook.com/method/fql.query?query=QUERY&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;We will be using PHP. You must download the Facebook PHP client library. In our PHP script, we include the main file as shown:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;include_once '/path-to-api/facebook-platform/php/facebook.php';&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Diving In&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Next, we create our instance of our facebook object:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$facebook = new Facebook('API_KEY','SECRET_KEY');&lt;br /&gt;$fb_user = $facebook-&gt;require_login(); //require that we log in, because we need the user's id&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Make sure you replace the API_KEY and SECRET_KEY with the proper strings, or also you could use php's define. Now what I wanted to do with FQL is generate a list of all the "Pages" that I have created under my account. I created well over 100 so I needed an easy way to get that list. Here is the example FQL query:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;SELECT &lt;br /&gt;   page_id, &lt;br /&gt;   name, &lt;br /&gt;   page_url, &lt;br /&gt;   fan_count &lt;br /&gt;FROM &lt;br /&gt;   page &lt;br /&gt;WHERE &lt;br /&gt;   page_id IN (SELECT uid, page_id FROM page_admin WHERE uid = {$uid})&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;(Edit)&lt;br /&gt;Note: FQL does not support standard SQL like JOIN, thus we use the subquery shown and the IN operator.&lt;br /&gt;&lt;br /&gt;We use the client fundion "fql_query" in order to return the results of this query. Note I have {$uid} in there, that must also be replaced with the user's ID who created all those pages. Here is the PHP code I used for this:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$uid = $facebook-&gt;api_client-&gt;user; // get the user id&lt;br /&gt;$query = "SELECT page_id, name, page_url, fan_count FROM page WHERE page_id IN (SELECT uid, page_id FROM page_admin WHERE uid = {$uid})";&lt;br /&gt;$res = $facebook-&gt;api_client-&gt;fql_query($query);&lt;br /&gt;print_r($res);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;There you have it! For more info on FQL see the official API documentation here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://wiki.developers.facebook.com/index.php/FQL"&gt;FQL Documentation&lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.developers.facebook.com/index.php/FQL_Tables"&gt;List of FQL Tables available for query&lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.developers.facebook.com/index.php/Sample_FQL_Queries"&gt;Sample FQL queries&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-3277726618623809554?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/3277726618623809554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/02/using-facebook-api-and-using-fql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/3277726618623809554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/3277726618623809554'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/02/using-facebook-api-and-using-fql.html' title='Using Facebook API and using FQL'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-2061653375842186884</id><published>2010-02-17T21:55:00.000-08:00</published><updated>2010-06-23T10:26:06.100-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='glsl'/><category scheme='http://www.blogger.com/atom/ns#' term='openGL'/><category scheme='http://www.blogger.com/atom/ns#' term='fragment'/><category scheme='http://www.blogger.com/atom/ns#' term='vertex'/><title type='text'>GLSL Shader Examples Vertex and Fragment</title><content type='html'>Hi Everyone,&lt;br /&gt;&lt;br /&gt;Here is a quick example of a GLSL shader I use in my c++ 3d engine. Just thought I'd share some of the GLSL syntax with the internet community. I will fill in more information soon!&lt;br /&gt;&lt;br /&gt;Vertex Shader&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;varying vec3 normal;&lt;br /&gt;&lt;br /&gt;void main() { &lt;br /&gt;&lt;br /&gt; normal = normalize(gl_NormalMatrix * gl_Normal);&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; //gl_Position = gl_ModelViewMatrix * gl_Vertex;&lt;br /&gt;&lt;br /&gt; /*vec2 test = vec2((gl_MultiTexCoord0.xy - 0.5) * 2.0);&lt;br /&gt; test.x *= 1.01;&lt;br /&gt; test.y *= 1.01;&lt;br /&gt; gl_Position.xy = test.xy;&lt;br /&gt; gl_Position.z = 0.0;&lt;br /&gt; gl_Position.w = 1.0;*/&lt;br /&gt; &lt;br /&gt; gl_Position = ftransform();&lt;br /&gt; gl_TexCoord[0] = gl_MultiTexCoord0;&lt;br /&gt;} &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Fragment Shader&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;uniform sampler2D texture_0;&lt;br /&gt;uniform sampler2D texture_1;&lt;br /&gt;varying vec3 normal;&lt;br /&gt;&lt;br /&gt;void main() {&lt;br /&gt; vec4 color = vec4(texture2D(texture_0, gl_TexCoord[0].xy));&lt;br /&gt; float NdotL,NdotHV;&lt;br /&gt; vec3 lDir = vec3(0.0, 0.0, 1.0);&lt;br /&gt; &lt;br /&gt; if(color.r + color.g + color.b == 0.0)&lt;br /&gt;  color = vec4(1.0, 1.0, 1.0, 1.0);&lt;br /&gt; &lt;br /&gt; if(color.r &lt; 0.85)&lt;br /&gt;  color.r = 0.0;&lt;br /&gt;  &lt;br /&gt; color.g = color.r;&lt;br /&gt; color.b = color.r;&lt;br /&gt; //color.a = color.r;&lt;br /&gt; &lt;br /&gt; vec3 n = normalize(normal);&lt;br /&gt; NdotL = max(dot(n,lDir),0.0);&lt;br /&gt; color.rgb *= NdotL;&lt;br /&gt; gl_FragColor = color;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-2061653375842186884?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/2061653375842186884/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/02/glsl-shader-examples-vertex-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/2061653375842186884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/2061653375842186884'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/02/glsl-shader-examples-vertex-and.html' title='GLSL Shader Examples Vertex and Fragment'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-909871506456690785.post-7178606860747975112</id><published>2010-02-11T21:58:00.000-08:00</published><updated>2010-06-14T17:26:51.836-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='runs in wine'/><category scheme='http://www.blogger.com/atom/ns#' term='mass effect 2'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='wine'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Mass Effect 2 Runs in Wine in Ubuntu Linux</title><content type='html'>&lt;h1&gt;Mass Effect 2 using Linux in Wine&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Get Wine&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;So I got mass effect 2 working in wine. Man is it a great game. To get it to work in wine:&lt;br /&gt;&lt;br /&gt;go here and download wine (latest version as of now 1.1.38) http://sourceforge.net/projects/wine/files/Source/wine-1.1.38.tar.bz2/download&lt;br /&gt;&lt;br /&gt;(note I would recommend 1.1.38 if you want to use the patches below)&lt;br /&gt;&lt;br /&gt;extract and enter the directory in the terminal. Now we need to run the configure script:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;./configure&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Or to speed up compilation:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;./configure --disable-tests&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Which will skip compiling the wine test suite which generally you won't need.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Patching&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Two patch files are located at:&lt;br /&gt;&lt;a href="http://bugs2.winehq.org/attachment.cgi?id=15638"&gt;http://bugs2.winehq.org/attachment.cgi?id=15638&lt;/a&gt; for the mouse warping&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bugs.winehq.org/attachment.cgi?id=26032"&gt;http://bugs.winehq.org/attachment.cgi?id=26032&lt;/a&gt; for crashes (I didnt seem to need this patch)&lt;br /&gt;&lt;br /&gt;Next, you will need to apply some patches. There is one for crashing, and another to fix the mouse warping. I don't have these on hand at the moment. I couldn't get my mouse warping to work properly, so I edited mouse.c under dlls/dinput/ and made it so mouse button 3 would toggle mouse warp (on / off) which is a pain but makes the game more playable. To apply patches to a source, under the source tree, type:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;#patch -p1 &lt; NAMEOFPATCHFILE&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Afterwards you can compile as shown below.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Compile&lt;/h2&gt;&lt;br /&gt;Ensure that you have XML support compiled in, as well as openal. You can determine this through the final output of the configure script. If you don't have the xml and openal dev packages, install them with your favourite package editor.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;make&lt;br /&gt;sudo make install&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Again, an interesting way to speed up compilation on a multi core machine is to use:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;make -j 4&lt;br /&gt;sudo make install&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can replace "-j 4" with the number of processors you have (I have a quad core).&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Finally&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;now run "winecfg" and set up a virtual desktop (I have to using nvidia latest binary driver geforce 9600).&lt;br /&gt;&lt;br /&gt;Also, we need to install packages with winetricks to get this to work&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;wget http://www.kegel.com/wine/winetricks&lt;br /&gt;sh winetricks d3dx9 d3dx10 vcrun2005 physx&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now run the installer, and finally run the game. I am able to play on full settings with 1900x1080 resolution :D&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/909871506456690785-7178606860747975112?l=programminglinuxgames.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminglinuxgames.blogspot.com/feeds/7178606860747975112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/02/mass-effect-2-in-wine.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/7178606860747975112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/909871506456690785/posts/default/7178606860747975112'/><link rel='alternate' type='text/html' href='http://programminglinuxgames.blogspot.com/2010/02/mass-effect-2-in-wine.html' title='Mass Effect 2 Runs in Wine in Ubuntu Linux'/><author><name>WH</name><uri>http://www.blogger.com/profile/16562556011003748345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_TejnEO662i4/S33GYRSXYaI/AAAAAAAAAAM/v1VgLb0O29Q/S220/profile_pic.jpg'/></author><thr:total>4</thr:total></entry></feed>
