Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (753)
Games in Android Showcase (228)
games submitted by our members
Games in WIP (842)
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 01: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 @
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 00: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++) {
         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]
nelsongames (19 views)
2018-04-24 18:15:36

nelsongames (17 views)
2018-04-24 18:14:32

ivj94 (608 views)
2018-03-24 14:47:39

ivj94 (53 views)
2018-03-24 14:46:31

ivj94 (401 views)
2018-03-24 14:43:53

Solater (66 views)
2018-03-17 05:04:08

nelsongames (111 views)
2018-03-05 17:56:34

Gornova (176 views)
2018-03-02 22:15:33

buddyBro (747 views)
2018-02-28 16:59:18

buddyBro (94 views)
2018-02-28 16:45:17
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

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 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!