Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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 ... 7
1  Java Game APIs & Engines / JOGL Development / Re: How to rotate an object around 3 axis with the mouse????? on: 2009-02-10 05:48:17
Firstly, are you sure you need to rotate the scene around all 3 axes?  z rotation is typically a roll rotation, and from the description of your scene may not be needed.

Second, if you need your z rotation, then keep in mind that you are mapping a 2d space into a 3d space... so you need to mentally partition the 2d movement space into 3d rotations.  You need to imagine exactly what results you want from what mouse motion.

Third, your (arbitrary) mrtoz is going to be dramatically greater than the x and y rots.  It is going to be 2 orders of magnitude greater than mrotz and mroty in the case of diagonal movement.

Finally, you are misusing glRotatef().  You should really be passing a normalized vector to the x,y,z parameters.  However, it claims to normalize for you.  Anyway you are also rotating around the wrong vectors in all cases:  (mrotz around x, mrotz around y, and mrotx around z).  mroty isn't even getting used.

I would recommend just doing away with mrotz and doing pure pitch and yaw, which is highly typical:

gl.glRotatef(mrotx, 0, 1, 0);
gl.glRotatef(mroty, 1, 0, 0);

2  Java Game APIs & Engines / JOGL Development / Re: Translating Mouse Coordinates from 2D to 3D on: 2009-01-13 04:03:59
What information do you have readily available about your projection transformation?

Do you have your full projection matrix?

Do you know the 8 corners of your frustum, or the 6 planes of it?

Do you know your near/far planes + horizontal and vertical fov?

I can probably help you if you know any of those.  I find it quickest and easiest to do if you have the frustum corners cached somewhere.

If you use glu, you could also try gluUnproject().

3  Java Game APIs & Engines / JOGL Development / Re: Texture Packing, is there any point in doing it manually? on: 2009-01-13 03:54:59
If you are having performance issues I would also look at trying to convert your immediate-mode rendering into vertex arrays or vertex buffers.  Also I would get rid of that GL_POLYGON and make it a triangle strip instead.

Immediate mode is slower full-stop but right now you are putting down to opengl 32 floats for each polygon.

+ 6 for translate/scale
+16 for the shear matrix.

So right now ignoring everything else you are sending down 54 floats per polygon, plus some additional overhead for pushing and popping matrices, setting polygon mode, etc...

Now just sending down floats isn't necessarily the big deal but it is an indicator.

First off you can combine the translate/scale/shear into a single matrix so you only need 16 floats to specify the modelview matrix transform.

Secondly if you go back to using 1 texture per image, then you can make a single vertex buffer object that works for all your stuff:

uv=(0,1)    uv=(1,1)
vt=(0,1)    vt=(0,1)

uv=(0,0)    uv=(1,0)
vt=(0,0)    vt=(0,0)

Set it up like this:

Then render it like this:

Do this once per frame:

glBindBuffer(GL_ARRAY_BUFFER, floatBufferOfVerts);
glVertexPointer(2, GL_FLOAT, 0, 0);
glBindBuffer(GL_ARRAY_BUFFER, floatBufferOfUvs);
glTexCoordPointer(2, GL_FLOAT, 0, 0);

for each of your visible textures, do this:

  glBindTexture(GL_TEXTURE_2D, textured)

  for each of the quads of that texture, do this:

    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

That way you end up with a far more optimized render strategy.  You only send down 16 floats per quad, + the glDrawArrays() command.

Furthermore, if your vegetables are all blowing the same way in the wind (the shear matrix is identical), you could get try loading that matrix at the beginning of the frame and then just translating/scaling against it for each quad.

This is all just pseudocode off the top of my head but I think it is a more performant way to render what you are doing.  An important feature of what I wrote is that you have sorted all your renders by texture in advance so you only have as many texture binds as you have textures, no wasted effort there.  Hope that helps.

At the very least try just converting your immediate-mode renders to vertex buffers and see if that helps.


4  Java Game APIs & Engines / JOGL Development / Re: Profiling JOGL apps on: 2009-01-04 01:28:54
Depends on whether or not you want to profile your application logic or the actual rendering itself.

For application logic profiling I've been using the jvisuamvm exe that comes with the JDK.  (1.6.0_07)

It has helped me track down memory leaks as well as cpu load hotspots.

As far as profiling OpenGL goes that is a whole nother story that I will let someone else address.

