Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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: Robot.mouseMove and Frame Decoration on: 2007-01-11 21:55:41
The MouseMotionListener is attached to the GLCanvas, the problem lies in the Robot class itself, its coordinates work from the top left of the actual JFrame, not the GLCanvas, which gives me the offset problem.

Anyway, despite that, the getInsets() method is EXACTLY what I was looking for Cheesy Thank you very much!
2  Game Development / Newbie & Debugging Questions / Robot.mouseMove and Frame Decoration on: 2007-01-11 21:14:50
Ok, I have a JOGL scene (and no, the problem isn't about JOGL).

I was implementing a mouse look system where one holds the right mouse button and drags to move the direction of the camera around. I wanted to keep the mouse cursor anchored in one position while this is done so the camera doesn't stop rotating when the mouse cursor hits the edge of the screen. Therefore, at the end of the drag calculations, I use Robot.mouseMove to move the mouse cursor back to where it originally was.

The problem is that I can't get the exact coordinates because I can't tell work out the offset generated by the frame's decoration (title bar, minimise, maximise and close buttons). This is throwing my camera rotation way off and driving me nuts. I really don't want to hard code it in as this will just cause problems in future and for other people/systems. How does one find out this offset. Turning off the decoration is out of the question.

If I am going in the totally wrong direction and theres a better way of sensing the mouse drag, don't hesitate to correct me Smiley

Thank in advance,
Jargon
3  Java Game APIs & Engines / JOGL Development / Re: Textured HUD refreshing extremely slowly :( on: 2007-01-10 04:07:36
Ugh I can't believe I overlooked that Smiley

It was a non-power of 2 problem. My renderer I am working on was shelved a long time ago and I have only recently continued work on it. So when I came around to making the HUD texture I totally overlooked it. So when I came to testing, all the old textures worked fine (because they were power of 2) and the HUD didn't.

This leads me to another question, how does one go about making textures for a HUD without having them stretched or squished? If I have a toolbar aligned along the bottom of the screen about 50 pixels in height, do I make my image like normal then stretch it to some power of 2 so its distorted and let JOGL unstretch when applying it the quad?

Anyway, thanks for the help. I guess I can continue working on it now Cheesy Also, 1 last thing, is around 360 fps good/bad/average for having 1 textured model (quite a low polygon count) rendering? I thought it seemed a bit low for the simplicity of the scene. I am using the standard animator though, not sure if that has some fixed refresh limit, hmmm.
4  Java Game APIs & Engines / JOGL Development / Textured HUD refreshing extremely slowly :( on: 2007-01-09 23:28:43
I've been searching through this forum and I can't find anyone with the same problem as what I'm getting.

As soon as I try and render a texture on my HUD the renderer runs around 1.5 frames a second, compared to the 300+ that I am normally getting. I use the begin2D() and end2D() that I found elsewhere on this forum.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
    public void begin2D() {
        gl.glMatrixMode(GL.GL_PROJECTION);        
        gl.glPushMatrix();        
        gl.glLoadIdentity();        
        gl.glOrtho(0.0f, getWidth(), getHeight(), 0.0f, -1.0f, 1.0f);        
        gl.glMatrixMode(GL.GL_MODELVIEW);        
        gl.glPushMatrix();        
        gl.glLoadIdentity();        
        gl.glDisable(GL.GL_DEPTH_TEST);        
        gl.glDisable(GL.GL_LIGHTING);
    }


1  
2  
3  
4  
5  
6  
7  
8  
    public void end2D() {
       gl.glEnable(GL.GL_LIGHTING);
        gl.glEnable(GL.GL_DEPTH_TEST);
        gl.glMatrixMode(GL.GL_PROJECTION);
        gl.glPopMatrix();
        gl.glMatrixMode(GL.GL_MODELVIEW);
        gl.glPopMatrix();
    }


The code I use to draw the HUD itself is as follows (extremely simple at the moment until I sort this problem out)

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
   textureManager.bindTexture("hud");
   gl.glBegin(GL.GL_QUADS);
   gl.glTexCoord2f(0, 1);
   gl.glVertex3f(0, 550, 0);
   gl.glTexCoord2f(1, 1);
   gl.glVertex3f(800, 550, 0);
   gl.glTexCoord2f(1, 0);
   gl.glVertex3f(800, 600, 0);
   gl.glTexCoord2f(0, 0);
   gl.glVertex3f(0, 600, 0);
   gl.glEnd();


If I disable 2D texturing everything runs at normal speed, it is only when texturing is enabled everything slows down. But without the HUD texturing runs at normal speed as I have a rotating model I have loaded, which is fully textured. I did some debugging and found out it takes 0.2 seconds to render the HUD and on the gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); immediately after (on the next render cycle) it takes another 0.4 seconds. I have no idea why it is doing this and my the development of my application is pretty much at a stand still until I get this sorted. Sad

I'm hoping someone else is already aware of this problem and knows the solution. ^_^

Thanks in advance,
Jargon
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.

Longarmx (38 views)
2014-10-17 03:59:02

Norakomi (29 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (28 views)
2014-10-15 16:18:58

TehJavaDev (56 views)
2014-10-14 00:39:48

TehJavaDev (55 views)
2014-10-14 00:35:47

TehJavaDev (46 views)
2014-10-14 00:32:37

BurntPizza (64 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (78 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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