2d

Making screenshot of drawing application + drawing outlines of 2D shapes

Hello. I am making a drawing program, using the Graphics 2D objects (lines, rectangles and ovals, namely) by placing them on a panel. With that in mind, I have 2 questions: 1) How can I store the images currently portrayed on the panel as PNG, JPG or similar file onto disk? 2) I have added a drag function. How can I implement a functi...

Graphical sandbox for pathfinding

If you needed a clean and consistent sandbox for pathfinding what would you use? I want to experiment with different pathfinding algorithms by sending virtual units (robots) around obstacles on a geometric plane. But I don't need a feature overkill like a game engine or Flash might have, just an animated report and native collision de...

Generate 2D cross-section polygon from 3D mesh

I'm writing a game which uses 3D models to draw a scene (top-down orthographic projection), but a 2D physics engine to calculate response to collisions, etc. I have a few 3D assets for which I'd like to be able to automatically generate a hitbox by 'slicing' the 3D mesh with the X-Y plane and creating a polygon from the resultant edges. ...

how to draw simple eyes in java

How can I draw simplest eyes in Java's swing ? I would like to get something like that : http://img710.imageshack.us/img710/70/eyesp.jpg ...

a good program for designing 2d textures to use in XNA ?

I'm developing a game with Microsoft XNA. I haven't used any modelling program(even 2d modelling) before and I want to learn one. Which program is best ? Is there any free tutorial for it? ...

Generate a polygon from line.

I want to draw a line with thickness in j2me. This can easily be achieved in desktop java by setting Pen width as thickness value. However in j2me, Pen class does not support width. My idea is to generate a polygon from the line I have, that resembles the line with thickness i want to draw. In picture, on the left is what I have, a line ...

The most efficient method of drawing multiple quads in OpenGL

I'm not very keen with OpenGL and I was wondering if someone could give me some insight on this. I'm a 'seasoned' programmer, I've read the redbook about VBOs and the like, but I was wondering from a more experienced person about the best/most efficient way of achieving this. I've been producing this 2d tile-based game engine to be used...

Does computer graphics have a practic use besides games/movies/pictures ?

Hello, I am learning Computer Graphics at the university and I'm trying to figure out the use of it ... and I fail. Only games and movies stick in to my mind, I'm sure there are other uses for, let's say, graphic algorithms, openGL, 2D and 3D, 3ds Max ... Is it useful later on ? Where do I need it ? Thank you ...

Swing based 2D graphics library for Text

Is there a library that would give me 2D graphics with a focus on Text for Swing. I am building a simple form designer and need to position text correctly on a 2D display. It would be nice if there was a library that handled the newlines and possibly editing. ...

The simplest way to draw points on iPhone ?

Hello, in my app I have 49 points with x,y and I wnat to display them on the screen. I've seen a lot of library that can help me (core plot, s7graphview, etc.). But since I'm doing very basic stuff (just draw points), what is the simplest way do to that ? Thanks ! ...

More complex view matrix calculation required to composite 3d models with 2d video

I'm utilising some 2d / 3d tracking data (provided by pfHoe) to help integrate some 3d models into the playback of some 2d video. Things are working.... okay... but there's still some visible 'slipping' of the models against the video background and I suspect this is may be because the XNA CreatePerspective helper method isn't taking in...

How to find coordinates of a 2d equilateral triangle in C ?

Hello, I have the coordinates (x,y) of 2 points. I want to build the third point so that these 3 points make an equilateral triangle. How can I calculate the third point? Thank you ...

Trying to convert a 2D image into 3D objects in Java

Hey, I'm trying to take a simple image, something like a black background with colored blocks representing walls. I'm trying to figure out how to go about starting on something like this. Do I need to parse the image and look at each pixel or is there an easier way to do it? I'm using Java3D but it doesn't seem to have any sort of built ...

Programming language for web

I haven't programmed in a while, and have kind of lost interest, but I want to get back, and I've enjoyed C# the most, a lot more than objective-c and visual basic. So I want to make some games that me and my friends will be able to play next school year. So basically something you can play on the web. What programming languages deploy ...

Projection on a plane using a 2*3 matrix

Hello, I can easily draw the projection of a 3D set of points onto the plane with normal vector (1,1,1), by using the matrix (-sqrt(3)/2 sqrt(3)/2 0) (-1/2 -1/2 1). I want to do the same thing, but for a projection onto an arbitrary plane with normal vector (a,b,c) instead of (1,1,1). How to find the matrix...

I've got my 2D/3D conversion working perfectly, how to do perspective

Although the context of this question is about making a 2d/3d game, the problem i have boils down to some math. Although its a 2.5D world, lets pretend its just 2d for this question. // xa: x-accent, the x coordinate of the projection // mapP: a coordinate on a map which need to be projected // _Dist_ values are constants for the projec...

drawing above gtkentry using cairo

Hi Experts, I want to use cairo to enhance gtkentry look. For this, I have connected a callback to 'expose-event'. In callback, I call gtkentry's original expose-event handler. After that, I create cairo context and draw some lines and destroy the cairo. I return 'TRUE' as return value of callback function so that expose-event does not...

Non laggy movement in Flex or WPF

I'm trying to learn something about 2D games programming. For this purpose I've downloaded many samples developed in: Flex and Microsoft WPF. I've noticed that all the animations / moving objects are kind of non-smooth. I've seen a Flex example with double buffering which solved the image flickering, but it was laggy too. WPF example t...

dreferencing 2 d array

Please look at this peice of code :- #include<stdio.h> int main() { int arr[2][2]={1,2,3,4}; printf("%d %u %u",**arr,*arr,arr); return 0; } When i compiled and executed this program i got same value for arr and *arr which is the starting address of the 2 d array. For example:- 1 3214506 3214506 My question is why does dereferencing a...

2D polygon triangulation

The code below is my attempt at triangulation. It outputs the wrong angles (it read a square's angles as 90, 90. 90, 176) and draws the wrong shapes. What am I doing wrong? //use earclipping to generate a list of triangles to draw std::vector<vec> calcTriDraw(std::vector<vec> poly) { std::vector<double> polyAngles; //get angles ...