5  Java Game APIs & Engines / JOGL Development / Re: Flickering FRAPS on: 2009-01-04 01:26:22
What do you mean by "fraps is slow"?  Does it slow down the application itself?  I have had great success with fraps for all other applications, even JOGL apps in the past.  I think there is something peculiar about my system.  I will give it a try on a nearby Windows XP box and see what happens.  I tried using a Frame instead of a JFrame but it made no difference.

6  Java Game APIs & Engines / J2ME / jsr239 via PC emulation (OpenGL ES on J2SE) on: 2009-01-02 18:35:13

I recently experimented with creating OpenGL ES 1.1 midlets using the Wireless Toolkit 2.5.2_01, as well as OpenGL ES 1.1 apps on android.

I am interested in running the same application on the PC using an OpenGL ES emulator.  I have installed the PowerVR SDK OpenGL ES PC Emulator, which is a C++ SDK for running against an emulated PowerVR environment on PC. 

The point is to develop my platform-agnostic OpenGL ES 1.1 java code in such a way that I can not only run it on the limited environments of the WTK and android emulators, but also within the J2SE environment using a native implementation of OpenGL ES.

Does anyone here know of any java native wrappers for bridging jsr239 with the PowerVR OpengGL ES emulator?  Or can you recommend a different way for me to run my jsr239 java code within the J2SE environment?

7  Java Game APIs & Engines / JOGL Development / Flickering FRAPS on: 2008-12-30 06:06:43
For some reason FRAPS FPS counter is flickering when rendered on my JOGL app.  I'm running JOGL in a heavyweight GLCanvas inside a swing JFrame.  Does anyone else see this behavior?


Fraps: 2.9.7 Full
JOGL: jogl-1.1.1-rc8
Video: 8800 GTS 512, Driver 178.24
OS: Vista64 Ultimate

8  Java Game APIs & Engines / JOGL Development / Re: Blending - order does matter ? on: 2008-06-22 04:06:56
Absolutely.  Alpha-translucent polys generally do not write to the z-buffer, meaning that if you render something at a later time in the same screen-space, it will get rendered ON TOP of the alpha-translucent poly.

For any rendering that contains alpha-translucency you are required to perform 2 passes:

1. render all opaque geometry (front-to-back for performance)
2. render all translucent geometry (back-to-front for correctness when translucencies overlap)

So before rendering you basically have to divide all your geometry into 2 buckets (opaque and translucent), and sort the buckets.  The iterate through them in the order mentioned above.

9  Game Development / Performance Tuning / Re: Programming to the cache on: 2008-06-22 03:57:11
I am very interested in this topic as well.  I'm mainly a C++ programmer these days and what you say is very true.  I've never understood how these cache coherency issues translate to Java.    Is there any kind of documentation out there on this?  Would the jvm spec indicate anything in this regard?  Basically the only strategy that I'm sure works is to keep everything as small as possible and as contiguous as possible (e.g. a single FloatBuffer of floats that is used as an n-dimensional array rather than an actual n-dimensional array.
10  Game Development / Game Play & Game Design / Re: Loading a 3D Map on: 2008-06-12 14:31:21
The easiest way is if you store your rotation data as either a Matrix or a Quaternion.  Euler angles are ambiguous because you may be unsure which order to apply the rotations.  Each time you rotation the object, just rotate the Matrix or Quaternion.  Then when you go to render the object you can either use your matrix/quaternion directly in your rendering engine, or you can always extract Euler angles from them and use those if you are more comfortable with that.

