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] 2 3 4
1  Game Development / Newbie & Debugging Questions / Re: Double-clickable java application on Mac OSX on: 2010-03-18 19:36:19
Thanks a lot for the help (sorry about the delay in replying.)
2  Game Development / Newbie & Debugging Questions / Double-clickable java application on Mac OSX on: 2010-02-27 22:51:49
Like it says- I want to be able to double-click on *something* and have it execute my java app.
I do *NOT* want to use webstart OR .jar files.  They've caused me too much damn pain, because webstart is complicated and .jar files, in my experience, do not play nice with native libraries (they expect them to be in the same directory.)
I *DO* want to be able to move the directory containing the executable and class files around (because I want to distribute this to other users.)
I *DO* want to be able to put the executable in a different directory from the root directory for the java classpath (because I don't want users to be confused by a dozen other icons in the same folder.)


Basically, what I was going to use was a simple .command file:
1  
2  
cd MyGameDirectory
java -cp .:lwlgl.jar:lwjgl_util.jar:lwjgl-debug.jar rep.game.GameTest


...But a .command file insists on absolute, rather than relative pathnames, so that doesn't work, and I can't move around the directory if I *do* use absolute pathnames.

Anyways- any help would be appreciated.
3  Java Game APIs & Engines / OpenGL Development / Re: Error with vertex buffers. on: 2009-10-08 18:50:39
Fixed now!  I never found out exactly what the problem was, but I think it had something to do with the glDrawArrays method, basically, putting in 0 instead of GL.GL_FLOAT seemed to clear things up.  (Also, I wasn't using native buffers correctly for lighting.)  Anyways- thanks for the help.
4  Java Game APIs & Engines / OpenGL Development / Re: Implementing a KeyListener? on: 2009-10-07 15:13:07
Much obliged!
5  Java Game APIs & Engines / OpenGL Development / Implementing a KeyListener? on: 2009-10-07 13:11:13
I was just wondering how I'd go about implementing a system that notifies a listener class whenever a given key is pressed?  Is there some handy LWJGL utility for it, or do I need to poll across all keys and handle it that way?
6  Java Game APIs & Engines / OpenGL Development / Re: Error with vertex buffers. on: 2009-09-07 16:54:32

Actually, I've been able to narrow down the problem a bit.  Like you said, LWJGL apparently expects you to clear() the buffer before you put(), then flip(), rather than rewind()... that lets me render basic geometry, colours, and lighting, no problem now.

The crash only happens when I try to enable textures, but I"m still at a loss as to why...
7  Java Game APIs & Engines / OpenGL Development / Re: Error with vertex buffers. on: 2009-09-07 06:03:27
buffer.clear() and buffer.flip() don't seem to have any useful effect, I'm afraid...
8  Java Game APIs & Engines / OpenGL Development / Re: Error with vertex buffers. on: 2009-09-06 22:13:06
Well, maybe you could help with a related problem.  I've tried out a very basic demo program for drawing using vertex arrays, and I can't seem to get anything display on-screen.  This is the entirety of the relevant code:
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  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
package test ;
import java.nio.FloatBuffer;

import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.* ;


public class BasicTest {
 
 
  public static void main (String args[]) {
    BasicTest test = new BasicTest() ;
    test.init() ;
  }
 
  void init() {
    setDisplayMode() ;
    doRenderLoop() ;
  }

  private static FloatBuffer
    vertBuffer = BufferUtils.createFloatBuffer(9) ;
 
  private void doRenderLoop() {
    while (true) {
     
      GL11.glMatrixMode(GL11.GL_PROJECTION) ;
      GL11.glLoadIdentity() ;
      GL11.glOrtho(-2, 2,  -2, 2,  -1, 1) ;
      GL11.glMatrixMode(GL11.GL_MODELVIEW) ;
      GL11.glLoadIdentity() ;
     
      GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY) ;
      vertBuffer.rewind() ;
      vertBuffer.put(new float[] { 0, 0, 0,  1, 0, 0,  1, 1, 0 }) ;
      vertBuffer.rewind() ;
      GL11.glVertexPointer(3, GL11.GL_FLOAT, vertBuffer) ;
      GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, 3) ;
      Display.update() ;
     
      if (Display.isCloseRequested()) {
        Display.destroy() ;
        System.exit(0) ;
      }
    }
  }
 

  private boolean setDisplayMode() {
    try {
      DisplayMode chosen = Display.getAvailableDisplayModes()[0] ;
      final int
        wide = chosen.getWidth(),
        high = chosen.getHeight() ;
      Display.setDisplayMode(chosen) ;
      Display.setFullscreen(false) ;
      Display.create() ;
    }
    catch (Exception e) {
      e.printStackTrace() ;
    }
    return false ;
  }
}


