Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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  Game Development / Newbie & Debugging Questions / Re: Vertex3f's to hold properties? on: 2008-12-22 02:05:49
In computer graphics its called SELECTION or PICKING.

OpenGL provides built in functionality for this ( glRenderMode(GL_SELECT) ) but you must not use it as it can be slow and OpenGL  themselves have said they regret implementing it in the first place.

So what to use?

1) Colour coded picking @ http://www.lighthouse3d.com/opengl/picking/index.php3?color1
2) Transform your 2D mouse click point (xm,ym) into a ray in your 3D world and do collision detection with each of your objects (Simple in the case of 'tiles') (You might use gluUnproject)

Okay, if i do the color coded picking, Lets say were using the color light green, is there 3000 different colored light greens that would look the same to the eye? even by adjusting each tile's color up by a unnoticible notch, but 3000 times?
2  Game Development / Newbie & Debugging Questions / Vertex3f's to hold properties? on: 2008-12-22 01:30:52
Hi, im new to OpenGL for java, now id like to make a map of tiles (square 1 sided tiles) going 48*48, i have done this using the following code.
int count = 0;
for(int i=0; i < 48*48; i++) {
                        count++;
         gl.glVertex3f(AcrossTwo, DownTwo, -0.4f);
         gl.glVertex3f(AcrossTwo,  DownOne, -0.4f);
         gl.glVertex3f(AcrossOne,  DownOne, -0.4f);
         gl.glVertex3f(AcrossOne, DownTwo, -0.4f);

         AcrossOne+= 1.02f;
         AcrossTwo+= 1.02f;
                        // After 48 tiles have been layed, it moves the position down and resets horizontal back to the start to lay another 48 under it.
         if(count == 48) {
            count = 0;
            DownOne+= 1.02f;
            DownTwo+= 1.02f;
            AcrossOne = 1.0f;
            AcrossTwo = 0.0f;
         }

}

Now this does show the tiles i created, except im completely lost in how i go about accessing them, lets say i click a tile on my screen, id like to be able to change that tile's color. I know this isnt structured properly (Normally id create a Tile class, holding all it's properties) except i don't actually know how to access each vertex3f by a mouse click?

Thanks for whoever helps Tongue
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.

ctomni231 (36 views)
2014-07-18 06:55:21

Zero Volt (34 views)
2014-07-17 23:47:54

danieldean (27 views)
2014-07-17 23:41:23

MustardPeter (30 views)
2014-07-16 23:30:00

Cero (44 views)
2014-07-16 00:42:17

Riven (46 views)
2014-07-14 18:02:53

OpenGLShaders (35 views)
2014-07-14 16:23:47

Riven (35 views)
2014-07-14 11:51:35

quew8 (31 views)
2014-07-13 13:57:52

SHC (67 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!