Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (739)
Games in Android Showcase (224)
games submitted by our members
Games in WIP (820)
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  Java Game APIs & Engines / OpenGL Development / Re: LWJGL: Getting mouse's 3D location on: 2013-02-08 08:30:34
I think what he/she means is that a X/Y position from the mouse on the screen can be many positions in 3D space - are you looking to project it onto an object? If so, you want to look up generating rays into the screen based on your current projection matrix and collide those with the shapes within your scene.



Exactly this. Hrmm. So I assume OpenGL Utilities don't really support anythinwg like this, so I'll have to create it myself.
I'm thinking about how I would create rays. Perhaps I should read up on it. It doesn't seem like the easiest task, especially taking into account Field of View, and rotation at 15 Degrees.
2  Java Game APIs & Engines / OpenGL Development / Re: LWJGL: Getting mouse's 3D location on: 2013-02-08 08:00:09
Thanks for the effort... but I'm asking for the Mouse's X, Y, and Z coordinates in the 3D space, not the 2D window.
3  Java Game APIs & Engines / OpenGL Development / LWJGL: Getting mouse's 3D location on: 2013-02-08 07:54:45
I have a scene set up in a 3D viewport. The game is 2.5D, so for the most part, the game will be composed of sprites.
Until I started using glRotated(0.15, 1, 0, 0); to rotate the entire view of the game, I had no problem getting the world location of the mouse. Now, obviously, the input methods I use for Mouse's X and Mouse's Y on the world need updating, or I need new methods.

So my question is, is there any method to getting the physical X, Y, and Z location of the mouse, taking in the input of the mouse's X and Y? If OpenGL doesn't support the mouse's location with drawn objects or anything like that, could anyone help me with the math?

I gladly thank anyone who takes the time to read this. Smiley
4  Game Development / Newbie & Debugging Questions / Re: Trouble with displaying/loading multiple textures on: 2012-06-16 03:36:59
I'd love to thank you both very much one last time. I solved it and I found a solution. Smiley
For the tile type enum, I added a texture x and y constant. Now my texture coordinates can look like so:

      GL11.glTexCoord2f(type.scalex, type.scaley+0.25f);
      GL11.glTexCoord2f(type.scalex+0.25f, type.scaley+0.25f);
      GL11.glTexCoord2f(type.scalex+0.25f, type.scaley);
      GL11.glTexCoord2f(type.scalex, type.scaley);
5  Game Development / Newbie & Debugging Questions / Re: Trouble with displaying/loading multiple textures on: 2012-06-16 02:52:27
ra4king, I called glBegin and glEnd only once per game tick. But now I put the glBegin and glEnd now for each tile. Is that how it's done properly?

I got what I wanted to achieve to work, but like Mads said, binding a texture per tile was a bad idea. It bogged my game down ridiculously.

I think I will try binding all my images to one texture. And at that point I would just have to change the vertices to match up with the desired image, correct?
6  Game Development / Newbie & Debugging Questions / [Solved] Trouble with displaying/loading multiple textures on: 2012-06-16 02:16:53
I've been stuck on this all day. Googling did nothing, neither did the LWJGL wiki.

I have different tiles that will be displayed with multiple textures. Those textures are loaded into a HashMap, and they load just fine. However, when I attempt to display these tiles, they all use the same texture. It's odd to me, because they all use the last loaded texture.

Let's say I initialize the textures here. Whichever line of code is the last, that texture will be used for everything. The only way I can tell them apart is because I also have the tiles colored as well. So right now, all my textures in the game are stone.
      texturefile.LoadTexture("textures/water.png", "water");
      texturefile.LoadTexture("textures/metal.png", "metal");
      texturefile.LoadTexture("textures/stone.png", "stone");

Here's the draw method for each tile. Is there something I am missing here? Or is it in the initialization?

public void paint(int camx, int camy){

      GL11.glBindTexture(GL11.GL_TEXTURE_2D, texturefile.getTexture(;

      GL11.glColor3f(R*0.6f, G*0.6f, B*0.6f);
      GL11.glVertex2d(l.getX()+camx-offset, l.getY()+camy-offset);
      GL11.glVertex2d(l.getX()+camx+offset, l.getY()+camy-offset);
      GL11.glVertex2d(l.getX()+camx+offset, l.getY()+camy+offset);
      GL11.glVertex2d(l.getX()+camx-offset, l.getY()+camy+offset);
      GL11.glTexCoord2f(0, 0);
      GL11.glVertex2d(l.getX()+camx-offset+1, l.getY()+camy-offset+1);
      GL11.glTexCoord2f(1, 0);
      GL11.glVertex2d(l.getX()+camx+offset-1, l.getY()+camy-offset+1);
      GL11.glTexCoord2f(1, 1);
      GL11.glVertex2d(l.getX()+camx+offset-1, l.getY()+camy+offset-1);
      GL11.glTexCoord2f(0, 1);
      GL11.glVertex2d(l.getX()+camx-offset+1, l.getY()+camy+offset-1);

My game is fairly simple as far as how it's displayed. I think once I understand loading textures, things will be a lot easier. Any help would be great, thanks for reading!
Pages: [1]
Ecumene (50 views)
2017-09-30 02:57:34

theagentd (76 views)
2017-09-26 18:23:31

cybrmynd (183 views)
2017-08-02 12:28:51

cybrmynd (181 views)
2017-08-02 12:19:43

cybrmynd (188 views)
2017-08-02 12:18:09

Sralse (195 views)
2017-07-25 17:13:48

Archive (745 views)
2017-04-27 17:45:51

buddyBro (880 views)
2017-04-05 03:38:00

CopyableCougar4 (1429 views)
2017-03-24 15:39:42

theagentd (1319 views)
2017-03-24 15:32:08
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
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!