0
votes
2answers
128 views

Do Java and Actionscript use OpenGL?

As far as I know there are only 3 base graphics libraries on Windows, the GDI, OpenGL and DirectX, is that correct, so that means that Java, Actionscript and all language use one of these 3 libraries ...
0
votes
2answers
52 views

Clamping large content to smaller area

I'm using OpenGL (with LWJGL) in Java, but the question is language independent. I have some region (a rectangle for simplicity), and, let's say, a big tiled map which I want to show in this area. ...
0
votes
1answer
133 views

How can I draw a single line using JMonkeyEngine?

I need draw a line between two boxes using their respective positions. I've created the Line object but I don't know how to show it in the scene. Line ray = new Line(box1.getLocalTranslation(), ...
5
votes
1answer
292 views

How can I create a 3D model in Java without using modeling software? [closed]

I am a lightly experienced game developer and this is my first time trying 3D objects in Java for the first time. I have been recently creating and updating games using AWT, Swing, and Graphics, but I ...
0
votes
1answer
184 views

Java Slick2D - Problem using ScalableGame class

I am having a problem adjusting the size of the screen while using the ScalableGame class from the Slick2D library. I would like the background and objects (images and graphic shapes) to adjust to ...
5
votes
1answer
230 views

2D Polygon Triangulation

I am creating a game engine using the JBox2D physics engine. It only allows you to create polygon fixtures up to 8 vertices, To create a body with more than 8 vertices, you need to create multiple ...
-1
votes
1answer
73 views

Render white background with Graphics in Canvas

I am developing a game that I would like the background to be white, and it just sticks to being black. Here is my render method: private BufferedImage image = new BufferedImage(WIDTH, HEIGHT, ...
2
votes
2answers
1k views

How to code a Game Grid in Java?

Suppose I wanted to code a game grid in java. Not an abstract text one but an actual grid with graphics and 'cells'. Would I have to draw line by line or is there a more efficient way? Also how would ...
1
vote
0answers
221 views

OpenGL: Attempt to allocate a texture too big for the current hardware

I'm getting the following error: java.io.IOException: Attempt to allocate a texture to big for the current hardware at ...
1
vote
1answer
100 views

How can I find the location of OpenGL object after rotation?

I have a rotating object, a cube, which I rotate in OpenGL as follows: gl.glPushMatrix(); gl.glTranslatef(400.0f, 300.0f, 1300.0f); gl.glRotatef(m_x, 4.0f, 0.0f, 0.0f); gl.glRotatef(m_y, 0.0f, 4.0f, ...
2
votes
0answers
116 views

Images out of “sync”

I've been creating a game in Java as a bit of a fun side project over the last few months and I've come across a really peculiar problem, take a look at this image: The game is made up of various ...
-1
votes
1answer
106 views

Anti-Aliasing in Java

In my game I want to have the different anti-aliasing option like: none, x2, x4, x8 and x16. I know that you can use anti-aliasing with Graphics2D in the way below bu is there any way that I can use ...
1
vote
4answers
167 views

Changing color of a moving image without lowering the fps

I just added an option to my game that makes it so that all the enemies will have a random color for their clothes instead of the regular blue. I use this code to draw rectangles over the shirt of the ...
1
vote
1answer
506 views

Jogl2 won't accept jogl 1.0 code - GL_LIGHTING and GL_LIGHT_MODEL_AMBIENT cannot be resolved or is not a field?

I'm trying to run my code on jogl 2.0 , for the first time (until now I worked with jogl 1.0) however Eclipse throws to almost every that I have a "cannot be resolved or is not a field" message . ...
2
votes
1answer
159 views

Low FPS on Java drawing in BufferStrategy

I ran into a very strange problem while using BufferStrategy, I've tried searching for an answer but all I have found are non-relevant threads and discussions. So here is my query. for (int i = 0; i ...
4
votes
1answer
859 views

2D Software Lighting Issues in Java

I'm creating a 2D top-down tiled game in pure Java and by now I'm trying to implement a way to do lighting. First, some details on how I render: there is a screen class which handles all the ...
0
votes
1answer
80 views

Which Swing control should I use to render graphics with?

I'm using the Swing UI toolkit in Java, and I want to use the Graphics class to draw images and grids in a control. Which is the most appropriate control for this?
-2
votes
1answer
193 views

Move projectile in direction the gun is facing [duplicate]

Possible Duplicate: Move sprite in the direction it is facing? I am attempting to have a projectile follow the direction a gun is facing. When using the following code I am unable to make ...
0
votes
3answers
876 views

How do you make bullets move at an angle in different angles using delta

I'm having trouble making my bullets move at a steady pace using delta. I have the formula I used outside of slick2d, but it doesn't take delta into account. My bullets fly fast. How do I make them go ...
0
votes
1answer
309 views

Can't remove JPanel from JFrame while adding new class into it

Basically, I have my Frame class, which instantiates all the properties for the JFrame, and draws a JLabel with an image (my title screen). Then I made a separate JPanel with a start button on it, and ...
1
vote
3answers
1k views

Question about JPanel “transition” for Java Swing

I want to make like a sort of main menu (in GUI). When the user clicks the start button, the screen transition into another "screen" (JPanel). This image will make it easier to understand. ...
4
votes
2answers
283 views

Minesweeper: Mouse listener problem

I have wrote a code for game Minesweeper and there is no problem with the graphics,but there is some problems with MouseListener. Here is my code /* * To change this template, choose Tools | ...
1
vote
2answers
1k views

Provide A Scrolling “Camera” View Over A 2D Game Map

I'm in the process of attempting to create a 2D MMO type game with Kryonet and some basic sprites, mostly for my own learning. I have the back end set up great (By my standards) and I'm moving on to ...
1
vote
1answer
2k views

Using NinePatch in libGDX for Loading Bar

I am trying to create images for a loading bar in libGDX. I came across the NinePatch class and I was hoping to use it for this loading bar, since stretching images with a plain Texture or Sprite ...
1
vote
1answer
562 views

Polygon Collision Detection Android

I am starting to try and figure out polygon collision detection in my Android game. I am currently doing pixel level collision detection and it just seems to be too slow (though it works). I was ...
3
votes
4answers
1k views

Which Side Was Hit?

I am working on an Android game and I have two objects A and B (both rectangles) and when they collide I simply want to know which side of B was hit. I have detected the collision fine, but I am ...
6
votes
2answers
2k views

How to handle pixel-perfect collision detection with rotation?

Does anyone have any ideas how to go about achieving rotational pixel-perfect collision detection with Bitmaps in Android? Or in general for that matter? I have pixel arrays currently but I don't know ...
0
votes
1answer
839 views

How can I “capture” the section of my sprite sheet that I want to draw in Java?

I'm working on a puzzle game, I've implemented a sprite class that uses an array of images and cycle through the array to draw each frame as required. This works fine! Here's the original code: ...
3
votes
1answer
187 views

Can I use one set of images to represent multiple sprites in Java?

I've got a game that has 3 basic sprites, at the moment I'm loading 8 images into each sprite for animating. Each character class has a sprite object. if I've got 10 characters on screen at once ...
2
votes
2answers
3k views

How do I prevent flickering when drawing to a JPanel?

So I have a JFrame holding a JPanel, to which I'm drawing at about 60 FPS. I've been told that "Swing is double buffered by default", but, nevertheless I'm getting massive flickering. At first, I ...
1
vote
1answer
846 views

Sphere collision response

I have simple mechanism for testing of two balls colliding: private static boolean isColliding(float firstBallX, float firstBallY, double firstBallRadius, float secondBallX, float secondBallY, double ...
4
votes
1answer
1k views

Android Game Dev: Screen Scaling

This question is very closely related to a previous question of mine: Scaling a game view with letterboxes? My game runs at 480x800 right now but when the screen is smaller or bigger than that I ...