I'll also try playing around with those buffer methods you suggested.  ...Thanks either way.

EDIT:  Whoops, slight ommision in the code- Display.update().  I still don't see anything, though...
9  Java Game APIs & Engines / OpenGL Development / Re: Error with vertex buffers. on: 2009-09-05 21:37:35
I don't recall using multitexturing at any point, and I'm pretty sure I enabled all the relevant client states- pointers for colour/vertex/normal/and UV data.
10  Java Game APIs & Engines / OpenGL Development / Error with vertex buffers. on: 2009-09-05 19:15:32
I think that's the problem anyway.  All I get out as an error message in eclipse is this:

Quote
Invalid memory access of location 01678824 eip=1acda200

The meat of the code is here:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
  private static void flushGeometry() {
    if (numPolys == 0) return ;
    GL11.glMatrixMode(GL11.GL_MODELVIEW) ;
    GL11.glLoadIdentity() ;
    textBuffer.rewind() ;
    normBuffer.rewind() ;
    vertBuffer.rewind() ;
    huesBuffer.rewind() ;
    textBuffer.put(textArray, 0, numPolys * 6) ;
    normBuffer.put(normArray, 0, numPolys * 9) ;
    vertBuffer.put(vertArray, 0, numPolys * 9) ;
    huesBuffer.put(huesArray, 0, numPolys * 9) ;
    textBuffer.rewind() ;
    normBuffer.rewind() ;
    vertBuffer.rewind() ;
    huesBuffer.rewind() ;
    GL11.glTexCoordPointer(2, GL11.GL_FLOAT, textBuffer) ;
    GL11.glNormalPointer(GL11.GL_FLOAT, normBuffer) ;
    GL11.glVertexPointer(3, GL11.GL_FLOAT, vertBuffer) ;
    GL11.glColorPointer(3, GL11.GL_FLOAT, huesBuffer) ;
    GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, numPolys * 3) ;
    numPolys = 0 ;
  }


If I comment out the second-last line (the call to drawArrays,) there's no error (but of course, nothing renders.)  Any clue what's happening here?
11  Java Game APIs & Engines / JOGL Development / Re: I think I'm rendering in software? on: 2009-05-28 05:59:09
Thanks for the tip.  I'll try spawning a different thread for the rendering process and also see if I can cut down the time taken on another machine.  The interesting thing is that calling glFinish does seem to increase the time taken by about 50%- would that support the active-waiting theory?

As mentioned, I'm piling lots of individual quads into a single set of geometry buffers before rendering, so glDrawArrays is pushing about 1000 polys a go.  (Speaking of which, my buffer manipulation is also appallingly slow, but I can at least optimise around that...)
Quote
I think your main performance hit is that you're doing significant overdraw and zbuffer performance is shot to hell.  I once tried doing a benchmark rendering 10000 cubes in one place.  The performance was terrible, but when it switched over to 10000 cubes on screen, but spread out randomly performance was much more acceptable.
I don't think so- I've seen comparable rendering speeds for fullscreen scenes with trees spread all over the place (about 1000 sprites, plus about 1000 terrain tiles.)
http://img223.imageshack.us/img223/2117/screenpic.jpg



12  Java Game APIs & Engines / JOGL Development / Re: I think I'm rendering in software? on: 2009-05-26 23:03:39
Again, I have to stress that my main gripe here is that the CPU, not the GPU, seems to be doing an inordinate amount of work here.  I'm not calling glFinish() anywhere, so why is GPU work slowing down my CPU thread?  I'm sorry if I was unclear about this.

