Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (115)
games submitted by our members
Games in WIP (563)
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  Java Game APIs & Engines / JOGL Development / Weird performance behaviour with "My screen recorder Pro 2.6" on: 2007-11-10 21:25:44
Hello,
As the subject of this topic states, I am experiencing a very very weird behavior with my Jogl project and the program "My screen recorder Pro". What happens is this:

I start my application, turn off v sync and get a constant frame rate of about 25 fps. Then I open the other program (I wanted to record a video for a test case, so I tried that one). Finally, I ask the program to record from my window. As soon as recording begins, or at most 5 seconds later, the frame rate of my application jumps up to over 100. If I stop recording, the frame rate goes up a bit more, as the cpu is now free of encoding duties. The framerate will steadily be at over 100 fps until I restart the app, at that time, it will drop again to about 20~25, until I try to capture again from that window. Now, I have no clue at all why this could happen, haven't yet checked on other jogl / opengl applications to see if only my app benefits from this, or what. If anyone can point me towards another jogl app with a frame counter, I'll gladly try it.

Totally puzzled by this thing, I wonder if anyone has any ideas about why it could possibly happen (this is a very consistent behavior, it happens EVERY single time I try it).

Regards.
2  Java Game APIs & Engines / JOGL Development / Re: Tangent space and parallactic shader.. on: 2007-03-26 00:58:04
I still have a problem somewhere, but the whole thing got much better. I should be able to tackle it with some more effort~
Thanks for your help.

Here's how it looks now, can still see triangles a bit, but altogether it's almost acceptable.
http://www.ramiriccardo.com/nlcachef/sshots/parallax-seams2.jpg
3  Java Game APIs & Engines / JOGL Development / Re: Tangent space and parallactic shader.. on: 2007-03-25 09:45:55
Thank you very much, I'll try that as soon as I can, will let you know if I manage to fix my problem.
4  Java Game APIs & Engines / JOGL Development / Tangent space and parallactic shader.. on: 2007-03-24 21:30:48
Hello all, I am trying to implement a parallactic GLSL shader, but I got stuck on handedness of my generated tangent space. I can't for the life of me find a way to make this thing work properly. Here's a screenshot of what I m getting



The problem is with those visible triangles on the wing. It should be smooth, but it is not.

Here is my code to generate the tangent space...

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  
    private void createTangentSpace(){
        //Creates a tangent space to be used with
       //per-pixel lighting
       meshes.reset();
        Mesh currentMesh=null;
        while((currentMesh=(Mesh)meshes.getNext())!=null){
            for(int i=0;i<currentMesh.numFaces;i++){
                //Find the tangent basis
               Vector3f p1=new Vector3f(currentMesh.vertices[currentMesh.faces[i].vertices[0]].m_location);
                Vector3f p2=new Vector3f(currentMesh.vertices[currentMesh.faces[i].vertices[1]].m_location);
                Vector3f p3=new Vector3f(currentMesh.vertices[currentMesh.faces[i].vertices[2]].m_location);
               
                Vector2f uv1=new Vector2f(currentMesh.vertices[currentMesh.faces[i].vertices[0]].m_texCoords);
                Vector2f uv2=new Vector2f(currentMesh.vertices[currentMesh.faces[i].vertices[1]].m_texCoords);
                Vector2f uv3=new Vector2f(currentMesh.vertices[currentMesh.faces[i].vertices[2]].m_texCoords);
               
                Vector3f Edge1 = p2.subtract(p1);
                Vector3f Edge2 = p3.subtract(p1);
                Vector2f Edge1uv = uv2.subtract(uv1);
                Vector2f Edge2uv = uv3.subtract(uv1);
               
                float cp = Edge1uv.y * Edge2uv.x - Edge1uv.x * Edge2uv.y;
               
                if ( cp != 0.0f ) {
                    float mul = 1.0f / cp;
                    currentMesh.faces[i].tangent   = Edge1.mulByf(-Edge2uv.y).sum(Edge2.mulByf(Edge1uv.y)).mulByf(mul);
                    currentMesh.faces[i].biTangent = Edge1.mulByf(-Edge2uv.x).sum(Edge2.mulByf(Edge1uv.x)).mulByf(mul);
                   
                    currentMesh.faces[i].tangent.normalize();
                    currentMesh.faces[i].biTangent.normalize();
                }
            }
           
            //Now smoothen the vectors accross the vertices.
           for(int i=0;i<currentMesh.vertices.length;i++){
                int[] neighbors = currentMesh.findVertexOwnerFaces(i);
                Vector3f vecTangent=new Vector3f();
                Vector3f vecBiTangent=new Vector3f();
               
                Vector3f vecNormal=new Vector3f(currentMesh.vertices[i].m_normal[0],
                                                currentMesh.vertices[i].m_normal[1],
                                                currentMesh.vertices[i].m_normal[2]);
               
                for(int n=0;n<neighbors.length;n++){
                    vecTangent.sumOW(currentMesh.faces[neighbors[n]].tangent);
                    vecBiTangent.sumOW(currentMesh.faces[neighbors[n]].biTangent);
                }
                vecTangent.normalizeOW();
                vecBiTangent.normalizeOW();
               
                //Gram-Schmidt orthogonalization
               vecTangent.subtractOW(vecNormal.mulByf(vecTangent.dotProduct(vecNormal)));
                vecTangent.normalize();
               
                vecBiTangent.subtractOW(vecNormal.mulByf(vecBiTangent.dotProduct(vecNormal)));
                vecBiTangent.normalize();                
               
                currentMesh.vertices[i].m_tangent[0]=vecBiTangent.x;
                currentMesh.vertices[i].m_tangent[1]=vecBiTangent.y;
                currentMesh.vertices[i].m_tangent[2]=vecBiTangent.z;

                currentMesh.vertices[i].m_bitangent[0]=vecTangent.x;
                currentMesh.vertices[i].m_bitangent[1]=vecTangent.y;
                currentMesh.vertices[i].m_bitangent[2]=vecTangent.z;                
            }
        }
    }



