graphics

How do I use glutBitmapString() in C++ to draw text to the screen?

I'm attempting to draw text to the screen using GLUT in 2d. I want to use glutBitmapString(), can someone show me a simple example of what you have to do to setup and properly use this method in C++ so I can draw an arbitrary string at an (X,Y) position? glutBitmapString(void *font, const unsigned char *string); I'm using linux, and ...

How to generate Winamp-Style visualization effects with openGL? (Milkdrop, etc)

I'm trying to create an animated ambient abstract background for my game. I'm picturing something very similar to what Winamp has when you turn on it's visualization plug-in. Here's a link to some screenshots. I can handle tweaking the idea once I get something up and running that is acting generally how I want it, but I just have n...

Favorite graphical subsystem to program in

Ok, this is an interesting question to ask because everyone has a say in it. What is your favorite library to program in for GUI's and the language that you program it in. Give a short reason why. (ex. Gtk, Qt, Windows, etc..) Just an FYI, this includes any scripting language that you program a GUI in Python, Perl etc... Frankly I'v...

Fully transparent windows in Pygame?

Is it possible to get a fully transparent window in Pygame (see the desktop through it)? I've found how to create a window without a frame, but there doesn't seem to be any obvious way to make it transparent. I'd be willing to tie into system-specific technology/frameworks as long as there are solutions for both Windows and Mac OS X, b...

How can I modify a bitmap and use it later without storing or drawing

Hi, I'm trying to do some ocr by myself in C#. I originally come from Java and this is my first "project" with C# So I know, how you can make different ColorMatrizes to draw a processed bitmap in your application. I also do have those, but I want to use the processed picture to better analyze a picture. Those are my methods to get a Im...

Flash/ActionScript: Draw a display object "onto" another

How do I properly draw one vector object onto a specific position of another in ActionScript, accounting for positioning, transparency, etc? My idea (as suggested e.g. here) was to use beginBitmapFill() and drawRect() to draw a bitmap copy (made using BitmapData.draw()) of one MovieClip onto the .graphics property of the other MovieClip...

I would like to learn about creating graphic objects at Runtime in c#

I would like to learn about creating a program that I could draw simple shapes and be able to select them for editing - like resizing, order of display, color change. Is there an online resource that someone knows of that would help me reach my goals. thanks ...

Given a set of points, how do I approximate the major axis of its shape?

Given a "shape" drawn by the user, I would like to "normalize" it so they all have similar size and orientation. What we have is a set of points. I can approximate the size using bounding box or circle, but the orientation is a bit more tricky. The right way to do it, I think, is to calculate the majoraxis of its bounding ellipse. To do...

Where to learn proper way to use Silverlight (or WPF)

Approaching Silverlight development is a rather daunting task as it seems to require a rather different mindset to work I have done in the past. I have been working on it for several months and we have already released an application that presents form-based pages. So I have the basics of XAML for layout but what I need to do now is mov...

What is the most elegant way to cast a variable you just received as an argument?

More specifically, what's the most elegant way to cast the Graphics object in a paint() call up to a Graphics2D object? public void paint(Graphics g) { // How do I convert/cast/etc the g variable to a Graphics2D object? } Or am I missing the point here? Is there a better way to handle this in general? ...

Why are my RenderingHints keys, when applied to a Graphics2D object, not being honored?

When drawing various things using a Graphics2D object and BasicStroke at 1.0f, I can't seem to get the g2d object to honor my RenderingHints settings. Specifically the *KEY_ANTIALIASING* set to *VALUE_ANTIALIAS_ON*. public void paint(Graphics g) { Graphics2D g2d = (Graphics2D)g; g2d.setStroke(new BasicStroke(1.0f)); g2d.set...

Recommend some Bresenham's-like algorithm of sphere mapping in 2D?

I need the fastest sphere mapping algorithm. Something like Bresenham's line drawing one. Something like the implementation that I saw in Star Control 2 (rotating planets). Are there any already invented and/or implemented techniques for this? I really don't want to reinvent the bicycle. Please, help... Description of the problem. ...

Why does my jscrollpane result in odd paint calls in java swing?

I've got a routine that paints an insanely large graph inside a scroll pane. It's too big to paint before adding to the scrollpane - the menory requirements would be several gigs. Because of the size of the graph I'm rendering the chart within the paint method of the scrollpane's child. Which works out well, however I'm noticing that ev...

A good 2d engine for Java ?

DUPLICATE: http://stackoverflow.com/questions/293079/java-2d-game-frameworks Does anyone knows a good 2D engine for Java with sprites, animations and colisions handling ? ...

Which 3D Model format should I be using?

Im writing a game engine and I'm wondering what 3D model format should I use/load/export? Obj seems universal and easy but it also appears to be unreliable in that most models out there contain errors and it doesn't store anywhere near as much as other formats. There appear to be formats specifically for games such as MD2/3/5 but Im not...

Calculate the horizon of a curved face?

I need to find the 2 points of the visual horizon, of a curved face. I have: XYZ of the 4 corner points XYZ of the 2 curved edge bezier points And I need to calculate either: XY of the horizon points XYZ of the horizon points See the image below. ...

Handling selection of shapes on a board (algo)

I have a board as a canvas with several shapes drawn on it, some of them are triangles, circles, rectangles but all are contained inside their own bound delimited rectangle. "The circle will be inside a rectangle" I put two circles A, B on the board where A is over B and has some area colliding. If I click on A area corresponding to th...

Calculate the horizon of a curved face? - Not extrema

I need to find the 2 points of the visual horizon, of a curved face. I have: XYZ of the 4 corner points XYZ of the 2 curved edge bezier points And I need to calculate either: XY of the 2 horizon points XYZ of the 2 horizon points Note: I got a solution the last time I asked this question, but it only found the extrema of the c...

Graphics2D: Drawing black on white?!

I'm sure this is a very stupid question but I can't find the answer, I'm not experienced with the Java2D API. I'm trying to create an image and write it to GIF or PNG, and I want it to use a black pen on a white background. If I don't set any colors, I get white on black. If I use setPaint() (intended for subsequent draw operations) I ge...

code works for java graphics, but not graphics2d

inside a paintcomponent. it takes g as parameter, and g can be graphics or graphics2d. the class extends jpanel. then: super.paintComponent(g); this.setBackground( Color.BLACK ); if g is graphics it works, but if it's graphics2d it doesn't. it compiles with both, but graphics2d doesn't change the background color. how come? ...