Look, let me explain:  This is where all the rendering is being performed-
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
  
  private void flushGeometry(GL draws) {
    final int numVerts = vertBuffer.position() / 3 ;
    if (numVerts == 0) return ;
    if (HUD.isMouseState(HUD.CLICKED))
      I.say("\nFlushing buffer, num. verts: " + numVerts) ;
    textBuffer.rewind() ;
    normBuffer.rewind() ;
    vertBuffer.rewind() ;
    draws.glTexCoordPointer(2, GL.GL_FLOAT, 0, textBuffer) ;
    draws.glNormalPointer(GL.GL_FLOAT, 0, normBuffer) ;
    draws.glVertexPointer(3, GL.GL_FLOAT, 0, vertBuffer) ;
    draws.glDrawArrays(GL.GL_TRIANGLES, 0, numVerts) ;
  }


Now, if I literally comment out only the final line (to glDrawArrays), then the time between initiating rendering and final method return, on the CPU side, drops by a full 40 milliseconds.  (That method is only called about a dozen times during rendering, I should add, since I'm essentially piling all the individual identically-textured sprites into one set of geometry buffers.)  Everything before that line is (virtually) pure CPU work.  So why is drawArrays eating up this massive chunk of my CPU time?  Shouldn't everything after this point be the GPU's problem?
13  Java Game APIs & Engines / OpenGL Development / Re: LWJGL is telling me I don't have a graphics card. on: 2009-05-26 22:54:38
Wait- I see the problem.  I'm importing org.lwjgl.util.Display, as opposed to org.lwjgl.opengl.Display- frack.  Sorry to bother.
14  Java Game APIs & Engines / JOGL Development / Re: I think I'm rendering in software? on: 2009-05-26 20:23:12
Thanks- I just tried disabling glAlphaTest, but I'm afraid I didn't see a noticeable difference.  But that's not my main gripe here- what I want to know is why is my GPU time eating into my CPU time?  I could tolerate the slow rendering if my main thread was free to attend to game logic, but it's apparently stuck until my rendering method returns- which leads me to wonder if it's actually happening in software.
15  Java Game APIs & Engines / JOGL Development / I think I'm rendering in software? on: 2009-05-26 20:13:31
I'm having a problem with my overall rendering speed.

Click to Play


Basically the little billboarded tree you can see (bigger on the right) is being rendered 10,000 times (in the exact same position,) and it's slowing my framerate to something like 10 fps (that's a deliberate stress-test, btw.)  But here's the kicker:  if I reduce the sprite's size to 1/5th, for 1/25th previous screen area, then the time taken for it to render drops to almost nothing.  (In other words, rendering time seems to be directly proportionate to the No. of fragments x No. of sprites.)  I'm not calling glFinish() at any point, so why isn't the rendering being handed over to the graphics card while my main thread does other, game-related, things?  I suspect that for some reason the rendering is being done in software, but I can't tell...  How would I find out?  Are there any other steps I could take here, and/or am I missing something obvious?

Thanks in advance.
16  Java Game APIs & Engines / JOGL Development / Re: Error following switch to more recent JOGL build. on: 2009-05-26 19:54:38
Ah, wait- I see what I did wrong:  I was actually referring to the native libraries in an older version of the same project!  My mistake.
17  Java Game APIs & Engines / OpenGL Development / Re: LWJGL is telling me I don't have a graphics card. on: 2009-05-26 19:49:08
Quote
it IS finding a graphics card - it just doesn't know which it is (missing impl for native mac - afaik, only windows has this ...)
Whoops!  -My mistake.
Quote
All of the code under org.lwjgl.test.* works - and some serve as demos at http://lwjgl.org/demos.php
Yes, but I meant in terms of actual source code- the stuff online (e.g, here) uses Display class methods that don't seem to be there in the latest version, e.g:
1  
2  
3  
4  
  213       setDisplayMode();
  214       Display.setTitle(WINDOW_TITLE);
  215       Display.setFullscreen(fullscreen);
  216       Display.create();