The Vertex shader:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
attribute vec3 rm_Tangent;
attribute vec3 rm_Binormal;
varying   vec3 g_lightVec;
varying   vec3 g_viewVec;

void main()
{
float u_invRad =1.0/50.0;
   gl_Position = ftransform();
   gl_TexCoord[0] = gl_MultiTexCoord0;
   
   vec3 binormal=cross(rm_Tangent.xyz, gl_Normal);

   mat3 TBN_Matrix = gl_NormalMatrix * mat3(rm_Tangent, rm_Binormal, gl_Normal);
   vec4 mv_Vertex = gl_ModelViewMatrix * gl_Vertex;
   g_viewVec = vec3(-mv_Vertex) * TBN_Matrix;
   vec4 light = gl_ModelViewMatrix * gl_LightSource[1].position;
   vec3 lightVec = u_invRad * (light.xyz - mv_Vertex.xyz);
   g_lightVec = lightVec * TBN_Matrix;
}


And finally the Fragment shader:
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  
uniform sampler2D bump_map;
uniform sampler2D rgb_map;

varying   vec3 g_lightVec;
varying   vec3 g_viewVec;

void main()
{  
        vec2 cBumpSize=0.01 * vec2 (2.0, -1.0);
   float LightAttenuation = clamp(1.0 - dot(g_lightVec, g_lightVec), 0.0, 1.0);
   vec3 lightVec = normalize(g_lightVec);
   vec3 viewVec = normalize(g_viewVec);
   
   float height = texture2D(bump_map, gl_TexCoord[0].xy).r;
   height = height * cBumpSize.x + cBumpSize.y;

   vec2 newUV = gl_TexCoord[0].xy + viewVec.xy * height;
   vec4 color_base = texture2D(rgb_map,newUV);
   vec3 bump = texture2D(bump_map, newUV.xy).rgb * 2.0 - 1.0;
   bump = normalize(bump);
   
   float diffuse = clamp(dot(lightVec, bump), 0.0, 1.0);
   float specular = pow(clamp(dot(reflect(-viewVec, bump), lightVec), 0.0, 1.0), 16.0);
   gl_FragColor =  3.0*color_base * gl_LightSource[1].diffuse
               * (diffuse * base + 3.0*specular);
        gl_FragColor = 0.2*color_base+(0.2* gl_FragColor)+gl_FragColor;
    gl_FragColor.a = 1.0;  
}


