Open sourced (Flickr OpenGL C# Library)

March 20, 2007 — Leave a comment

Crossposted from cellardoorsw.com:

I GPL licensed all the source to Slickr (that I wrote), and released it into the wild. You can view the trac page, or go straight to the source. Its all C# and OpenGL goodness with some gnarly calls to some windows api’s (for extra’s nothing critical). There are a couple NAnt build scripts for when I was trying to get it working under linux, but you’ll want Visual Studio (2003) to get started quick (and look at the README).
Who knew it would be such a pain to draw text and did I really need to query the monitor power state?

I’ll try to write an overall design doc soon, but until then start at any of the Entrypoint‘s. And in the end all that is really going on is this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
private void DrawGLTexture(SlickrImage image)
{
  PointFloat p = image.GetMovement(window.Width, window.Height, true);
  float scale = image.GetScale(window.Width, window.Height);
  float fade = image.GetPercentageFade();
  int texWidth = image.TextureWidth;
  int texHeight = image.TextureHeight;

  Gl.glMatrixMode(Gl.GL_PROJECTION);                                  // Select The Projection Matrix
  Gl.glLoadIdentity();                                                // Reset The Projection Matrix
  float r = (window.Width/scale);
  float b = (window.Height/scale);

  Gl.glOrtho(0, r, b, 0, -1.0f, 1.0f);
  Gl.glMatrixMode(Gl.GL_MODELVIEW);                                   // Select The Modelview Matrix
  Gl.glLoadIdentity();

  Gl.glEnable (Gl.GL_BLEND); // for text fading
  Gl.glBlendFunc (Gl.GL_ONE, Gl.GL_ONE_MINUS_SRC_ALPHA);
  Gl.glColor4f (fade, fade, fade, fade);

  float posX = p.x; //stepX +
  float posY = p.y; //stepY +

  image.DrawAtPoint(posX, posY);

  Gl.glDisable(Gl.GL_BLEND);
}

If you are interesting in working on bug fixes, enhacements, or whatever give me a shout.

No Comments

Be the first to start the conversation!

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s