Basically the Matrix/Quaternion is just storing the final rotation of the object regardless of all the independent rotations leading up to the final state.
11  Game Development / Game Play & Game Design / Re: Loading a 3D Map on: 2008-06-11 20:18:30
For static geometric objects you never want to duplicate the mesh in memory.  For the spike you just have a single spike mesh loaded in memory once and stored into opengl once (and then removed from your main memory if you can get away with it).  You are definitely taking the right approach.  There has to be a way to get the rotation data out of the map data (I'm not familiar with your map data at all though).

I don't know what your visual goals are, but the number of polys per item that you mention sound really high to me.  a 2k poly coin is pretty excessive Smiley  That's more than enough polys to model a good looking humanoid character, much less a coin.  300 polys is more reasonable but I would expect a 3d disc coin to be in the neighborhood of 50-100 polys depending on how many 'sides' your circles have.  400 polys for a spike sounds excessive.  When you say spike I think of a skinny cone, which could easily be modelled with 6 sides (6 polys!).  If the spike is all bendy or whatnot then of course it requires more.  These are the kinds of numbers I would expect for a realtime action game with lots of these objects all over the place.

With our theoretical 100k poly per frame target, you're looking at rendering about 160 coins and 125 spikes and nothing else. 

Using the instancing approach of duplicated geometry is how professional games get their poly counts up past 100k to the half million range per frame and still use reasonably detailed models.

12  Game Development / Game Play & Game Design / Re: Loading a 3D Map on: 2008-06-11 05:36:39
On a next-gen console or equivalent PC you're looking at rendering 100-500k textured polys per frame.  But that's only what's being rendered so you might assume your entire scene is substantially larger than that.  Each point holds position, normal, UVs, and maybe some other data like collision info (3+3+2+(say 3)=11 floats). At the low end 100k totally independent triangles will be 300k points or 3.3M floats, which is 13.2Mbytes of data.  Assuming you can index your triangles say you can cut the number of independent triangles in half.  So you're looking at 6.6Mbytes of data per view.  With a 60 degree horizontal FOV rotating the camera in place will net you about 6.6Mbyte*6=~40Mbyte worth of triangle data just in line of sight of your camera.  We haven't even counted up the texture memory.  There's a reason modern games typically run with multi-hundred megabyte heap sizes Smiley

(and stream in only what they need on the fly)

Just how much heap do you have allocated to your VM when you are getting the out of memory error?  Are you actually bumping up against your system memory limits or just the JVM heap limit?

13  Java Game APIs & Engines / JInput / Mouse Grabbing on: 2008-06-11 05:04:48
How do I grab the mouse with jinput (and/or AWT or jogl)

Specifically, I need to be able to lock the mouse position on the canvas to prevent it from moving outside the canvas.  This is to implement something like a drag-to-rotate camera.  Typically when you do this in C++ you lock it to the center of the canvas until it is released, then move it back to the click point when you are done.  You also typically hide the mouse cursor while it is grabbed.  (I know how to do this)

LWJGL has a mechanism to do this, via its Mouse.setGrabbed() and Mouse.setCursorPosition() methods.  These are implemented natively for LWJGL, ultimately calling Windows ClipCursor() and SetCursorPos() functions.  This is really a big deal for games so I hope that I don't have to duplicate what LWJGL did myself :/

14  Java Game APIs & Engines / OpenGL Development / Re: devil help needed on: 2005-12-10 23:50:42
You just have to know what kind of data is incoming.  In my experience, artists & their tools like to think of the texture UVS at the bottom left & top right as 0,0 & 1,1, respectively.  OpenGL image space is flipped from this (0,1 & 1,0)... I flip all my incoming textures as a matter of course.  I also flip my modelview matrix into a left-handed coordinate system to be consistent with what most artists are used to.
15  Java Game APIs & Engines / OpenGL Development / Re: devil help needed on: 2005-12-10 16:49:27
To flip the image, use ILU.iluFlipImage() after your IL.ilBindImage() call.

To get alpha, just make sure you have the right format in IL.ilCopyPixels, e.g.:

ByteBuffer data = BufferUtils.createByteBuffer(numPixels * 4);
IL.ilCopyPixels(0, 0, 0, width, height, 1, IL.IL_RGBA, IL.IL_BYTE, data);

16  Games Center / 4K Game Competition - 2006 / Re: AirPong4k on: 2005-12-09 15:25:58
Hahaha I love the music at the end!  It almost jolted me out of my chair.
17  Java Game APIs & Engines / OpenGL Development / Re: Display.update() raising GL error: Invalid value on: 2005-12-08 00:38:56
Ok, if I can narrow it down I will certainly post it.  I was hoping maybe someone had seen the behavior before Smiley
18  Java Game APIs & Engines / OpenGL Development / Re: Display.update() raising GL error: Invalid value on: 2005-12-07 04:53:10
No, thats not the case.

Util.checkGLError(); checks the drivers for any error that might have croped up anywhere in the last frame, Util.checkGLError(); releases those errors to be printed or whatever. You could be doing GL11.glLightf(GL11.glTrue); which is an invalid enum for that method call. Check the rest of your program carefully with a very fine toothcomb, if in doubt, put other Util.checkGLError(); calls in your code to see if the error has cropped up anywhere else...


Util.checkGLError() checks the gl error state and finds it clean (otherwise it would throw an exception), after Display.update() completes, I check the gl error state and it is not clean (Invalid Value), so something that occured as a result of Context.swapBuffers() set the gl error state.  My code is full of gl error checking already.  The gl error state is clean when I call Display.update() and dirty when it completes.

19  Java Game APIs & Engines / OpenGL Development / Display.update() raising GL error: Invalid value on: 2005-12-06 15:23:49
Can someone enlighten me as to what sort of conditions would cause Display.update()'s call to Context.swapBuffers() to raise a GL error: Invalid Value?  I see that Display.update() does this:

   // We paint only when the window is visible or dirty
      if (isVisible() || isDirty()) {
         try {
         } catch (LWJGLException e) {
            throw new RuntimeException(e);

So the error _must_ be arising from the Context.swapBuffers() call.  (I check glError() after Display.update() completes)

The error only occurs the _first_ time I Display.update(), afterwards no error occurs.

Any ideas?


20  Java Game APIs & Engines / OpenGL Development / Re: Starting with LWJGL on: 2005-12-06 04:50:16
Here's one location of a zipfile of the lessons:

The LWJGL Wiki appears to be empty at this moment, looks like a fresh, virgin wiki.
21  Games Center / 4K Game Competition - 2006 / Re: Let's do this. on: 2005-12-01 17:10:10
I know this is a n00bish question and there is probably somewhere that I could RTFM, so I humbly and shamefully apologize in advance for asking this question, but.

What external libs, if any are allowed to be used?  Is the 4k game required to only use what comes with the JRE SE?

22  Java Game APIs & Engines / OpenGL Development / Re: Why hasn't shear been implemented into the matrix classes? on: 2005-12-01 06:05:11
You can get a shear effect by using non-orthogonal basis vectors for the matrix, as long as you don't get too carried away.
23  Java Game APIs & Engines / JOGL Development / Re: JOGL texture issues on: 2005-11-25 20:24:08
The check you want is not whether or not the buffer is rewound, but rather if the buffer has the expected amount of data remining in it, from the position().  E.g. limit() - position(), otherwise known as remaining().
24  Games Center / Archived Projects / Re: BallBreaker Game online and ready for play on: 2005-11-20 05:49:39

for now
25  Java Game APIs & Engines / OpenGL Development / Re: Trouble with gluUnproject on: 2005-11-15 04:00:49
How is your projection matrix setup?  Is your nearplane or farplane zero?   Can you paste the code where you setup your projection matrix?
26  Games Center / Archived Projects / Re: CroAsteroids on on: 2005-11-14 16:36:05
Well I used photoshop to re-save one of the 400k+ ones (the first one you see) at 75% or so quality and the file was about 1/4 the original size and had no differences that I could discenern with my eye looking at it full size.  Also, the backgrounds are 1024x768, yet I don't see any way to run the game at anything other than 800x600.  So there's no point in having the backgrounds larger than your max game res either.
27  Games Center / Archived Projects / Re: CroAsteroids on on: 2005-11-13 20:35:40
Pretty cool gameplay, and gorgeous looking too.  Your background images are pretty large though, might want to save them out in a smaller format or smaller size.
28  Game Development / Shared Code / General purpose OBJ loader on: 2005-11-04 23:20:29
Does anyone know of a good general purpose OBJ loader suitable for use with any GL API?

Basically I just need a loader that returns to me a list of OBJ groups, each with a pointer to or name of the material, list of unique verts/normals/tcs, and an index array.  I need to be able to take that data and massage it into my own VBO and index buffer formats.  I've written my own and it has done the trick for some time, but when I started re-writing it to be more general (and cleaner) I decided I'd rather just use one off the shelf Smiley

29  Game Development / Networking & Multiplayer / Re: 3DzzD API on: 2005-11-03 16:05:50
That's really impressive.   Looks neat too.... although the mouse controls are impossibly difficult to use.
30  Java Game APIs & Engines / JOGL Development / Re: [HELP] Converting Grayscale (InfraRed) to Color with JOGL [HELP] on: 2005-11-01 15:15:58
That sounds awesome.  I'd like to see some screenshots of that algorithm in action!
Pages: [1] 2 3 ... 7
EgonOlsen (76 views)
2018-06-10 19:43:48

EgonOlsen (56 views)
2018-06-10 19:43:44

EgonOlsen (76 views)
2018-06-10 19:43:20

DesertCoockie (256 views)
2018-05-13 18:23:11

nelsongames (156 views)
2018-04-24 18:15:36

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

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

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

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

Solater (173 views)
2018-03-17 05:04:08
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!