Show Posts
|
|
Pages: [1] 2 3 ... 5
|
|
1
|
Java Game APIs & Engines / JOGL Development / Re: x-Coordinates go in negative direction!?! Everything is "mirrored"!
|
on: 2006-02-06 10:03:35
|
You're right, OpenGL DOES use a right-handed coordinate system. But in this case, positive x goes to the right, positive y up and positive z out of the screen towards the user.
However, in my case pos. x goes left, pos. y up and pos. z into the screen. This is weird, I'm really confused now.
The answer lies here: glu.gluLookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, 0, 1, 0); As eyeZ is assigned a negative value of -10, your "camera" resides behind the X/Y-plane at Z=0 and thus everything seems mirrored. Moving the eyeZ to value of 10 should make the world seem normal again.
|
|
|
|
|
2
|
Java Game APIs & Engines / JOGL Development / Re: smooth shading problems
|
on: 2006-02-03 16:15:17
|
should I use vertex normals instead of surface normals?
Yes, you should. Using a surface normal effectively means that all the vertices drawn for the surface will have the same normal - thus making the surface seem flat. You can generate vertex normal simply by averaging your current surface normals for each vertex if they are not provided to you by a modeling package. So, basically a vertex normal VN for vertex V shared by surfaces A, B and C with normals AN, BN, CN (unit vectors) = VN = normalize(AN + BN + CN)
|
|
|
|
|
4
|
Java Game APIs & Engines / JOGL Development / Re: Basic Textures In JOGl
|
on: 2005-10-01 12:12:30
|
¿What may the problem be? ¿Why shouldn't it render correctly the ship image?
I think that the call gl.glColor3f(0f,0f,0f) causes them to appear black - this happens because of the texture-color modulation. Simplest solution is to set the color to white (1, 1, 1). You may also disable the texture modulation with the following code: 1
| gl.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE); |
|
|
|
|
|
6
|
Java Game APIs & Engines / JOGL Development / Re: JOGL + SWT
|
on: 2005-09-10 21:35:13
|
technically - thats bridged SWT and not pure SWT.
That's true. The example embeds the JOGL GLCanvas to a SWT composite by using the bridging SWT_AWT.new_Frame(composite) call. I've found this approach satisfactory in most cases. However, the bridging may cause some side effects regarding the event loops and threading models in the SWT and AWT libraries.
|
|
|
|
|
7
|
Java Game APIs & Engines / JOGL Development / Re: JOGL + SWT
|
on: 2005-09-10 10:58:20
|
I have done that in the past. I uploaded an example with source code at: http://www.g0dmode.com/javastuff/jogl-swt-example.zipThe example can be run in Windows via swt-example.cmd or swt-example.exe (Java Windows launcher). The program should produce a simple native window with a tree control at the left hand side and a panel rendering a blinking rectangle at right. I've successfully tested the example with ATI X800 Pro card - please report if you find any bugs or unstability in the program. Have fun! 
|
|
|
|
|
9
|
Java Game APIs & Engines / JOGL Development / Re: Really stuck on sphere mapping.
|
on: 2005-04-26 15:15:04
|
|
Hi, I have been successful with the following piece of code:
[CODE] gl.glEnable(GL.GL_DEPTH_TEST); gl.glDepthFunc(GL.GL_LEQUAL); gl.glEnable(GL.GL_TEXTURE_2D);
// Sphere reflection mapping gl.glEnable(GL.GL_TEXTURE_GEN_S); gl.glEnable(GL.GL_TEXTURE_GEN_T); gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_SPHERE_MAP); gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_SPHERE_MAP); [/CODE]
Edit: I would try to remove those texture matrix mode tricks first...
Cheers
|
|
|
|
|
11
|
Java Game APIs & Engines / JOGL Development / Re: OpenGL question: material and scaleing
|
on: 2005-03-17 07:46:16
|
|
I think that this has something to do with the fact that scaling the triangle actually affects its vertices world coordinates and thus the specular highlight computation (since the specular computation is affected by the current viewpoint, vertex position and light position).
Hope this makes some sense.
Edit: You could try to place the light at some distance from the triangle to the direction of the triangle normal. That way, the specular highlights should be equally strong with all scales of the triangle.
|
|
|
|
|
14
|
Java Game APIs & Engines / JOGL Development / Re: Loading model from .obj file problem
|
on: 2005-02-27 14:48:42
|
Though really, this sort of thing is a complete PITA to deal with. The current importer I'm using for my models, both animated and static, doesn't have ANY of these checks, because I assume the model exported from my modeller is going to be of the correct format.
Agree 100%. It's not worth it really. My model importers assumes certain formats, which is OK because the modelling tools (MAX, etc.) have their own standards anyway.
|
|
|
|
|
15
|
Java Game APIs & Engines / JOGL Development / Re: JOGL Cross platform question
|
on: 2005-02-26 11:37:20
|
I think that the easiest (and only) way of getting JOGL work on the platform your friend is using, is to compile JOGL on that platform. Basically, it should not be that difficult - download the source code from (latest, JOGL b09 source release): https://jogl.dev.java.net/files/documents/27/11497/jogl-src.zipThe source code package comes with the necessary build scripts for the X11 windowing system and thus it should be possible to build it with virtually any standard UNIX system. The package also comes with a file called HowToBuild.html (in the doc directory), which describes the building process in more detail.
|
|
|
|
|
17
|
Java Game APIs & Engines / JOGL Development / Re: Time based animitaion
|
on: 2005-02-14 17:30:00
|
I have a sprite that the user controlls and he moves using time based movement. My question is how can i make the actual animation frames time based.
To "bind" your animation to the real world time, you should first ask yourself, what is the desired duration of each frame in the animation. Let's say we want an animation where the frame is changed every 100ms (1/10 of a second), and there are 20 frames altogether: [CODE] // The current real world time, in milliseconds long time = System.currentTimeMillis(); // The current animation frame ((time / duration) mod totalnumberofframes) int animationFrame = (int) ((time / 100) % 20); [/CODE] Hope this helps a bit
|
|
|
|
|
18
|
Java Game APIs & Engines / JOGL Development / Re: ATI and lightweight acceleration?
|
on: 2005-02-14 17:09:18
|
Does anyone, with any ATI configuration managed to see improved lightweight performance? Does anyone know if this is a general driver problem for ATI cards?
I can confirm the same results with an ATI system. I have tried the demo with NVidia setup too, it seems to work great. My ATI system specs: - Latest Sun JRE 5.0 - ATI Radeon X800 Pro, with latest (5.2) Catalyst drivers - WinXP, SP2 - AMD XP 3000+ The demo seems to update the OpenGL panel 1 or 2 times per second, so it clearly suffers of some problems. Notice that I'm using the default OpenGL driver settings.
|
|
|
|
|
19
|
Java Game APIs & Engines / JOGL Development / Re: So you like Textures eh? Texturing Demo in JOG
|
on: 2005-01-18 11:39:15
|
hi there, saw the "get2Fold" method in the TextureLoader. I am using the following elegant code snippet for this job 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| public static final int nextPowerOf2(int in) { in -= 1;
in |= in >> 16; in |= in >> 8; in |= in >> 4; in |= in >> 2; in |= in >> 1;
return in + 1; } |
got this from a c library, actually, i currently don't know, which one it was. if you guys want to know, i can search for it. That's quite nice. I deduced a version of my own some time ago (next power of two, downwards): [CODE] private static int getPowerOfTwo(int a) { return (int) Math.pow(2, (int) (Math.log(a) / Math.log(2))); } [/CODE]
|
|
|
|
|
21
|
Java Game APIs & Engines / JOGL Development / Re: Sphere mapping pain.
|
on: 2005-01-14 03:36:46
|
ahh... this allows you to rotate the texture coords.
Quite true, but you don't need that for sphere mapping. Here's an example: [CODE] if (sphereMap) { gl.glEnable(GL.GL_TEXTURE_GEN_S); gl.glEnable(GL.GL_TEXTURE_GEN_T); gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_SPHERE_MAP); gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_SPHERE_MAP); } else { gl.glDisable(GL.GL_TEXTURE_GEN_S); gl.glDisable(GL.GL_TEXTURE_GEN_T); } [/CODE]
|
|
|
|
|
22
|
Java Game APIs & Engines / JOGL Development / Re: "On-demand" mode modification to tut
|
on: 2005-01-12 07:05:49
|
But how do I make it show anything before the first mouse or key event? What keeps you from calling glCanvas.repaint() right after you've created it?  Remember, that repaint method does not cause an immediate refresh of the component but an event that requests the refresh in the AWT thread.
|
|
|
|
|
25
|
Java Game APIs & Engines / JOGL Development / Re: Webstart grief
|
on: 2004-12-21 11:46:47
|
|
The one not working has wrong content-type, "text/plain". It should be:
application/x-java-jnlp-file
This can be fixed by altering the server configuration or the script providing the file (php, asp, etc.). The following is an example for Apache configuration:
AddType application/x-java-jnlp-file .jnlp AddType application/x-java-archive-diff .jardiff
With PHP you can do the following to change the content type:
header('Content-type: application/x-java-jnlp-file');
...and then output the JNLP contents.
|
|
|
|
|
26
|
Java Game APIs & Engines / JOGL Development / Re: Causing the stuff to refresh
|
on: 2004-12-20 16:28:14
|
I'm operating in the "on-demand" mode. But I have a problem kicking things off. When the JFrame containing my GLCanvas comes up, the init() or display() are _not_ called. In order to trigger them, I have to manually resize the window and then everything gets going.
Thank you for your kind words. Can you post your initialization code here (Frame/GLCanvas creation, etc.), so we can take a look at it?
|
|
|
|
|
27
|
Java Game APIs & Engines / JOGL Development / Re: Causing the stuff to refresh
|
on: 2004-12-20 08:08:06
|
Ok, I'll try to explain JOGL and threads in a clear way. Generally, there are two ways in which you can use JOGL to render graphics: - On-demand -> the GLDrawable (GLCanvas, etc.) is only refreshed when the repaint/display is called by AWT (component resized, etc.) or by the user. - Continuous -> the GLDrawable is continuously refreshed by another thread (Animator class, etc.). The possible problems with threads arise when two different threads try to operate on the same OpenGL context. In JOGL terms, this basically means that if you're rendering the GLDrawable with an Animator (or some other implementation involving multithreading) AND try to invoke OpenGL operations on the same GLDrawable from another thread, problems will occur. However, if you're only refreshing the GLDrawable manually (no threading involved), it's OK to make OpenGL calls from the GUI thread, since no other thread is using the GLDrawable and its OpenGL context anyway. So pahidla, you're doing nothing wrong. 
|
|
|
|
|
29
|
Java Game APIs & Engines / JOGL Development / Re: Determine the color of pixel
|
on: 2004-12-18 08:39:08
|
...and
does the callback of a button count as another thread?
Yes, in the AWT/Swing world, the button event is executed in the GUI thread, which probably is not the same thread you're using JOGL from right now. To go around this, it is easiest to "delay" and delegate the button event to the rendering thread, using a queue of events, for example. So, in general: 1. Event occurs (button was pressed, mouse was moved, etc.) 2. Delegate the event to the queue (you can simply put the event object to the queue) 3. Rendering thread sees that the queue is non-empty and processes the events in the queue (responds to the pressed button, etc.) I hope this helps
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|