2d

Performance issues with Java 2D when drawing bufferedimages

Hi, I'm designing a Canvas object which is been used to draw a BufferedImage of size 228x262 pixels. That image is been drawn using Graphics2D.drawImage(...) method. I'm doing a pixel basis color manipulation within given offset ranges. A sample of the code below: for( int i = frameOffset; i < colorClock; i++ ) { rgb[i] = new C...

How to dynamically construct 3d object by adding paths? (Java; OpenGL)

So I have some path generator which now works like this http://www.openprocessing.org/visuals/?visualID=2615 (There is source; WQRNING - JAVA APPLET) I want to create some 3D object using paths I generated so it locked in one of perspectives similar to what I get now in 2D. So how do I dynamically construct 3D object by adding paths...

Setting up Axiom3D (or finding a 2d C# openGL engine)

I have a computer that won't let me enable direct3d acceleration (i've tried almost everything). So I need a 2d engine in c# that supports openGL. I found Axiom3D, but I can't run the samples and I can't build the project, and it's driving me crazy. When I try to run the samples, it just blits open the command prompt and closes right a...

2D game programming tutorials in C#

I want to learn about programming 2D games in C#. What are the best tutorials that are beginner oriented, written for C#, and preferably use GDI+ (or something equally simple)? I am relying on the experience this community has to direct me towards the best. ...

Cross product of 2 2D vectors

Can anyone provide an example of a function that returns the cross product of TWO 2d vectors? I am trying to implement this algorithm. C code would be great. Thanks. EDIT: found another way todo it that works for 2D and is dead easy. bool tri2d::inTriangle(vec2d pt) { float AB = (pt.y-p1.y)*(p2.x-p1.x) - (pt.x-p1.x)*(p2.y-p1.y);...

Wrapping long text on an Android Canvas

I have a custom control that is doing a lot of 2D drawing straight to the canvas. Some of this drawing is text, so I am using the Canvas.drawText() method. I want to draw the text within some bounds - a top-left, certain maximum width, and a maximum number of lines. After drawing the text, I want to know how many lines it took. Is th...

Xna SpriteBatch Matrix.Decompose()

What I am looking to do is to be able to push and pop transform matrices into SpriteBatch. I have 2 sprites, parent and child, and the child should be scaled, rotated, translated relative to the parent. I currently have an implementation using textured quads but I think this should be possible using the built in SpriteBatch class and us...

Techniques for generating a 2D game world

I want to make a 2D game in C++ using the Irrlicht engine. In this game, you will control a tiny ship in a cave of some sort. This cave will be created automatically (the game will have random levels) and will look like this: Suppose I already have the the points of the polygon of the inside of the cave (the white part). How should I ...

iPhone Quartz 2D: CGContextSetLineJoin equivalent for CGMutablePathRef?

Hi, What is the CGMutablePathRef equivalent of CGContextSetLineJoin? CGContextSetLineJoin works directly on the graphics context, so requires a CGContextRef parameter, which I do not have since I'm working with CGMutablePathRef. I can't find anything in CGPath.h that does CGContextSetLineJoin's job. Thank you. ...

Building an interleaved buffer for pyopengl and numpy

I'm trying to batch up a bunch of vertices and texture coords in an interleaved array before sending it to pyOpengl's glInterleavedArrays/glDrawArrays. The only problem is that I'm unable to find a suitably fast enough way to append data into a numpy array. Is there a better way to do this? I would have thought it would be quicker t...

Foreach and 2D Array in PHP

$mainMenu['Home'][1] = '/mult/index.php'; $mainMenu['Map'][1] = '/mult/kar.php'; $mainMenu['MapA'][2] = '/mult/kara.php'; $mainMenu['MapB'][2] = '/mult/karb.php'; $mainMenu['Contact'][1] = '/mult/sni.php'; $mainMenu['Bla'][1] = '/mult/vid.php'; This is a menu, 1 indicates the main part, 2 indicates the sub-menu. Like: Home Map -MapA...

javax.media.j3d.RestrictedAccessExceptioning

Hi I have a scene in one frame which has 9 white spheres(3d graphics)(center).and also this frame has a panel in the north of itself which has 2d graphics . I put some check boxes on that panel and the user by clicking on them can change the color of the 3d balls .the panel also have a "reset button" button and by clicking on that ,the g...

High-End 2D Java (SE) Graphics Library

I am looking for a high-end graphics library for Java Standard Edition. I know some fairly low-level libraries: AWT/Swing, JOGL, SDL. Are/is there an alternative? My requirements are (atleast): Anti-aliased Fullscreen support Alpha channel Blend modes and Z-depth Rasterized Effects: (motion) blur, glow, gloom, etc. And, optionally: ...

Why is my Python OpenGL render2DTexture function so slow?

SOLVED: The problem was actually using time.time() every CPU cycle to see whether the next frame should be drawn or not. The time it takes to execute time.time() was having an impact on the FPS. I made this function for drawing 2D textures as images in a 2D view in my OpenGL application. After doing some testing I found that it takes up...

Is there a 2d sprite library for webgl?

I am looking to build a 2d game using WebGL. I want the hardware acceleration that WebGL provides and I cannot get this from the 2D canvas context in the canvas tag. With that said, is there a tutorial on creating 2D sprites using webGL? Or, better yet, is there a 2D sprite library for WebGL? Ideally, I'm looking for something like c...

How to do 2d vector movement

my onscreen object has a var rotation (in degrees). how do i fix it so when i push up arrow it move forwards and not just x++ and y++? ...

2D Engine for iPhone OS

I have a pretty simple 2D flash game. It's a jump n run sidescroller and I want to port it to the iPhone. But what is the best way to do it? There is Adobe Flash Pro CS5 but I'd rather program it from the scratch in an iPhone environment. Are there any top games done by open source framekworks? Which is the best way to go? ...

Techniques and algorithms for precise and efficient graph plotting

I'd like to plot mathematical functions and I'm looking for techniques and algorithms for precise and efficient plotting. 2D plotting should suffice. I focus on techniques and algorithms, not libraries or languages. Thanks in advance! ...

OpenGL 2D Texture Mapping problem.

Hi there, I am relatively new to OpenGL and I am having some issues when I am rendering an image as a texture for a QUAD which is as the same size of the image. Here is my code. I would be very grateful if someone helps me to solve this problem. The image appears way smaller and is squished. (BTW, the image dimensions are 500x375). gl...

Objective-C - How to add objects in 2d NSMutableArrays

Hello, I have this code NSMutableArray *insideArray = [[NSMutableArray alloc] init]; NSMutableArray *outsideArray = [[NSMutableArray alloc] init]; [insideArray addObject:@"Hello 1"]; [insideArray addObject:@"Hello 2"]; [outsideArray addObject:insideArray]; [insideArray removeAllObjects]; [insideArray addObject:@"Hello 3"]; [insideAr...