I m losing it trying to figure out what I m doing wrong.. I'd be very grateful if anyone could help me out.
Thanks.
5  Java Game APIs & Engines / JOGL Development / Re: Rotation matrix -> quaternion -> matrix problem.. on: 2006-08-31 12:26:01
Guess I'll have to convert all the rotation generation code to store them as quaternions, that was on the to-do list anyways..
Thanks for all the help.
6  Java Game APIs & Engines / JOGL Development / Re: Rotation matrix -> quaternion -> matrix problem.. on: 2006-08-30 23:50:04
It's the first thought I had too, and I noticed there are indeed some matrices generated by the code which work properly, some others dont.  That matrix comes off the code I use to rotate the world as camera moves, and it seems to be perfectly fine, I ve been using it for a few months now and at least there is no VISIBLE shearing or anything else. Is it wrong of me to think an orthonormalized matrix is always a representation of a rotation? Thanks for replying~
7  Java Game APIs & Engines / JOGL Development / Rotation matrix -> quaternion -> matrix problem.. on: 2006-08-30 19:03:49
Hello~
I ve been stuck for a while on this problem, which is probably trivial to most of you, and I can't quite understand if I am doing something wrong or not. As the topic says, I need to make a routine to convert a rotation matrix into a quaternion and back. I understood this operation is totally reversible and it is possible to recreate the original matrix from the quaternion, provided it was an orthonormal matrix, besides some approximation error. Now.. this is the output I get if I try to run some conversions:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
Matr1: 
-0.947701, 0.11744351, 0.29676592
-0.07347012, 0.8245853, -0.56094676
0.31058836, 0.5534132, 0.7728316

q:
0.82485795, -0.55718, 0.006911218, 0.09545682

Matr2:
0.98168045, -0.16517824, -0.094971724
0.14977506, 0.36087695, 0.9205082
-0.11777481, -0.91786927, 0.37900543

q2:
0.824858, -0.55718, 0.006911215, 0.09545682

matr3:
0.98168045, -0.16517824, -0.09497173
0.14977507, 0.36087692, 0.9205082
-0.11777481, -0.9178693, 0.37900537


That output was generated running this code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
Matrix3f matr1=new Matrix3f(-0.947701f, -0.07347012f, 0.31058836f,
                                   0.11744351f, 0.8245853f, 0.5534132f,
                                   0.29676595f, -0.56094676f, 0.7728316f      );

        matr1.orthonormalize();
        matr1.traceMe("Matr1");
        Quaternion q=matr1.getRotationMatrix4f().toQuaternion();
        q.traceMe("q");
        Matrix3f matr2=q.toMatrix3f();        
        matr2.traceMe("Matr2");
        Quaternion q2=matr2.toQuaternion();q2.traceMe("q2");
        Matrix3f matr3=q2.toMatrix3f(); matr3.traceMe("matr3");


And the function I used are the following:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
public Matrix3f orthonormalize(){
        Vector3f u1=new Vector3f(m[0], m[1], m[2]);
        Vector3f u2=new Vector3f(m[3], m[4], m[5]);
        Vector3f u3=new Vector3f(m[6], m[7], m[8]);
       
        Vector3f w1 = u1.normalize();
        Vector3f w2 = (u2.subtract(w1.proj(u2))).normalize();
        Vector3f w3 = (u3.subtract(w1.proj(u3)).subtract(w2.proj(u3))).normalize();            
       
        m[0]=w1.x;
        m[1]=w1.y;
        m[2]=w1.z;

        m[3]=w2.x;
        m[4]=w2.y;
        m[5]=w2.z;
       
        m[6]=w3.x;
        m[7]=w3.y;
        m[8]=w3.z;
       
        return this;
    }


and...

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  
public Quaternion toQuaternion(){
        normalize();
       
        double tr, s;
        float[][] mat=new float[3][3];
        float[] q=new float[4];
       
        int i=0;
        for(int x=0; x<3; x++){  
            for(int y=0; y<3; y++){
                mat[x][y]=m[i++];
            }
        }
       
        tr= 0.25*(1.0+mat[0][0]+mat[1][1]+mat[2][2]);
       
        if(tr>0) {
            s= Math.sqrt( tr);
            q[0]= (float)s;
            s*= 4.0;
            q[1]= (float)((mat[1][2]-mat[2][1])/s);
            q[2]= (float)((mat[2][0]-mat[0][2])/s);
            q[3]= (float)((mat[0][1]-mat[1][0])/s);
        } else {
            q[0]= 0.0f;
            s= -0.5*(mat[1][1]+mat[2][2]);
           
            if(s>0) {
                s= Math.sqrt(s);
                q[1]= (float)s;
                q[2]= (float)(mat[0][1]/(2*s));
                q[3]= (float)(mat[0][2]/(2*s));
            } else {
                q[1]= 0.0f;
                s= 0.5*(1.0-mat[2][2]);
               
                if(s>FLT_EPSILON) {
                    s= Math.sqrt(s);
                    q[2]= (float)s;
                    q[3]= (float)(mat[1][2]/(2*s));
                } else {
                    q[2]= 0.0f;
                    q[3]= 1.0f;
                }
            }
        }
        return new Quaternion(q[1], q[2], q[3], q[0]).normalize();
    }


