Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
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 / Re: Textures on: 2010-10-19 07:57:03
you should use TYPE_INT_ARGB_PRE, its the fastet so far i know.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
  Texture makeTex(BufferedImage img){
      if(img.getType() == BufferedImage.TYPE_INT_ARGB_PRE){
        return TextureIO.newTexture(img,false);
      }else{
        BufferedImage bimg = new BufferedImage(img.getWidth(),img.getHeight(),BufferedImage.TYPE_INT_ARGB_PRE);
        Graphics2D g2d = bimg.createGraphics();
        g2d.drawImage(img, 0, 0, null);
        g2d.dispose();
        return TextureIO.newTexture(bimg,false);
      }
  }

 persecutioncomplex
2  Game Development / Game Mechanics / ZLib problem on: 2010-10-15 15:15:45
Hi,
I juz started making a Jump'n'run engine.
So we need an editor.
Now we are @ the part to save the finished map.
I want to save the data as a Base64 encoded ZLib Compressed String.
Earlier i used Ruby to compress and encode the string, now i want to use java.
But the result of the Compression is kinda buggy, it always gives me:
java.util.zip.DataFormatException: incorrect header check

The Inflater part should be OK, becauze it worked earlier fine.
I think its a problem how i compressed the string.
Heres my code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
        byte[] bytes = (String)layerCodes[i].getBytes("UTF-8");
        bytelength=bytes.length;
        byte[] output = new byte[bytes.length];
        Deflater compresser = new Deflater();
        compresser.setInput(bytes);
        compresser.finish();
        int compressedDataLength = compresser.deflate(output);
        layerCodes[i] = new String(output, 0, compressedDataLength, "UTF-8");
        layerCodes[i] = Base64Decoder.encodeString(layerCodes[i].trim());

I dont get it what i've done wrong;
1  
        byte[] output = new byte[bytes.length];

Have i to put the exact output lenght?

Base64 En/De-Coder: http://www.source-code.biz/base64coder/java/

Edit:
A clean result should look like this:
1  
eJwz0DHQMbYwswYABtMBlQ==

But thats the result from Java method:
1  
eO+/vTPvv70x77+9

