Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
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.

Cheers,

Kev

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:

1  
2  
3  
4  
5  
      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.
1  
2  
3  
      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?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
public void paint(int camx, int camy){

      GL11.glBindTexture(GL11.GL_TEXTURE_2D, texturefile.getTexture(type.name().toLowerCase()).getTextureID());

      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]
 

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

The first screenshot will be displayed as a thumbnail.

Pippogeek (39 views)
2014-09-24 16:13:29

Pippogeek (30 views)
2014-09-24 16:12:22

Pippogeek (19 views)
2014-09-24 16:12:06

Grunnt (44 views)
2014-09-23 14:38:19

radar3301 (27 views)
2014-09-21 23:33:17

BurntPizza (62 views)
2014-09-21 02:42:18

BurntPizza (32 views)
2014-09-21 01:30:30

moogie (39 views)
2014-09-21 00:26:15

UprightPath (50 views)
2014-09-20 20:14:06

BurntPizza (54 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!