and finally..

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  
public Matrix3f toMatrix3f(){  
/* float x2 = x * x;
        float y2 = y * y;
        float z2 = z * z;
        float xy = x * y;
        float xz = x * z;
        float yz = y * z;
        float wx = w * x;
        float wy = w * y;
        float wz = w * z;
 
        float[] values=new float[9];
 
        values[0]=1.0f - 2.0f * (y2 + z2);
        values[1]=2.0f * (xy + wz);
        values[2]=2.0f * (xz - wy);
 
        values[3]=2.0f * (xy - wz);
        values[4]=1.0f - 2.0f * (x2 + z2);
        values[5]=2.0f * (yz + wx);
 
        values[6]=2.0f * (xz + wy);
        values[7]=2.0f * (yz - wx);
        values[8]=1.0f - 2.0f * (x2 + y2);   */

           
            double q0, q1, q2, q3, qda,qdb,qdc,qaa,qab,qac,qbb,qbc,qcc;
           
            float[] values=new float[9];
           
            q0= M_SQRT2 * w;
            q1= M_SQRT2 * x;
            q2= M_SQRT2 * y;
            q3= M_SQRT2 * z;
           
            qda= q0*q1;
            qdb= q0*q2;
            qdc= q0*q3;
            qaa= q1*q1;
            qab= q1*q2;
            qac= q1*q3;
            qbb= q2*q2;
            qbc= q2*q3;
            qcc= q3*q3;
            Matrix3f tmp= new Matrix3f(
                    (float)(1.0-qbb-qcc),
                    (float)(qdc+qab),
                    (float)(-qdb+qac),
                   
                    (float)(-qdc+qab),
                    (float)(1.0-qaa-qcc),
                    (float)(qda+qbc),
                   
                    (float)(qdb+qac),
                    (float)(-qda+qbc),
                    (float)(1.0-qaa-qbb));
            return tmp.orthonormalize();
        }


The test case output shows the first quaternion derived matrix is different from the original one, but it yeilds the same quaternion, and the system is stable for further loops. So I ve been wondering if these 2 matrices would by chance give the same rotation, and I ve tested this in my graphics engine, but of course, they do not. I don't see what I did wrong, after having tried to implement and re-implement this a couple times, using different sources, books, tutorials, websites etc, the one I posted is a translation of blender3d's conversion functions.

Thanks to whoever reads this ~
8  Game Development / Newbie & Debugging Questions / Re: Thread safety & synchronized on: 2006-07-16 06:58:39
Yes, I do that very often.. for some reason I spend hours on idiotic bugs, then I post a question and find the answer by myself....
To Kova: I already have my object I wanna lock on, the only problem was I thought there always was only a single instance of it, but there could be 2, which made 2 locks available, while I needed it to be singleton~ So the problem was not in the lock itself, but in the singleton pattern implementation, resulting flawed in this case because two different thread were concurrently calling the "side constructor" at the same time, thus creating two instances, one of which got lost after a few, losing important data which should have belonged to the one and only instance..
9  Game Development / Newbie & Debugging Questions / Re: Thread safety & synchronized on: 2006-07-15 18:47:10
Fine fine... so after all it doesn't make any difference to use the first or the second code... The problem instead lies in the fact the getInstance method needs to be synchronized, what was happening was two different threads were calling it at the same time, and they actually instanced two different instances of this singleton class. By maintaining their own references to the returned instance, they would use two different instances, thus acquiring two different locks, and making a big mess later, when a new call to the getInstance method would cause the loss of this unwanted second instance.

