Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (404)
games submitted by our members
Games in WIP (289)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Games Center / Showcase / Re: Three Tiles on: 2013-04-29 17:31:35
Thanks for your comments. I fixed some bugs and added new levels today. (url is updated)
2  Games Center / Showcase / Three Tiles on: 2013-04-29 03:28:20
Hey all!
Just want to show a game I made for ludum dare. It was an awesome experience and the longest coding streak I ever did.





Download: https://dl.dropboxusercontent.com/u/31393301/LD26/threetiles_win.exe
Source: https://dl.dropboxusercontent.com/u/31393301/LD26/ThreeTiles_src.zip
LD page: http://www.ludumdare.com/compo/ludum-dare-26/?action=preview&uid=10029
3  Game Development / Newbie & Debugging Questions / Re: LWJGL Keyboard, what's going on? on: 2013-01-28 18:30:34
So I could just use the keys I need.
4  Game Development / Newbie & Debugging Questions / Re: LWJGL Keyboard, what's going on? on: 2013-01-28 18:25:53
Ah I see. Gonna implement it straight away. Thanks!
5  Game Development / Newbie & Debugging Questions / LWJGL Keyboard, what's going on? on: 2013-01-28 17:22:36
Hello!
Quick question! I have player input setup like this:
1  
2  
3  
4  
5  
boolean keyUp = Keyboard.isKeyDown(Keyboard.KEY_UP)
...
if(keyUp){
    //move code
}

And a bit later:
1  
2  
3  
4  
5  
while(Mouse.next()){
   if(Mouse.isButtonDown(0)){
      //fire button (boom boom)
  }
}

So what happens is, if player holds UP key to run and presses mouse button to fire, movement stops. In order to run again, player must press up key again, running while shooting is impossible.
Why do keys get reset that way?
6  Games Center / Cube World Projects / Re: Merging triangle faces! on: 2013-01-06 23:24:26
I don't see why you need to optimise it that much. And that will just slow down the CPU when just one block is missing from the surface.
Well it seems like a good way to increase performance, I'll stick to only face and frustrum culling for now.
7  Games Center / Cube World Projects / Merging triangle faces! on: 2013-01-06 22:56:13
Hello!  Smiley
I need some help!
So basically, having an integer array of cube ids with the size of 16^3 and static method, which returns triangle vertices based on location given by array iterator. Feeding vbo with that data I get this mess:


Nothing fancy but here's a problem I'm struggling with..
That chunk of cubes could also be rendered like this, providing that ids are the same:


Getting rid of cubes that are completely surrounded would be easy, but I still have a lot of verticies left that don't have to be stored in memory. I need someone's help on algorithm that would "merge" verticies that share the same properties and kept triangle topology. (after trying it just got far too complex)
 
8  Java Game APIs & Engines / OpenGL Development / Finding 2D point on screen from 3D perspective on: 2012-07-27 20:30:02
Well, the title explains what I need to know  Smiley
So if I have a basic lwjgl/opengl 3D world with some entities which can be some NPC's or other game stuff. And lets say I want to make floating names, test if object is seen by camera etc. I need to know exact 2D point coordinates when I have 3D point location data.

This is how I did 3D picking (needs to be "reversed"):
Please tell me if there's a better way.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
public static Vector3f getMousePosition(int mouseX, int mouseY) {
      viewport = BufferUtils.createIntBuffer(16);
      modelview = BufferUtils.createFloatBuffer(16);
      projection = BufferUtils.createFloatBuffer(16);
      winZ = BufferUtils.createFloatBuffer(1);
      position = BufferUtils.createFloatBuffer(3);
      GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
      GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection);
      GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);
      GL11.glReadPixels(mouseX, mouseY, 1, 1, GL11.GL_DEPTH_COMPONENT,
            GL11.GL_FLOAT, winZ);

      if (winZ.get(0) == 1) {
         return null;
      }
      GLU.gluUnProject(mouseX, mouseY, winZ.get(), modelview, projection,
            viewport, position);
     
      return new Vector3f(position.get(0), position.get(1), position.get(2));
   }


So I was thinking...
By using this (found on stackoverflow):
1  
screen_coordinates = projection_matrix * modelview_matrix * world_coordinates

Could I somehow get position this way? I need help Smiley
9  Game Development / Newbie & Debugging Questions / Re: 2D Overlay lwjgl on: 2012-06-07 00:25:47
Well, the simplest way is to surround your world render code and gui code into glPushMatrix and glPopMatrix. (both separately) And then do the world translations in there.
10  Game Development / Newbie & Debugging Questions / Re: Slick2D Trying to display text in UnicodeFont on: 2012-03-03 23:19:26
add maybe a simple color effect:
1  
myFont.getEffects().add(new ColorEffect(java.awt.Color.white));
11  Game Development / Newbie & Debugging Questions / Re: JFrame problems "setLayout (new FlowLayout);" on: 2012-02-28 16:04:27
try with:
1  
setLayout(new FlowLayout());
12  Game Development / Newbie & Debugging Questions / Re: lwjgl Display remove title bar? on: 2012-02-19 02:22:46
Take a java.awt.Window, put a java.awt.Canvas in it and use Display.setParent(...) to bind your surface to the canvas.