._.
Something have to be wrong, the base64 encoder`? but i printed the String before encoding and after decoding, they was the same.

Edit: solved, juz kiked the compression out of my code
3  Java Game APIs & Engines / Java Sound & OpenAL / Re: A small question on: 2010-10-01 11:32:24
System.getProperty("user.dir")+"\\lib" -> C:\Users\Blair\Documents\NetBeansProjects\trunk\Atramentum\lib
Thats the folder where my dll is  Sad
If i put the folder complete manualy, it still does not solve it Sad

Anyway, that fmod seems to be better ( saw how many games using it ) and it works fine  Tongue
thx
4  Java Game APIs & Engines / Java Sound & OpenAL / Re: A small question on: 2010-09-28 21:19:35
-Djava.library.path=".\lib\" -> Still gives same error.
Im using 1.1.2.
I cant drag & drop the dll into the libary section, only in the src section but that does not solve it Sad
Can i pack a dll into a jar and add it to my classpath?
Or can i modify my library path inside the java code?
Something like:
1  
2  
3  
static{
  System.addLibrary=".\lib\joal_native.dll";
}


Edit:
1  
2  
3  
4  
5  
6  
7  
8  
  static {
     try {
       System.setProperty("java.library.path",System.getProperty("user.dir")+"\\lib");
       System.out.println(System.getProperty("java.library.path"));
     } catch (UnsatisfiedLinkError e) {
       e.printStackTrace();
     }
  }

The dll is in the folder that he prints me, but he still says: not found Sad

--------------------

Solved, i use an other lib now: http://jerome.jouvie.free.fr/Fmod/NativeFmodEx/index.php
Thx u 2
5  Java Game APIs & Engines / Java Sound & OpenAL / A small question on: 2010-09-28 18:20:43
Hi,
how can i add my native libs to my netbeans project?
I added it to my library path
-Djava.library.path=".\lib\joal_native.dll"
in my VM Optiones, but it still cant find joal_native.
 Sad
6  Java Game APIs & Engines / JOGL Development / Re: Future of JOGL? on: 2010-09-23 12:14:39
last update was 18-Sep-2010 09:25 (i think Shocked)
7  Java Game APIs & Engines / JOGL Development / Re: how to make a camera on: 2010-09-18 18:10:35
but it would work better if you do like gouessej said  persecutioncomplex
8  Java Game APIs & Engines / JOGL Development / Re: how to make a camera on: 2010-09-13 13:11:40
 Sad
Well what axis do you think is rightVector representing?
A Vector with Zero Lenght cant point in a direction, so its not a vector.  Undecided
1 0 0
btw: rightVector was in my old post...
9  Java Game APIs & Engines / JOGL Development / Re: how to make a camera on: 2010-09-12 21:21:52
Do you know whats a Vector?
If yes, put the values in that u need.
Quote
but the camera's staring in some random direction
Thats becauze i put some random values in.

origPosition = Camera Position
origViewDir = View Direction
origViewDir+origPosition = Target Position

So if u have a target and u have a position for your camera you can easy calculate the view direction on this way:
Target Position - origPosition = origViewDir

Quote
does jmonkey or xith3d have a good camera class i can rip off?
There you have to put some values in too, or it does not know what you want from him.
10  Java Game APIs & Engines / JOGL Development / Re: how to make a camera on: 2010-09-12 11:47:55
    Vector3 origViewDir = new Vector3(0,-.4f,-1);
    Vector3 origRightVector = new Vector3(1,0,0);
    Vector3 origUpVector = new Vector3(0,1,0);
    Vector3 origPosition = new Vector3(0,2,3);

... some values needed.
U cant look into the direction of no-direction in a System where are no axis.
11  Game Development / Artificial Intelligence / Re: Vektors and Angles on: 2010-09-10 21:38:07
nice, thx.
that was what i was looking for :3
12  Game Development / Artificial Intelligence / Vektors and Angles on: 2010-09-10 20:57:32
hi,
i got a problem for calculating my camera.
I tried so much stuff.
What i got:
2 Vektors:
  p = my aktual position
  t = my desired point
My wished point to look @ is in the center of my coor-system.
Now i have done the calculation of u( = the vektor where the cam is moving ).
In the next step i want to use t to get the angles to my wished point w(0,0,0); t+w = my view direction.
I've done a small graphic for this:


I tried to get the angles on this way:
First i turned the direction of t around, so all values are multiplied by -1.
Now my Vektor t is pointing down to w(0,0,0).
In the next step i reduced t on 2 Planes.
So i can calculate the angles with X/Y and X/Z
a = arccos(  (tx,ty)skalar(1,0) / |(tx,ty)|*|(1,0)|);
b = arccos(  (tx,tz)skalar(0,1) / |(tx,tz)|*|(0,1)|);

But my result is bad  Sad


(thats math so it have to be in this forum, right? if not, it may belongs to JOGL, im sry)
13  Java Game APIs & Engines / JOGL Development / Re: how to make a camera on: 2010-09-10 10:25:47
Ok
viewDir is Null
becauze:
1  
2  
3  
4  
5  
6  
7  
8  
9  
    public Vector3 getNormal()
    {
        float l = getLength();

        if(l == 0.0f)
            return null;

        return new Vector3(X / l, Y / l, Z / l);
    }

Ur camera says: viewDir = viewDir.getNormal();
But the values of viewDir are:
X=0
Y=0
Z=0
Now u look for the lenght of this vector, the lenght is 0.
So the method give u Null.
So your vector becomes Null.
Anyway, viewDir sounds like an direction, put in a direction or you will get a crappy view
14  Java Game APIs & Engines / JOGL Development / Re: how to make a camera on: 2010-09-09 19:18:16
where u get the error? could u tell us the code from that line?
uhm, u used the right package?
The code from the website seems to work, they juz forgot a ) somewhere @ the top.

(
1  
2  
if(!ready)
            return;

i dont think that u need that if u use:
Awesomecam cam = new Awesomecam();
cam.look(...);
)
15  Java Game APIs & Engines / JOGL Development / Re: No transparenzy with GL_DEPTH_TEST on: 2010-08-27 17:28:26
Bananni
that would be a nice name :3
thx  Smiley
16  Java Game APIs & Engines / JOGL Development / Re: No transparenzy with GL_DEPTH_TEST on: 2010-08-27 17:11:11
I dont realy get it :/
i used: glAlphaFunc(GL_EQUAL,1f);
but it didnt changed anything.

Edit: nvm, it was a result of my stupidity...
forgot to enable ALPHA_TEST.
Thx for ur help ^^
(Can i change my name or do i have to wait until i can change it?)
17  Java Game APIs & Engines / JOGL Development / Re: No transparenzy with GL_DEPTH_TEST on: 2010-08-27 16:34:02
Thx i will try around with it.
(my nickname does not mean that i wanna kill u  persecutioncomplex)
i didnt modify the AlphaFunc so it should be GL_ALWAYS.
The textures have an alpha channel and they are transparent, but they delete some party of the other textures.
What i dont understand is why they always delete 1 texture and leave the rest in peace?

This picture shows the first rendered battler behind the secounds rendered, they dont erase some regions of each other, only if i put the first rendered in front of the secound rendered some parts of the secound rendered will be delete
18  Java Game APIs & Engines / JOGL Development / No transparenzy with GL_DEPTH_TEST on: 2010-08-27 16:12:53
Hello,
I have a problem by non-displaying transparent regions of my textures.
After i used GL_DEPTH_TEST my transparent regions became black or the background color.
I read something about double rendering but i dont get it how it works corectly.
I tryed:
1  
2  
3  
4  
5  
6  
7  
8  
9  
glDephtFunc(GL_GREATER)
glDephtMask(false);

FIRST RENDERING

glDepthFunc(GL_LEQUAL);
glDepthMask(true);

SECOUND RENDERING

The result of that was that they are still overlapping each other.
Heres my actual result of my system:
(rendered 1 time with GL_LEQUAL and DepthMask true)

(the number shows u the order in that i rendered the objects)
My blending:
gl.glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE_MINUS_SRC_ALPHA);

It would be very welcomed if this method is the badder 1 of some easy methods.
I dont think that im able to split my polygons in smaller 1 so they dont overlap each other.
19  Java Game APIs & Engines / JOGL Development / Re: Problem with: glutSolidSphere & GL_QUADS on: 2010-08-27 15:44:42
The upper part i didnt change.
I juz realized that i used .1 to 10 for range.
So i changed the Z Coor of my Battler to -6f and there he was :3
In the next step i saw that my battler has a polygon, but no texture.
I searched for the reason and i saw the line: cubemap.enable();
so i completet it @ the end of my background rendering by: cubemap.disable();
Here are my modifications:
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  
  private void renderBG(GL gl){
    gl.glLoadIdentity();
    cubemap.bind();
    // -------------------------------------- WHERES THE REST? :(
    cubemap.enable();
    // -------------------------------------------------------------------
    gl.glEnable(GL.GL_LIGHTING);

    gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP);
    gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP);
    gl.glTexGeni(GL.GL_R, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP);

    gl.glEnable(GL.GL_TEXTURE_GEN_S);
    gl.glEnable(GL.GL_TEXTURE_GEN_T);
    gl.glEnable(GL.GL_TEXTURE_GEN_R);

    gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE);

    gl.glMatrixMode(GL.GL_TEXTURE);
    gl.glPushMatrix();
    gl.glLoadIdentity();

    useCamera(gl);

    glut.glutSolidSphere(5.0, 40, 20);

    gl.glDisable(GL.GL_LIGHTING);

    gl.glPopMatrix();
    gl.glMatrixMode(GL.GL_MODELVIEW);

    gl.glDisable(GL.GL_TEXTURE_GEN_S);
    gl.glDisable(GL.GL_TEXTURE_GEN_T);
    gl.glDisable(GL.GL_TEXTURE_GEN_R);
    // ------------------------------------------------- HERE IT IS :3
    cubemap.disable();
    // -------------------------------------------------------------------
  }
20  Java Game APIs & Engines / JOGL Development / Re: Problem with: glutSolidSphere & GL_QUADS on: 2010-08-26 11:50:17
Yes, in ortho mode they was displayed, before in 3D Mode also, but now its not possible anymore and i dont get it why i cant display them anymore =/
OK! now my system is displaying the Quad, i made a mistake with Z, i used + instead of - and i forgot to use: cubemap.disable();
Thx, can be closed Smiley
21  Java Game APIs & Engines / JOGL Development / Problem with: glutSolidSphere & GL_QUADS on: 2010-08-25 20:01:48
Hi,
for my battle system im using a Cubemap to fake a full 3D world.
Im using 6 textures, 4 for sides and 2 for ground and sky.
Now i would like to use GL_QUADS to display my 2D battlers.
The problem now is: My Battlers arent display =/
Heres the code/setting im using:
settings:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
        gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
        gl.glShadeModel(GL.GL_FLAT);
        gl.glEnable(GL.GL_TEXTURE_2D);
        gl.glEnable(GL.GL_BLEND);
        gl.glColorMask(true, true, true, true);
        double widht = 774;
        double height = 540;
        final float h = (float) width / (float) height;
        gl.glMatrixMode(GL.GL_PROJECTION);
        gl.glLoadIdentity();
        glu.gluPerspective(60.0f, h, .1, 10);
        gl.glViewport(0, 0, (int)width, (int)height);
        gl.glMatrixMode(GL.GL_MODELVIEW);
        gl.glLoadIdentity();

render:
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  
  public void render(GL gl){
    renderBG(gl);
    for(int i=0;i<battler.length;i++){ // 2 Battlers
      Texture tex = battler[i].battler.animations[battler[i].action].getFrame(); // The Texture is a texture with content.
      tex.bind();
      tex.enable();
      gl.glTranslatef(battler[i].coor.xf, battler[i].coor.yf, battler[i].coor.zf); // All Coor are zero.
      TextureCoords coords = tex.getImageTexCoords();
      gl.glBegin(GL.GL_QUADS);
        gl.glTexCoord2f(coords.left(), coords.bottom());
        gl.glVertex3f(0, 0, 0);
        gl.glTexCoord2f(coords.right(), coords.bottom());
        gl.glVertex3f(1, 0, 0);
        gl.glTexCoord2f(coords.right(), coords.top());
        gl.glVertex3f(1, 1, 0);
        gl.glTexCoord2f(coords.left(), coords.top());
        gl.glVertex3f(0, 1, 0);
      gl.glEnd();
      gl.glTranslatef(-battler[i].coor.xf, -battler[i].coor.yf, -battler[i].coor.zf);
    }
  }
  private void useCamera(GL gl){
    gl.glRotatef((float)Math.toDegrees(Camera.v),1f,0f,0f); // is zero.
    gl.glRotatef((float)Math.toDegrees(Camera.h),0f,1f,0f); // is zero.
    gl.glRotatef((float)Math.toDegrees(Camera.c),0f,0f,1f); // is zero.
  }
  private void renderBG(GL gl){
    cubemap.bind();
    cubemap.enable();
    gl.glEnable(GL.GL_LIGHTING);
    gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP);
    gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP);
    gl.glTexGeni(GL.GL_R, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP);
    gl.glEnable(GL.GL_TEXTURE_GEN_S);
    gl.glEnable(GL.GL_TEXTURE_GEN_T);
    gl.glEnable(GL.GL_TEXTURE_GEN_R);
    gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE);
    gl.glMatrixMode(GL.GL_TEXTURE);
    gl.glPushMatrix();
    gl.glLoadIdentity();
    useCamera(gl);
    glut.glutSolidSphere(5.0, 40, 20);
    gl.glDisable(GL.GL_LIGHTING);
    gl.glPopMatrix();
    gl.glMatrixMode(GL.GL_MODELVIEW);
    gl.glDisable(GL.GL_TEXTURE_GEN_S);
    gl.glDisable(GL.GL_TEXTURE_GEN_T);
    gl.glDisable(GL.GL_TEXTURE_GEN_R);
  }
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.

rwatson462 (37 views)
2014-12-15 09:26:44

Mr.CodeIt (31 views)
2014-12-14 19:50:38

BurntPizza (62 views)
2014-12-09 22:41:13

BurntPizza (99 views)
2014-12-08 04:46:31

JscottyBieshaar (60 views)
2014-12-05 12:39:02

SHC (74 views)
2014-12-03 16:27:13

CopyableCougar4 (77 views)
2014-11-29 21:32:03

toopeicgaming1999 (138 views)
2014-11-26 15:22:04

toopeicgaming1999 (127 views)
2014-11-26 15:20:36

toopeicgaming1999 (38 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

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