Finally the fixed code..
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public class MyClass{
  //Singleton instance pointer
   private static MyClass singletonInstance=null;
   
    protected MyClass() {
    }
   
    public synchronized static MyClass getInstance(){
        if(singletonInstance==null){
            singletonInstance=new MyClass();
        }      
        return singletonInstance;      
    }


Thanks to javaWorld on the flawed tutorial about singleton~
Thanks..
10  Game Development / Newbie & Debugging Questions / Re: Thread safety & synchronized on: 2006-07-15 18:39:25
Ok.. since it didn't make any sense to have a threading problem there.. I went to find out if the lock I was acquiring was really the same.. and found this idiotic mistake..
The code was in a singleton class, and I made my mistake on the getInstance() method, where I forgot to specify the MyClass identifier while using the singletonInstance reference. This didn't fail to compile (as singletonInstance IS a member of the class, even if static) but didnt actually work as a static variable should. I don't really understand where the variable goes, if it's not in the "this" reference, it's not in the method stack and it's not a real static variable, then what is it? But ok, adding that fixed it.

Wrong code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
  
public class MyClass{
  //Singleton instance pointer
   private static MyClass singletonInstance=null;
   
    protected MyClass() {
    }
   
    public static MyClass getInstance(){
        if(singletonInstance==null){
            singletonInstance=new MyClass();
        }        
        return singletonInstance;        
    }


Correct code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
  

public class MyClass{
  //Singleton instance pointer
   private static MyClass singletonInstance=null;
   
    protected MyClass() {
    }
   
    public static MyClass getInstance(){
        if(MyClass.singletonInstance==null){
            MyClass.singletonInstance=new MyClass();
        }        
        return MyClass.singletonInstance;        
    }


Please let me know if what I typed here has some minor/major imprecisions.. or if anyone know why the first case still compiles.
Thanks.
11  Game Development / Newbie & Debugging Questions / Thread safety & synchronized on: 2006-07-15 16:30:00
Hello, I have a problem with thread safety on this block of code. Synchronized just seems to be ignored.. I am using a static variable to count the calls to it, and it's reaching 2 most of the times, while it should never go over 1. Am I doing something incredibly and terribly wrong or is this a bug? I also tried making the whole method synchronized, and it won't change anything.

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  
    //This method looks for an available model id. If none is found, it tries to discard an expendable model to make room.
   //If no expendable model, it returns -1 as an error code, and the model won't be loaded.
   public int createInFirstAvailableID(String fileName){
        int i=0;
      synchronized (this){
           
        ModelsManager.count++;
        System.out.println("Istances: "+ModelsManager.count);
        while(i<Configuration.getMaxModelCount() && models[i++]!=null);
       
        if(i<Configuration.getMaxModelCount()){ //I found an usable id
           System.out.println("Id found: "+ (i-1)+" for "+fileName);
            models[--i]=new Model3D(fileName);
            System.out.println("Model created: "+ i+" for "+fileName);

        ModelsManager.count--;  
            return i;
        }else{ //No available id, need to discard an expendable texture
           //if I get here it means all ids are taken, pointless to check on models[] again, just free up one with 0 istances
           i=0;
            while(i<Configuration.getMaxModelCount()){
                if(instanceCount[i]==0){  //Found one to discard
                   models[i].release();
                    models[i]=new Model3D(fileName);                    
        ModelsManager.count--;            
                    return i;                    
                }else{
                    i++;
                }                
            }
        ModelsManager.count--;            
            return -1;
        }    
        }
    }


Thanks..
12  Java Game APIs & Engines / JOGL Development / Re: Trouble with texturing on: 2005-12-10 01:38:38
Found it, this new release loads jogl_awt.dll, for the installer to work properly it has to copy that file as well as jogl.dll.
Problem solved ~ hope this can be useful.

13  Java Game APIs & Engines / JOGL Development / Re: Trouble with texturing on: 2005-12-10 01:17:55
Okay.. I think I tracked the problem down. Of course all this doesn't have anything at all to do with texturing...  ~

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  
          if (osType != MAC_OS) { // borrowed from NativeLibLoader
           try {
              System.loadLibrary("jawt");
              System.out.println("jawt loaded");              
            } catch (UnsatisfiedLinkError ex) {
              // Accessibility technologies load JAWT themselves; safe to continue
             // as long as JAWT is loaded by any loader
             if (ex.getMessage().indexOf("already loaded") == -1) {
                displayError("Unabled to load JAWT");
                throw ex;
              }
            }
          }
          // static linking
         try {
            System.load(nativeLib.getPath());
            System.out.println("Jogl loaded from jar");
          } catch (UnsatisfiedLinkError ex) {
            // should be safe to continue as long as the native is loaded by any loader
           if (ex.getMessage().indexOf("already loaded") == -1) {
              displayError("Unable to load " + nativeLib.getName());
              throw ex;
            }
          }

          // disable JOGL loading form elsewhere
         com.sun.opengl.impl.NativeLibLoader.disableLoading();


This code loads the jawt and jogl from the jar it just uploaded to the target machine, then disables any further automatic library loading (last line). If I comment this last line, then netbean's applet viewer will run the applet fine, by loading my dev. copy of jogl pointed to by the classpath. If I sign the jar and stuff and try to load it as it is on a machine without jogl in the class path, the jvm gets pissed. If I leave the disableLoading() directive there to do its job, then the applet will load, but then this error will be thrown:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
Exception in thread "AWT-EventQueue-1" java.lang.UnsatisfiedLinkError: JAWT_GetAWT0
        at com.sun.opengl.impl.JAWTFactory.JAWT_GetAWT0(Native Method)
        at com.sun.opengl.impl.JAWTFactory.JAWT_GetAWT(JAWTFactory.java:38)
        at com.sun.opengl.impl.JAWT$1.run(JAWT.java:99)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.opengl.impl.JAWT.getJAWT(JAWT.java:95)
        at com.sun.opengl.impl.windows.WindowsOnscreenGLDrawable.lockSurface(WindowsOnscreenGLDrawable.java:128)
        at com.sun.opengl.impl.windows.WindowsOnscreenGLContext.makeCurrentImpl(WindowsOnscreenGLContext.java:58)
        at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:74)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:117)
        at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:236)
        at javax.media.opengl.GLCanvas.display(GLCanvas.java:127)
        at javax.media.opengl.GLCanvas.paint(GLCanvas.java:139)
        at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
        at sun.awt.RepaintArea.paint(RepaintArea.java:224)
        at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:254)
        at java.awt.Component.dispatchEventImpl(Component.java:4031)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