I've returned to this project, and made it work. But now I want to know how does resizing of the window work (Display.getWidth or JFrame.getWidth())? If I render something on screen with opengl (I use Display.getWidth/2 to render 2D in center) and then resize this screen everything moves out of place (aspect ratio messes up, before I used Display.wasResized() to renew ratio on gluPerspective). I tryed to use Frame.getWidth() and getHeight() but I get same result. I want to know how are display and jframe connected exactly.

sry for my typing, i need to get some sleep.

parent code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
        Canvas = new Canvas();
        Frame = new JFrame("sup");

        Frame.setSize(1280, 720);
        Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Frame.setBackground(Color.BLACK);
        Canvas.setBackground(Color.BLACK);
        Frame.getContentPane().add(Canvas);
        Frame.setLocationRelativeTo(null);
        Frame.setVisible(true);
      try {
         Display.setVSyncEnabled(true);
         Display.setParent(Canvas);
         Display.create();
      } catch (Exception e) {
         e.printStackTrace();
         Display.destroy();
         System.exit(0);
      }
13  Game Development / Newbie & Debugging Questions / Re: lwjgl FBO texture rendering problem on: 2012-02-17 14:30:20
I disabled gl_blend and moved game loop so its now running in a thread. It works^^
14  Game Development / Newbie & Debugging Questions / Re: lwjgl FBO texture rendering problem on: 2012-02-16 22:11:31
Here you go :
http://dl.dropbox.com/u/31393301/3Dproject.rar
straight from eclipse. (I removed some classes)

And thank you for helping.
15  Game Development / Newbie & Debugging Questions / Re: lwjgl FBO texture rendering problem on: 2012-02-16 19:28:19
Same thing, but now screen is upside down.
16  Game Development / Newbie & Debugging Questions / Re: lwjgl FBO texture rendering problem on: 2012-02-16 14:54:22
Ok I tried making fixed display size of 1280x720, then use same size for fbo and final screen display method. I also played around with pixelformat of display and I did some optimizing for my game render methods (commented out some stuff). Result is still the same  Tongue.
If fbo code is ok then i must have done something wrong with vbo's, because there is nothing else that could go wrong (maybe).
17  Game Development / Newbie & Debugging Questions / Re: lwjgl FBO texture rendering problem on: 2012-02-15 15:28:32
No, I have glViewport before rendering to the fbo.

this is before rendering to fbo:
1  
2  
3  
4  
5  
6  
7  
8  
9  
glViewport (0, 0, Display.getWidth(), Display.getHeight());  
glBindTexture(GL_TEXTURE_2D, 0);                            
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, openGL.framebufferID);
glClearColor (0.0f, 0.0f, 0.0f, 1.0f);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);          
glLoadIdentity ();                                      
glTranslatef (0.0f, 0.0f, intoTheScreen); //z = -6.0f

//game renders


and later to display fbo texture:
1  
2  
3  
4  
5  
6  
7  
8  
9  
glEnable(GL_TEXTURE_2D);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);    
glClearColor (0.0f, 0.0f, 0.0f, 1.0f);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//glViewport(0, 0, Display.getWidth(), Display.getHeight());
glLoadIdentity ();                                            
glTranslatef (0.0f, 0.0f, intoTheScreen);    
glColor3f(1, 1, 1);
renderScreen();    


renderScreen method:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
//don't know if this is ok to use with fbo render...
//this is how I usually render 2d HUD and stuff
public void renderScreen() {
   GL11.glPushMatrix();
   glMatrixMode(GL_PROJECTION);
   GL11.glLoadIdentity();
   GL11.glOrtho(0, Display.getWidth(),0, Display.getHeight(), -1, 1);
   glViewport(0, 0, Display.getWidth(), Display.getHeight());
   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();
   glEnable(GL_TEXTURE_2D);
     
   glBindTexture(GL_TEXTURE_2D, openGL.colorTextureID);
   glBegin(GL_QUADS);
   glTexCoord2f(0.0f, 0.0f); glVertex2i(0,   0);  
   glTexCoord2f(1.0f, 0.0f); glVertex2i(Display.getWidth(),  0);
   glTexCoord2f(1.0f, 1.0f); glVertex2i(Display.getWidth(), Display.getHeight());
   glTexCoord2f(0.0f, 1.0f); glVertex2i(0, Display.getHeight());
   glEnd();
     
   glPopMatrix();
}
18  Game Development / Newbie & Debugging Questions / lwjgl FBO texture rendering problem on: 2012-02-14 22:56:13
Good day
I have a problem while rendering to texture using FBO. I followed tutorial on lwjgl.org and got it to work with my project, but as you can see on the bottom picture it doesn't work as it should. You can see this funny lines on all of my textures which should not be there (top-right to bottom-left, also edges are strangely distorted). I had this problem before when i started with lwjgl and made basic textures and stuff, but i don't remember how i fixed it.
I'm rendering cubes with VBO's and i have blend, cull_face and gl_texture_mag_filter gl_nearest enabled, but anyway problem occurs on basic openGL texture calls too.