Or have I made some ill-considered newb blunder again?   Sad
18  Java Game APIs & Engines / OpenGL Development / LWJGL is telling me I don't have a graphics card. on: 2009-05-26 17:32:46
I get this from running DisplayTest:
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  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
==== Test Current ====
Info about current:
Graphics card: null, version: null
Resolution: 1440x900x32@0Hz
---- Test Current ----
==== Test query ====
Retrieving available displaymodes
Found 18 modes
The first 5 are:
800 x 500 x 16 @0Hz
720 x 480 x 16 @0Hz
640 x 480 x 32 @0Hz
1280 x 800 x 32 @0Hz
720 x 480 x 32 @0Hz
640 x 480 x 16 @0Hz
---- Test query ----
==== Test setDisplayMode ====
Retrieving available displaymodes
Looking for 640x480...found!
Changing to mode...done
Resolution: 640x480x32@0Hz
Resetting mode...done
---- Test setDisplayMode ----
==== Test setDisplayConfigurationTest ====
Testing normal setting
Configuration changed, gamma = 1.0 brightness = 0.0 contrast = 1.0
Testing gamma settings
Configuration changed, gamma = 5.0 brightness = 0.0 contrast = 1.0
Configuration changed, gamma = 0.5 brightness = 0.0 contrast = 1.0
Testing brightness settings
Configuration changed, gamma = 1.0 brightness = -1.0 contrast = 1.0
Configuration changed, gamma = 1.0 brightness = -0.5 contrast = 1.0
Configuration changed, gamma = 1.0 brightness = 0.5 contrast = 1.0
Configuration changed, gamma = 1.0 brightness = 1.0 contrast = 1.0
Testing contrast settings
Configuration changed, gamma = 1.0 brightness = 0.0 contrast = 0.0
Configuration changed, gamma = 1.0 brightness = 0.0 contrast = 0.5
Configuration changed, gamma = 1.0 brightness = 0.0 contrast = 10000.0
resetting...done
---- Test setDisplayConfigurationTest ----


I'm running a 2.2Ghz Intel Core 2 Duo MacBook with a NVidia GeForce 8600M GT graphics card.  Does anyone know why lwjgl can't recognise my hardware?  -I've also noticed slowdowns under an older version of JOGL that suggested software rendering was being used.

Also, is there anywhere I can get example app code for the latest version of lwjgl, since the Display class seems to have lost most of it's functionality since the available tutorials were posted, and are badly out of date?  Thanks in advance.
19  Java Game APIs & Engines / JOGL Development / Re: Error following switch to more recent JOGL build. on: 2009-05-26 14:42:22
Right.  Thanks for the help anyway.