This didnt happen with older builds of jogl, I think the jvm was happy enough with the manual loading of jawt and jogl. Not anymore now, anyone know if I need to manually load anything else to make this work?

Thanks.
14  Java Game APIs & Engines / JOGL Development / Re: Trouble with texturing on: 2005-12-09 22:30:15
After going crazy for a day, and stumbling into every possible error.. I finally had the great idea to run my applet directly. (I am using The JOGL Applet Launcher www.vlsolutions.com/free/jogltest/ made by Lilian, thanks for the great tool btw) So I found out my code was running perfectly fine, and the latest bunch of errors I was getting were coming from the awt stuff. Here's a copy of the trace:

Exception in thread "AWT-EventQueue-1" java.lang.UnsatisfiedLinkError: JAWT_GetAWT0
        at com.sun.opengl.impl.JAWTFactory.JAWT_GetAWT0(Native Method)
        at com.sun.opengl.impl.JAWTFactory.JAWT_GetAWT(JAWTFactory.java:38)
        at com.sun.opengl.impl.JAWT$1.run(JAWT.java:99)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.opengl.impl.JAWT.getJAWT(JAWT.java:95)
        at com.sun.opengl.impl.windows.WindowsOnscreenGLDrawable.lockSurface(WindowsOnscreenGLDrawable.java:128)
        at com.sun.opengl.impl.windows.WindowsOnscreenGLContext.makeCurrentImpl(WindowsOnscreenGLContext.java:58)
        at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:74)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:117)
        at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:236)
        at javax.media.opengl.GLCanvas.display(GLCanvas.java:127)
        at javax.media.opengl.GLCanvas.paint(GLCanvas.java:139)
        at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
        at sun.awt.RepaintArea.paint(RepaintArea.java:224)
        at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:254)
        at java.awt.Component.dispatchEventImpl(Component.java:4031)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

This happens with the latest jogl build and the applet launcher, so I guess it now needs some tuning to work again. I m going to look into it now to see if I can find a solution to this.


