Hello Guest

Back to using OpenGL LWJGL

  • 5 Replies
  • 10265 Views
Back to using OpenGL LWJGL
« on: January 15, 2005, 15:38:52 »
Performance under Java2D stinks.
I mean REALLY stinks.
LWJGL spews out around 8000fps in windowed mode with a blank window.
J2D spews about 1000fps with a few 32x32 sprites in the BG.

I guess I'm reluctantly back to learning GL.
LWJGL is definitely painless but OpenGL's coordinate system blows hooves.
Everytime I move the camera I can't get my player sprite to synchronise with the camera.
I have 2 float coords, cameraX, cameraY and I call glTranslatef(cameraX, cameraY, 0) and the camera moves.

On the otherhand no matter what I do I can't freaking have my player move WITH the camera.
Both my camera and my player should move at the same time with the same coordinates, yet they don't.
I call glTranslate in my player class in order to center the guy.

I HATE OPENGL'S COORDINATE SYSTEM!
It gave me the shets before so I quit learning GL quarter way through.

Decided to use jME. jME is awesome for 3D but not exactly my cup of tea when it comes down to 2D rendering.

Anyway, I'm back to square one. I really want to kill myself. :roll:

EDIT:
I was so pissed off at this I deleted my entire project and now I'm restarting again. :x

EDIT EDIT:
What's with this bullshit coordinate system measuring everything in 0.1f increments.
It sure as hell isn't the screen coordinates so what the hell is it?
:lol:

I love it how I use LWJGL mouse input and it returns the screen coordinates as screen pixels.
Now how the living hell am I supposed to convert screen coordinates into 0.1f increments? :lol:

It really makes setting the width and height of objects awckward. I mean who the hell makes a sprite 0.1x0.1? :lol:

*

Offline princec

  • *****
  • 1933
    • Puppygames
Back to using OpenGL LWJGL
« Reply #1 on: January 15, 2005, 17:31:47 »
What are you on about :)? All my stuff is 1:1 pixels-to-coord mapped. In fact that's how LWJGL inits itself by default. The only difference between LWJGL and Java2D is that 0,0 is in the bottom left.

Cas :)

Back to using OpenGL LWJGL
« Reply #2 on: January 15, 2005, 17:46:49 »
Quote from: "princec"
What are you on about :)? All my stuff is 1:1 pixels-to-coord mapped. In fact that's how LWJGL inits itself by default. The only difference between LWJGL and Java2D is that 0,0 is in the bottom left.

Cas :)


You're a magician. :?

Another problem I 'm having is that sprites are bloatingly large.

OpenGL is giving me the shets.

*

Offline princec

  • *****
  • 1933
    • Puppygames
Back to using OpenGL LWJGL
« Reply #3 on: January 15, 2005, 19:06:52 »
Download Puppytron and decompile the jars :) Better still just look at the Space Invaders tutorial.

Cas :)

*

Anonymous

Back to using OpenGL LWJGL
« Reply #4 on: January 24, 2005, 09:14:18 »
To get Java2D screencoords, use this transformation:

Code: [Select]

      GL11.glLoadIdentity();
      GL11.glScalef(1.0F / (w / 2.0F), 1.0F / (h / 2.0F), 1.0F);
      GL11.glTranslatef(-w / 2.0F, h / 2.0F, 0.0F);
      GL11.glScalef(1.0F, -1.0F, 1.0F);

*

dp

Back to using OpenGL LWJGL
« Reply #5 on: January 25, 2005, 22:15:32 »
jME works perfectly with 2D....have you seen my game called VolatileZapper which is a 2d alien shooter type game built on jme...

its very simple to make.

DP