Thing is, this IS the latest version of jogl (for all libs/jars,) whereas my previous version (from early '07) ran fine (albeit very inefficiently for some reason, hence the switch.)  I guess I might have to give lwjgl a try at this point.

EDIT: typo
20  Java Game APIs & Engines / JOGL Development / Re: Error following switch to more recent JOGL build. on: 2009-05-25 19:52:21
Thanks for the pointer, but I'm almost certain that would give rise to a different kind of bug- I still get the precise same error message after I implement those fixes- heck, it still pops up if I comment out the display method's innards entirely!

The exact source of the error message seems to be here:
http://www.koders.com/java/fid6FACC71CCFAB70D7AFF2E93E92E1309C5C36A5F4.aspx

But I don't know why it's complaining about more than one GL context here... did you run the app under OSX?

EDIT:  The bug also seems very similar to one reported on the Xith3d forums-
http://xith.org/forum/index.php?topic=993.0
21  Java Game APIs & Engines / JOGL Development / Re: Error following switch to more recent JOGL build. on: 2009-05-25 17:45:11
It's the most recent universal binary build I could get, but I guess this is something unusual... I'll try running some of the demos and see if that helps.
22  Java Game APIs & Engines / JOGL Development / Re: Error following switch to more recent JOGL build. on: 2009-05-25 10:37:36
If it helps any, this is the precise code I was trying to run (it compiles fine)

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  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
import javax.media.opengl.* ;
import java.awt.BorderLayout;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.nio.Buffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import javax.swing.JFrame;
import com.sun.opengl.util.BufferUtil ;
import javax.media.opengl.glu.*;
import com.sun.opengl.util.*;

public class VertexArrayTest extends JFrame implements GLEventListener {
   
    private GL gl;
    private GLU glu;
    private GLCanvas canvas;
    private Animator anim;

   
    public VertexArrayTest() {
        canvas = new GLCanvas() ;
        canvas.addGLEventListener(this);
       
        getContentPane().add(canvas, BorderLayout.CENTER);
        setSize(500, 500);
        setTitle("Red Book Example ");
        setVisible(true);
        anim = new Animator(canvas);            // calls display() periodically
       anim.start();        
       
        this.addWindowListener(new WindowListener() {

            public void windowOpened(WindowEvent arg0) {}

            public void windowClosing(WindowEvent arg0) {
                anim.stop();
                setVisible(false);
                System.exit(0);
            }

            public void windowClosed(WindowEvent arg0) {}
            public void windowIconified(WindowEvent arg0) {}
            public void windowDeiconified(WindowEvent arg0) {}
            public void windowActivated(WindowEvent arg0) {}
            public void windowDeactivated(WindowEvent arg0) {}
        });
       
    }    
   
    public static void main(String[] args) {
        VertexArrayTest desk = new VertexArrayTest();
    }

    public void init(GLAutoDrawable arg0) {
        gl = arg0.getGL();
        glu = new GLU();
       
        gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

        int[] v = new int[] {25, 25,
            100, 325,
            175, 25,
            175, 325,
            250, 25,
            325, 325};
        float[] c = new float[] {
                1.0f, 0.2f, 0.2f,
                0.2f, 0.2f, 1.0f,
                0.8f, 1.0f, 0.2f,
                0.75f, 0.75f, 0.75f,
                0.35f, 0.35f, 0.35f,
                0.5f, 0.5f, 0.5f};

        IntBuffer vertices = BufferUtil.newIntBuffer(6*2);
        FloatBuffer colors = BufferUtil.newFloatBuffer(6*3);
       
        vertices.put(v);
        colors.put(c);

       
        gl.glEnableClientState (GL.GL_COLOR_ARRAY);
        gl.glEnableClientState (GL.GL_VERTEX_ARRAY);        
       
        gl.glColorPointer (3, GL.GL_FLOAT, 0, colors);
        gl.glVertexPointer (2, GL.GL_INT, 0, vertices);        
    }

    public void display(GLAutoDrawable arg0) {
        gl.glClear(GL.GL_COLOR_BUFFER_BIT );
        gl.glDrawArrays (GL.GL_TRIANGLES, 0, 6);
        gl.glFlush ();
    }

   
    public void reshape(GLAutoDrawable drawable, int x, int y, int width,
            int height) {
        gl.glViewport (0, 0, width,  height);
        gl.glMatrixMode (GL.GL_PROJECTION);
        gl.glLoadIdentity ();
        glu.gluOrtho2D (0.0, width, 0.0, height);
    }

    public void displayChanged(GLAutoDrawable arg0, boolean arg1, boolean arg2) {}
   
}
23  Java Game APIs & Engines / JOGL Development / Error following switch to more recent JOGL build. on: 2009-05-24 23:41:42
I'm running a fairly new MacBook under OS X.4, and I'm afraid I can't make head nor tail of it myself, so I'll just post it here:

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  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
Exception in thread "Thread-2" javax.media.opengl.GLException: java.lang.ClassCastException: java.nio.DirectByteBuffer
   at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:271)
   at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:263)
   at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)
   at com.sun.opengl.util.Animator.display(Animator.java:144)
   at com.sun.opengl.util.Animator$MainLoop.run(Animator.java:181)
   at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.ClassCastException: java.nio.DirectByteBuffer
   at com.sun.opengl.impl.macosx.MacOSXOnscreenGLDrawable.lockSurface(MacOSXOnscreenGLDrawable.java:180)
   at com.sun.opengl.impl.macosx.MacOSXOnscreenGLContext.makeCurrentImpl(MacOSXOnscreenGLContext.java:57)
   at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)
   at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
   at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:305)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLException: Attempt to make the same context current twice on thread Thread[AWT-EventQueue-0,6,main]
   at com.sun.opengl.impl.GLContextLock.lock(GLContextLock.java:83)
   at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:131)
   at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
   at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:265)
   at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)
   at javax.media.opengl.GLCanvas.paint(GLCanvas.java:142)
   at sun.awt.RepaintArea.paintComponent(RepaintArea.java:276)
   at sun.awt.RepaintArea.paint(RepaintArea.java:241)
   at apple.awt.ComponentModel.handleEvent(ComponentModel.java:251)
   at java.awt.Component.dispatchEventImpl(Component.java:4126)
   at java.awt.Component.dispatchEvent(Component.java:3885)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