15  Java Game APIs & Engines / JOGL Development / Trouble with texturing on: 2005-12-09 00:45:00
java.lang.IllegalArgumentException: Illegally formatted version identifier: "null"
        at com.sun.opengl.impl.FunctionAvailabilityCache$Version.<init>(FunctionAvailabilityCache.java:317)
        at com.sun.opengl.impl.FunctionAvailabilityCache.initAvailableExtensions(FunctionAvailabilityCache.java:132)
        at com.sun.opengl.impl.FunctionAvailabilityCache.isExtensionAvailable(FunctionAvailabilityCache.java:103)
        at com.sun.opengl.impl.GLContextImpl.isExtensionAvailable(GLContextImpl.java:244)
        at com.sun.opengl.impl.GLImpl.isExtensionAvailable(GLImpl.java:27673)
        at com.sun.opengl.impl.GLImpl.checkBufferObject(GLImpl.java:27707)
        at com.sun.opengl.impl.GLImpl.checkUnpackPBODisabled(GLImpl.java:27728)
        at com.sun.opengl.impl.GLImpl.glTexImage2D(GLImpl.java:19415)
        at myApp.JoglEventListener.init(JoglEventListener.java:85)

Is thrown after executing the following code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
       ByteBuffer texture;
       IntBuffer textures;
       int tWidth;
       int tHeight;

       [image loading code here]

        textures=IntBuffer.allocate(1);
        myGL.glGenTextures(1, textures);
        int i=textures.array()[0];
        myGL.glBindTexture(GL.GL_TEXTURE_2D, i);
        texture.rewind();

        myGL.glTexImage2D(GL.GL_TEXTURE_2D, 0, 3, tWidth, tHeight,
                0, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, texture);


Been on this for a while now.. and I m sure it's some stupid newbie thing I m doing ~ any ideas from you pro?
Thanks.


16  Java Game APIs & Engines / JOGL Development / Re: JOGL Applet Security on: 2005-12-06 20:12:05
I totally agree with you, users need to be "educated" on this, but I m sure you know how many scams and stuff you can find on the internet which pop up "will you accept to be f**ed?". Let's say I make a java game and I deploy it in a signed applet. An average user who doesn't know it (I will not make any big advertising campaign etc... I m just a poor student ^^ ) finds it with google or something. He gets curious and wants to try it. Then this window pops up. "Will you allow blah blah?". I think a good 50% of these users would click "nowayinhell" and just close my website never to come back because of past experiences with scams etc.
You can obviously see how this would have a very bad impact on the success of my application.
What I would like to do is to load the binaries directly from my server, without having to write anything to the user's machine (so I can avoid signatures, and I can run it on machines without any writing permissions, like for example school machines or whatever).
Is that at all possible?

1) unsigned applet loads.
2) detects os type
3) asks the server for the correct dll, and the server sends it for the client to load (not to copy to the target machine, only to load it).

In my newbieness I kinda think this would be the best solution for this scenery, if technically possible.
What are your opinions about this idea?

Regards.
17  Java Game APIs & Engines / JOGL Development / Re: JOGL Applet Security on: 2005-12-05 01:56:07
All this is great.. but a user who wants to use an applet made like this still needs to accept the signature.. Do you guys think there could be any way to keep the binaries on the server and load them remotely from there after detecting on which platform the applet is running? Would this be enough to be able to avoid the signature?

Regards
18  Game Development / Networking & Multiplayer / Re: Trouble with ObjectInputStream.readObject() and memory on: 2005-10-24 04:27:40
Ok, I think I got it fixed.. I found out you need to call .reset( ) not long before I posted this, so I was only using it on the server, it needs to be done on both client and server to work properly. I thought "let's fix server first, then I can do client"... what a bad idea =)

Thanks all for your help.
19  Game Development / Networking & Multiplayer / Re: Trouble with ObjectInputStream.readObject() and memory on: 2005-10-24 03:15:50
  private ObjectOutputStream myStreamWriter=null;
  private ObjectInputStream myStreamReader=null;
  private ConnectionServer connectionServer=null;
  private int sentMsgCounter;

  public void init(){
    try{
        this.myStreamWriter= new ObjectOutputStream (new BufferedOutputStream(mySocket.getOutputStream()));
        this.myStreamWriter.flush();
        this.myStreamReader = new ObjectInputStream(new BufferedInputStream(mySocket.getInputStream()));
    }catch(Exception e){System.out.println("Error "+e+" handling client for "+mySocket);}
}
  public void sendData(NetworkMessage message){
    try{
         myStreamWriter.writeObject(message);
         myStreamWriter.flush();
         if(++sentMsgCounter>= RESET_FREQUENCY ){
              sentMsgCounter = 0;
              // Failing to reset the object output stream every now and
              // then creates a serious memory leak.
              myStreamWriter.reset();
         }
      }catch(IOException e){System.out.println(e);};
      return;
  }