Help me to solve this mystery? Roll Eyes

example:
19  Game Development / Newbie & Debugging Questions / Re: lwjgl, jarsplice, distributing problem on: 2012-01-24 01:58:21
Yep! It works now! Thank you for your help Smiley
20  Game Development / Newbie & Debugging Questions / Re: lwjgl, jarsplice, distributing problem on: 2012-01-24 00:52:42
Well I load this single image as bufferedImage, and catch exception which i can see later when running:

1  
2  
3  
4  
5  
6  
7  
8  
9  
public static void load(){
      imageMain = null;
      try {
         imageMain = ImageIO.read(new File("res/fonts/font.png"));   //loads main fonts image
     } catch (IOException e) {
         System.out.println("cant load fonts Image!");
         System.exit(0);
      }
   }

I use this one later to get subimages...


And then I load a bunch more textures using InputStream for "regular use":

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
public static Texture basic;
   public static Texture orange;
   public static Texture blue;
   //public static Texture text;
  public static Texture menuBG;
   public static Texture stars;
   public static Texture moon;
   public static Texture redPlanet;
   public static void initTexs(){
      try {
         basic = TextureLoader.getTexture("PNG",new FileInputStream(new File("res/tex/basic.png")));
         orange = TextureLoader.getTexture("PNG", new FileInputStream(new File("res/tex/orange.png")));
         blue = TextureLoader.getTexture("PNG", new FileInputStream(new File("res/tex/blue.png")));
         stars = TextureLoader.getTexture("PNG", new FileInputStream(new File("res/tex/stars.png")));
         menuBG = TextureLoader.getTexture("PNG", new FileInputStream(new File("res/menu/background.png")));
         moon = TextureLoader.getTexture("PNG", new FileInputStream(new File("res/tex/moon.png")));
         redPlanet = TextureLoader.getTexture("PNG", new FileInputStream(new File("res/tex/redplanet.png")));
         System.out.println("Textures are loaded!");
      } catch (IOException e) {
         e.printStackTrace();
         System.out.println("Error while loading textures!");
         Display.destroy();
         System.exit(0);
      }
   }
21  Game Development / Newbie & Debugging Questions / lwjgl, jarsplice, distributing problem on: 2012-01-24 00:27:55
Im sure this has been answered before, but I will ask it anyway. I exported my lwjgl game and used jarsplice to create fat jar, simple.
But when runnng my game I get image not loaded exception. Basically textures failed to load. Do I have to make some sort of workaround for this to work? I use slick Textureloader and imageIO for a couple of images which works perfectly when debugging from eclipse. It seems I get exception under imageIO.

How can I get it to work?

22  Game Development / Newbie & Debugging Questions / lwjgl Display remove title bar? on: 2012-01-22 01:02:12
Hey!

I have a simple question. Is it possible to remove title bar and decoration around lwjgl openGL display when using windowed mode?

similar to JFrame maybe:
1  
2  
3  
4  
5  
JFrame frame = new JFrame("something");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(width,height);
frame.setUndecorated(true));  //here
frame.setVisible(true);

23  Game Development / Newbie & Debugging Questions / Re: BufferedImage to lwjgl texture on: 2012-01-15 12:05:30
It works great! I load it to gluPerspective and it finaly works. Thank you so much! Smiley
24  Game Development / Newbie & Debugging Questions / Re: BufferedImage to lwjgl texture on: 2012-01-15 01:49:22
Im using LWJGL. I mean i made some pretty cool stuff already in opengl using textures mapping i just didn't get the chance to learn using this buffers yet.
25  Game Development / Newbie & Debugging Questions / Re: BufferedImage to lwjgl texture on: 2012-01-15 01:09:56
I can't get it to work. I get alot of errors like invalid enum or null pointer location using various methods in opengl. At the end i tryed displaying this buffer with drawPixels() method which kinda worked but image was completly messed up. Can you please show me how to bind this buffer, to gl_quads for example, correctly? I don't know exactly what im doing couse i started learning java about a month ago. Thanks for your help!
26  Game Development / Newbie & Debugging Questions / BufferedImage to lwjgl texture on: 2012-01-14 16:56:59
Hi guys!
I have a simple question about converting a bufferedimage from java.awt library to lwjgl Texture. Basically i want to bind this texture to opengl ("texture.bind()") after i do some cropping from the main image (using "image.getSubImage(x,y,width,height)" or cropImageFilter()"). It's supposed to make a few textures from a bigger image just like minecraft does for it's fonts and so on. So can anyone give me a snippet how could i do this?
Pages: [1]
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (45 views)
2013-05-17 21:29:12

alaslipknot (54 views)
2013-05-16 21:24:48

gouessej (83 views)
2013-05-16 00:53:38

gouessej (82 views)
2013-05-16 00:17:58

theagentd (91 views)
2013-05-15 15:01:13

theagentd (84 views)
2013-05-15 15:00:54

StreetDoggy (128 views)
2013-05-14 15:56:26

kutucuk (150 views)
2013-05-12 17:10:36

kutucuk (150 views)
2013-05-12 15:36:09

UnluckyDevil (160 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.306 seconds with 21 queries.