Is this at all familiar?  What am I doing wrong?
24  Java Game APIs & Engines / JOGL Development / Re: 'Ghosting' objects using the stencil buffer? on: 2009-03-25 13:58:52
Quote
I might be a bit off mark here, but is this the sort of effect you're looking for:
Very similar, yes.  (The screen looks nice, by the way- where'd you get it from?)  I'll use vertex colouring if push comes to shove, but I'm reasonably sure there must be some simple method for getting true greyscale, and then tinting toward a specific colour.
Quote
This might sound dumb but what if you multi-textured it and made a screen-texture for the second texture...
Oh, sure- you can manufacture luminance textures easily enough... I dunno.  It just seems sort of like a waste of memory...
Quote
I'd forgotten about the pesky -0.5 in the DOT3 extension, stupid bumpmapping hacks.  However if you combine that with SECONDARY_COLOR above you could use that to add 0.5 onto your texture colour and hopefully eliminate the clamping.

However I'm not entirely sure what order those operations are done in, so you might find that the colours have already been clamped before the +0.5 gets applied.
I'll try and give that a shot and see what the results are, thanks.  (Mind you, I'd be quite interested to know how DOT3 is used for bumpmapping. Smiley )
25  Java Game APIs & Engines / JOGL Development / Re: 'Ghosting' objects using the stencil buffer? on: 2009-03-24 13:13:41


I'm afraid the technique you suggested doesn't work...  after some experimentation, I managed to get the following results:



The problem is that the GL_DOT3_RGB formula goes like this:

4 × (((A0 r - 0.5) × (A1 r - 0.5)) + ((A0 g - 0.5) × (A1 g - 0.5)) + ((A0 b - 0.5) × (A1 b - 0.5)))

It's the "-0.5f" all over the place that ruins it. Basically, any RGB values less than 50% just disappear.  What I need is:

(A0 r x A1 r) + (A0 g x A1 g) + (A0 b x A1 b)

...also, GL_COMBINE seemed to eliminate normal lighting calculations, which is not what I'm looking for...
26  Java Game APIs & Engines / JOGL Development / Re: 'Ghosting' objects using the stencil buffer? on: 2009-03-07 12:52:33
Alternatively you can use glTexEnv with DOT3 to make your sprite greyscale, or SECONDARY_COLOR to tint a sprite towards a specific colour. Both of which will work on pretty much any hardware still in use today.
How, exactly, would I use glTexEnv with DOT3 again?  I mean, what's the precise syntax?  Are you talking about generating a secondary texture?
27  Java Game APIs & Engines / JOGL Development / Re: 'Ghosting' objects using the stencil buffer? on: 2009-03-05 02:18:52
Quote
Alternatively you can use glTexEnv with DOT3 to make your sprite greyscale, or SECONDARY_COLOR to tint a sprite towards a specific colour. Both of which will work on pretty much any hardware still in use today.
Thanks a lot.  That sounds exactly like what I need.  Smiley

And thanks for the shader code too.
28  Java Game APIs & Engines / JOGL Development / Re: 'Ghosting' objects using the stencil buffer? on: 2009-03-04 07:34:14
Well, I'm almost certain there's some way to do this without shaders, but I guess it wouldn't hurt to take a look.  So, sure, please...
29  Java Game APIs & Engines / JOGL Development / Re: 'Ghosting' objects using the stencil buffer? on: 2009-03-03 19:11:15
Well, I mean imagine a standard RTS, where you're placing a new building- the little image of the building will turn different colours depending on where you're trying to put it.  I'm almost certain you wouldn't need a vertex shader for something like this, since I saw this effect back 10-15 years ago.
30  Java Game APIs & Engines / JOGL Development / 'Ghosting' objects using the stencil buffer? on: 2009-03-03 15:09:29
I'm trying to put together a relatively simple isometric-perspective game, and I'd like the ability to 'ghost out' various portions of the screen as part of UI feedback.  Specifically, when the player is trying to place a specific building, I'd like to have the building-preview (and possibly underlying terrain) turn red or green depending on whether it's over a legal or illegal location.

As in, for every pixel corresponding to the elements in question, I'd average the RGB components, and then set either R, G or B to that exact value (with 0 in other components.)  How would I go about this?
Pages: [1] 2 3 4
 

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!