Init is the initialization function (uh uh ~ ) and sendData is the writer one, everything looks fine to me.. but obviously isn't, for some reason.
I think the problem is with the reader, not with the writer. incomingMessage is defined as a member of the class, and it's of type NetworkMessage. As you can guess, the leak is on instances of NetworkMessage.. which the profiler says are instanced by ObjectInputStream.readObject()

After about 2 hrs running, JProfiler displays: 100.0% - 6.469 kB - 404.314 alloc. java.io.ObjectInputStream.readObject

Everything hints the incriminated references are inside the ObjectInputStream itself (look at the picture in the original post, it's a view of the references to NetworkMessage per JProfiler) .

**Update**
I just tried calling ObjectOutputStream.reset( ) every now in the reader function, but it doesn't help either.
20  Game Development / Networking & Multiplayer / Trouble with ObjectInputStream.readObject() and memory on: 2005-10-23 22:35:39
Hello...
I am using serialization to send stuff from a client to a server... here is the server loop code:

    try{
        while(runMe){

           Object obj = myStreamReader.readObject();
           incomingMessage=(NetworkMessage)obj;
         
           parseInput(); //Parses the client request and sends an answer
           incomingMessage=null;

       }
    }catch(Exception e){System.out.println("Connection thread: error "+e+" handling client for "+mySocket);}

I don't know what I m doing wrong... but I get a memory leak, the heap keeps growing and growing, until I get the outofmemory exception. I tried commenting out the parseInput() method, in case I m keeping some open references during the handling of the messages... nothing..
Is there anything I need to do to clear the ObjectInputStream 's own references to the retrieved objects? The problem seems to lie there, but I wasn't able to find any info about it.
Here is the reference tree:
Click to Play


I seem to understand from this the only reference is from the ObjectInputStream itself.
Thanks everybody for your help.
21  Java Game APIs & Engines / Java 2D / Re: Memory leak using bufferStrategy on: 2005-10-23 10:27:23
Ok.. I need to stop coding at 5 am...
Here's the catch...
A method called for rendering was instancing a Graphics object and not calling dispose()....... obviously =D
I was so sure it was the .show() method at the beginning.. because commenting the call to that also stops the call to this method.. but looking more closely... I finally found out I need to sleep more....
Thanks all again for your help ~

-Regards, a random sleepy head ~
22  Java Game APIs & Engines / Java 2D / Re: Memory leak using bufferStrategy on: 2005-10-23 10:07:18
Basically... it eats up 4 kb/sec at a very steady rate without stopping or going down (would expect that to happen when the garbage collector gets to work..). I m just using the windows task manager to see it.. it's pretty clear. I m running jdk 1.4.2_10 for compatibility with mac os atm, win xp sp2, graphics card/ processor don't matter, it does so on 3 different systems.
I think it must be my mistake.. it can't just be the bufferStrategy, going to review all the code and see if I don't call .dispose() on something... will let you know if this gets fixed, thanks for your time ~

-Regards
23  Java Game APIs & Engines / Java 2D / Re: Memory leak using bufferStrategy on: 2005-10-22 23:33:57
Yep
24  Java Game APIs & Engines / Java 2D / Memory leak using bufferStrategy on: 2005-10-22 20:14:15
Hello ~
I am writing a 2d engine which is currently supposed to run in an applet on a Canvas.
I m using bufferStrategy and every time I call myBufferStrategy.show() I get 4 kb of memory eaten up by the jvm... I know it's caused by this.. because I commented that line.. and the memory leaking stops..
Any ideas?

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.

radar3301 (11 views)
2014-09-21 23:33:17

BurntPizza (29 views)
2014-09-21 02:42:18

BurntPizza (19 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (27 views)
2014-09-20 20:14:06

BurntPizza (30 views)
2014-09-19 03:14:18

Dwinin (47 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
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!