Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - LB

Pages: [1]
1
General / Installing ruby-opengl on Windows and Ruby 1.9.
« on: December 01, 2011, 05:46:20 pm »
First: Follow this tutorial: https://groups.google.com/d/msg/rubyinstaller/vMR5mQVA_88/aZqLyjyQiSYJ (by Tomasz Błajek).

You will get an error with last step (building the gem). At this point you should have this directory tree:

Code: [Select]
(folder) doc
(folder) examples
(folder) ext
(folder) lib
(folder) test
 (file)  metadata
 (file)  Rakefile


Open "metadata" and add after line 13:

Code: [Select]
licenses: []

Then run:

Code: [Select]
gem build metadata

After you will have to download and install Glut to the devkit. Download it here: http://user.xmission.com/~nate/glut.html (the bin option).

Unpack and move 'glut.h' to "<devkit path>\mingw\include\GL", 'glut32.lib' to "<devkit path>\mingw\lib" and 'glut32.dll' to "C:\Windows\System32".

Now run:

Code: [Select]
gem install ruby-opengl-0.60.1.gem

You shouldn't get any errors.

(I'm now testing it with rbSFML.)

2
SFML projects / HQx Magnification Filter
« on: August 12, 2011, 01:16:02 am »
This is a extension to apply the HQ2x/HQ3x/HQ4x algorithm with SFML images. The interface is pretty simple, with this methods:

Code: [Select]
namespace sfe {
  using namespace sf;
 
  // Initializes the HQx algorithm. Takes about one second and 64MB of RAM.
  // This is called automatically by the methods below, if necessary.
  inline void InitHQx();
 
  // Receives a sf::Image and returns a 2-times bigger sf::Image, using the
  // HQ2x magnification algorithm.
  Image HQ2x(const Image& input);
 
  // Receives a sf::Image and returns a 3-times bigger sf::Image, using the
  // HQ3x magnification algorithm.
  Image HQ3x(const Image& input);
 
  // Receives a sf::Image and returns a 4-times bigger sf::Image, using the
  // HQ4x magnification algorithm.
  Image HQ4x(const Image& input);
 
}


Here's a code sample:

Code: [Select]
#include <SFML/Graphics.hpp>
#include <SFE/HQx.cpp>

int main() {
  sf::Image img, hq2x, hq3x, hq4x;
  img.LoadFromFile("test.png");
 
  sfe::InitHQx(); // Unnecessary
 
  hq2x = sfe::HQ2x(img);
  hq2x.SaveToFile("hq2x.png");
 
  hq3x = sfe::HQ3x(img);
  hq3x.SaveToFile("hq3x.png");
 
  hq4x = sfe::HQ4x(img);
  hq4x.SaveToFile("hq4x.png");
 
  return 0;
}


Samples: (HQ3x)

   

           

This is my first open-source code. I got the HQx code from here, and I did some modifications in it to make it working with 32-bit colors. Also, don't try to use it with images that has some pixel with alpha channel other than 255.

Download link: Click Here

3
Graphics / Drawing TextBox.
« on: July 02, 2011, 03:07:04 am »
I'm trying to draw a textbox with SFML (2.0). It, basicly a box drawed as background, a sf::Text with the contents and a sf::Sprite with the cursor. My problem is to limit the drawed text to the box, to don't show any text outside the textbox. I tryed to do it with sf::View but I failed. I'm also thinking on blit (pixel by pixel) each glyph in an sf::Image and draw it. It probably works, but is not a fast way. What is the best way to do it?

Also, a possible interesting function to be added is a Drawable::SetClipRect(IntRect), to draw just a part of the object. It can be useful for tiled images or for cases like mine.

Pages: [1]
anything