Show Posts
|
|
Pages: [1]
|
|
1
|
Java Game APIs & Engines / JOGL Development / Re: Textures
|
on: 2010-10-19 09: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); } } |

|
|
|
|
|
2
|
Game Development / Game Mechanics / ZLib problem
|
on: 2010-10-15 17: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: ._. 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 13:32:24
|
System.getProperty("user.dir")+"\\lib" -> C:\Users\Blair\Documents\NetBeansProjects\trunk\Atramentum\lib Thats the folder where my dll is  If i put the folder complete manualy, it still does not solve it  Anyway, that fmod seems to be better ( saw how many games using it ) and it works fine  thx
|
|
|
|
|
4
|
Java Game APIs & Engines / Java Sound & OpenAL / Re: A small question
|
on: 2010-09-28 23: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  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  -------------------- Solved, i use an other lib now: http://jerome.jouvie.free.fr/Fmod/NativeFmodEx/index.phpThx u 2
|
|
|
|
|
9
|
Java Game APIs & Engines / JOGL Development / Re: how to make a camera
|
on: 2010-09-12 23:21:52
|
Do you know whats a Vector? If yes, put the values in that u need. 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 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 13: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.
|
|
|
|
|
12
|
Game Development / Artificial Intelligence / Vektors and Angles
|
on: 2010-09-10 22: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  (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 12: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 21: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. ( i dont think that u need that if u use: Awesomecam cam = new Awesomecam(); cam.look(...); )
|
|
|
|
|
17
|
Java Game APIs & Engines / JOGL Development / Re: No transparenzy with GL_DEPTH_TEST
|
on: 2010-08-27 18:34:02
|
Thx i will try around with it. (my nickname does not mean that i wanna kill u  ) 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 18: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 17: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(); 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); cubemap.disable(); } |
|
|
|
|
|
21
|
Java Game APIs & Engines / JOGL Development / Problem with: glutSolidSphere & GL_QUADS
|
on: 2010-08-25 22: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++){ Texture tex = battler[i].battler.animations[battler[i].action].getFrame(); tex.bind(); tex.enable(); gl.glTranslatef(battler[i].coor.xf, battler[i].coor.yf, battler[i].coor.zf); 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); gl.glRotatef((float)Math.toDegrees(Camera.h),0f,1f,0f); gl.glRotatef((float)Math.toDegrees(Camera.c),0f,0f,1f); } 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); } |
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|