Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Cowbox

Pages: [1]
Support / Window icon?
« on: November 30, 2012, 11:14:55 pm »
Ok, this seems ridiculous. xD

There has to be a better way to get one tiny little picture, into the top left of the window.

I mean, that one with the 4 keys, and the blue circle got up there somehow.

Surely there's some quick trick I'm missing where I just put icon.ico or something next to the .jar and it goes "Aha! - I'll just use that!"

Or a method somewhere in a class for "setIcon". xD

I've searched high and low for icons, lwjgl, bytebuffers etc. - and none of it seems to help a great deal.

I got to the point where I had:

And thought, "Ah! All I have to do, is load an image in as a bytebuffer!"

But that seems a monster of a task as well. xD

What can I do?

Surely there's a way to get an icon on the jPCT window, I mean, it's already gotten one from somewhere. :(

Either that, or some kind of handler for the window, that can then be manipulated?

D: <Stuck>

Projects / VoxRaiders
« on: November 30, 2012, 09:48:33 pm »

I thought it was time we announced our project!

VoxRaiders is essentially a mining game in development by Soharix.
We're using Voxeng5, a voxel engine built right on top of the jPCT engine. (Thanks to EgonOlsen for all his help with that.) :D

And yes, the game is inspired by LEGO® RockRaiders™.

There is no real objective yet, as this is only our 3rd release of alpha, but already many of the core game mechanics are in place:
* You can place miners, who will run about mining random walls.
* You can place barriers, to stop the miners running into trouble (lava).
* You can access all 1024x1024x20 voxels in the randomly generated world.
* Flowing fluids (water, noxious gas and lava are all hazards at the moment)

Features yet to come include:
* Vehicles
* Buildings
* Dangerous AI entities
* 2 additional AI algorithms (for waypoints and rudimentary pathfinding)

The current version, Alpha v0.04 can be downloaded here:

And here are some screenshots:

(The first one was taken before we made a more suitable bitmap font.)

Anyone having difficulty running it successfully is probably facing memory problems with Java.

Support / Blitting transparency troubles
« on: November 23, 2012, 03:59:20 pm »
:D Me again,

I've got a HUD on my game at the moment that uses blitting of bitmap images as textures to put images on the display.

I'm slightly confused as to the behavior I'm seeing though.

The documentation (and just, the way the methods seem to suggest they work) implies that something like this:
Code: [Select]
buffer.blit(btn1,0,0,0,0,32,32,32,32,[b]0[/b],false);would render the image with all areas of 0,0,0 as transparent.

However, it renders all areas with colours values less than 16,16,16 (so 15,15,15; 14,14,14; 13,13,13; etc.) as transparent. D:

Is there a way to stop this? (I've checked what colour depth I've been using, and switched variables around: none of it seems to make any difference.)

The other thing in conjunction with this is that it'd be nice if there was a way to set a particular colour to be used as transparent rather than 0,0,0 -> 16,16,16 - I mean, if I used 255,0,255 (a colour I'm not using) for transparency , then all black values would be available.

I keep looking through the documentation for a method along the lines of:
Code: [Select]
setTransparentColor(int r,int g,int b)or something. :(

Please enlighten me :D! There has to be something I'm doing wrong. xD

Ok this time I'm sure I've found a bug.

I just converted an old bitmap font decoder from Slick2D into jPCT. The principles are basically exactly the same.

The code I would want to use would be something like this: (for numbers)
Code: [Select]
public static void drawString(FrameBuffer b,int x,int y,String string)
for(int c=0;c<string.length();c++)
int ascii=(int)string.charAt(c);

This should theoretically work on this image:

But it displays a seemingly random jumbled subset of the image.

The only way I could get it to display the right numbers (or letters in other parts of the whole code) was to do something like this:
But I mean, why 64? How am I to use this usefully?

If I resize the image to 260x260, the original works, but has artifacts around the edges of characters and wastes space.


Support / TextureInfo add(i,f,f,f,f,f,f,i) does the same as add(i,i)
« on: October 29, 2012, 02:20:34 pm »
Me again :)

I'm trying to scale the texture being modulated into the textures on my polygons using the longer add method in the TextureInfo class.

I have this line initially just for the normal texture:
Code: [Select]
texInf[i]=new TextureInfo(tm.getTextureID("layer"+i));
Originally I had this after it, to add a second texture to the surface:
Code: [Select]
texInf[i].add(tm.getTextureID("floorTexN"),TextureInfo.MODE_MODULATE);^This works fine, but I wanted the second texture to occur more frequently (there isn't a nice way to tile texture stages)

So I found the long add method and tried something like this:
Code: [Select]
texInf[i].add(tm.getTextureID("floorTexN"),2f,2f,2f,2f,2f,2f,TextureInfo.MODE_MODULATE);No difference. :(

Infact, all of these:
Code: [Select]
Look exactly the same. :(

The second texture stage doesn't tile or stretch at all. :(

This seems to be a bug to me, or am I doing something silly and should be using a different method?

I should point out, this is all without shaders. (I'm in the middle of coding a version that works without a shader to make things faster. - All I want is a fairly frequent multitexture.)

Also for the record, if I manually tile the image loaded (from 256x256 to 512x512) it does work. (I just want to tile it to the equivelant of about 16384x16384 using texture tiling in the code.)

Support / Texture reloading just turns objects white
« on: October 15, 2012, 04:23:37 pm »
Same voxel engine as the last thread I made.

All I'm trying to do is implement saving and loading.

Saving works, a little slower than I had expected, but at least outputs files in .png with ARGB.

Loading the textures for all the layers of voxels only works the first time when I run this method:
Code: [Select]
private void loadWorld(String name)
System.out.println("Loading "+name);
// Load each layer image
for(int i=0;i<layerNumber;i++)
Texture t=new Texture("user/"+name+"/layer"+i+".png",true);
Texture t2=new Texture("user/"+name+"/layer"+i+".png",true);
layers[i]=new TextureInfo(ids[i]);
layergs[i]=new TextureInfo(idgs[i]);
System.out.println("Loaded "+name);
(ids and idgs, are just for storing the layer IDs for faster editing elsewhere (so it's not searching for strings))

The second time I run it, all the objects those textures apply to are just plain white. D:

What is going wrong then? What should I be doing?

I tried using replaceTexture but all that did was replace it then reload it from the first instance it loaded the second I tried editing... So I thought I'd go down a more manual route and it's just getting me to an obvious error I can recreate than the glitchy replacement problems replaceTexture was giving me. :P

Haaaaaaaalp :'( (plz)

Support / Help D: Suddenly after a windows update jPCT doesn't work
« on: October 11, 2012, 03:16:47 pm »

I've been coding with jPCT in Java7 on Windows7x64 fine until yesterday.

I copied my project from my desktop (on exactly the same settings^) to carry on coding on my laptop today.

Windows installed an update and suddenly none of my jPCT projects work anymore. :(

It's moaning about commands like world.draw();

Here's the error log on my main project (it worked fine yesterday, the only change has been the windows update):

Code: [Select]
[ Thu Oct 11 14:12:19 BST 2012 ] - ERROR:
Exception in thread "main" org.lwjgl.opengl.OpenGLException: Invalid operation (1282)
at org.lwjgl.opengl.Util.checkGLError(
at org.lwjgl.opengl.GL20.glGetAttribLocation(
at com.threed.jpct.GLSLShader.init(Unknown Source)
at com.threed.jpct.GLSLShader.beforeRendering(Unknown Source)
at com.threed.jpct.CompiledInstance.render(Unknown Source)
at com.threed.jpct.GLRenderer.drawVertexArray(Unknown Source)
at com.threed.jpct.World.draw(Unknown Source)
at com.threed.jpct.World.draw(Unknown Source)
at com.threed.jpct.World.draw(Unknown Source)
at com.threed.jpct.util.ShadowHelper.drawScene(Unknown Source)
at com.threed.jpct.util.ShadowHelper.drawScene(Unknown Source)
at voxeng5.Voxeng5.gameLoop(
at voxeng5.Voxeng5.main(
Java Result: 1
BUILD SUCCESSFUL (total time: 6 seconds)

I've tried updating the drivers and restarting, that didn't work.
I've tried changing the code from shad.draw() and all the complicated shadow handling to just world.draw(), that didn't work.
I've checked my OpenGL version: 3.1

What do I do?????????


Support / Rotation of asymmetrical 3ds object problem
« on: February 02, 2012, 06:24:32 am »
As a different approach to constructing my maze I decided I'd make the corridor pieces and slot them in place depending on the map array.

So an area like this:
Would have a junction model at the X and suitably rotated corridor objects at the 0s (and nothing at the 1s)

However when doing this, for some reason whenever I rotate my asymmetrical junction models (basically just being one wall) they shift about and don't rotate around their origin.

Here is the model relative to the origin in Deled:

(The dark blue lines showing the X and Z axes and their intersection being the origin in all 3 axes.)

(I export the model as .x and import into Milkshape3D to export as .3ds (after mirroring in the Y axis) )

When I put the model into the actual game I get these kind of results:

(The horizontal polygon is merely there to show the offset and because I tried testing it by making vertices on symmetrical sides of the origin (to no avail of course))

And it's even more obscure when I've rotated a quarter turn. :S

I've tried omitting the build method or the compile and strip method. I've tried manually calculating the rotation pivot and the object center (neither of which changed anything)

So I'm kind of stuck now...

I simply can't do what seems an almost trivial task. xD

All the code affecting any one object in the game set up:
Code: [Select]
blocks[bindex].rotateY(-(float)Math.PI/2); // Or some other angle if it's a different junction block

And wallDummy is retrieved like this:
Code: [Select]
tm.addTexture(path+"Tex",new Texture("res/"+type+"/"+path+"/"+path+".png"));
tm.addTexture(path+"TexN",new Texture("res/"+type+"/"+path+"/"+path+"N.png"));
wallTex=new TextureInfo(tm.getTextureID(path+"Tex"));

Support / Shaders and gouraud shading
« on: January 31, 2012, 08:38:17 am »
It's me again, back with another problem. :P

I was doing quite well, understanding the API and finding all the methods and things I needed but this latest problem I feel is not something so easily solved. D:

Essentially I have a simple maze game where the level is made up of boxes positioned all over the place.

Each box has the normal mapping shader (that comes with ) and everything is working basically fine. (Asside from me still being a big noob with collision/2d/animation/sound etc.)

But one thing I'm having tremendous difficulty with is the lighting.

Here's a picture of what I mean:

Using the setShadingMode method isn't able to solve this because the lighting is in the shader pipeline.

Now that's fine, maybe I should go and find some help with GLSL for that, but what concerns me is that if I turn the shader off, and use setShadingMode with faked flat shading, the effect is still not what I'm after. - It facets the triangles in the flat surfaces of the boxes, where I just wanted it to show them as flat sided. :(

What am I really looking for? - This kind of thing was never an issue when I had to deal with DirectX and HLSL. :( Things were either smoothed to a percentage or flat but squares (i.e. 2 triangles) showed up as flat squares, not flat triangles. :(

Guidance needed. :P

Support / Something I thought would be simple...
« on: January 19, 2012, 02:36:03 am »
A little while ago, I decided I wanted the FPS of my game to display onscreen.

In other engines this seems to be a trivial task (something along the lines of "print fps" or "g.drawString(fps,0,0);" normally does the trick)

But being the inexperienced Java coder I am, I'm unused to how to seek what I desire from a new set of Java libraries (namely jPCT).

I found there wasn't really a way to do 2D at all... or if there is it's extremely convoluted so I went for just seeing if I could get a picture to display on a plane and have that constantly infront of the camera.

First, it took me a while to figure out how to get transparency to work because the Java docs are wrong (it says the maximum value for setTransparency is 0 - which it isn't: it's 5)

After getting a plane with an alpha mapped .png image to render correctly I then searched for something resembling "position object x,y,z" or "setObjectPosition(float x,float y,float z)" but the only things I can find are all these translate, transform, origin, centre and matrix commands. - I honestly can't tell from the Java docs which one would do what I'd want.

All the positioning commands seem relative to previous movement. - Surely I mustn't have to store the vector an object was translated by, then reverse the translation just to move it somewhere else every time?

I wish to position an object at the camera, then move it forward a unit or so every cycle. But I can't see how in the world I'm supposed to achieve this. xD

Something like this:
Code: [Select]

I feel incredibly stupid or like I'm missing a huge chunk of methods or something...

This kind of thing is nice and easy in DarkBASICPro/C++/other3Dengines as far as I'm aware.

Someone point me in the right direction D:

Support / Getting jPCT to work
« on: December 28, 2011, 09:39:19 pm »
I've tried going through the first topics on the Wiki but as soon as I got to the Hello World one, I found problems...

First off, it doesn't actually tell me how to make any of the objects it wants, I'm just sorta guessing at where the line World world; needs to go and whether I need FrameBuffer buffer; or something else.

And as for making the object box, I have absolutely no idea what it's talking about so I had to leave that code out.

After getting some code to work (omitting the parts that concern box of course) I get the following output in the console because I can't set the screen to use width, height, colour depth, frequency and screenmode - it's only got room for width, height and sampling mode as parameters:
Code: [Select]
Java version is: 1.7.0
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Software renderer disposed
Current mode:800 x 600 x 32 @75Hz
[ Wed Dec 28 20:23:24 GMT 2011 ] - WARNING: ZBuffer depth of 24 not supported - trying something else now...!
[ Wed Dec 28 20:23:24 GMT 2011 ] - WARNING: Does this machine actually support OpenGL? Trying everything at lowest settings now!
Driver is unknown!
[ Wed Dec 28 20:23:24 GMT 2011 ] - ERROR: Unable to set any valid videomode on this machine!
java.lang.IllegalStateException: Only one LWJGL context may be instantiated at any one time.
[ Wed Dec 28 20:23:24 GMT 2011 ] - ERROR: Can't set videomode - try different settings!
New WorldProcessor created using 1 thread(s) and granularity of 1!
at org.lwjgl.opengl.Display.create(
at org.lwjgl.opengl.Display.create(
at com.threed.jpct.GLHelper.init(Unknown Source)
at com.threed.jpct.GLRenderer.init(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at rats.Rats.main(
Software renderer disposed
BUILD SUCCESSFUL (total time: 9 seconds)
My monitor doesn't do 75Hz as a refresh rate and I can't tell it not to use a 24bit Z buffer anywhere.

So whatever, I left that and went for the only complete code example I could find which was the Advanced example. So I stuck that code in, changed all the right thing and ran it. - It did exactly the same thing, kicking up a fuss about Zdepth, resolution and LWJGL instances.

So I gave up and went off to see if I could run the examples that actually came with the engine. (Because I already knew the examples available from the website worked fine.)

I tried running all 4 examples and each .bat just opens and closes without making another window. - Running the .bats in cmd tells me the following:
Unable to load native library: Can't load IA 32-bit .dll on a AMD 64-bit platform
And as far as I'm aware, the .dlls for LWJGL on a 64bit system are in the natives\windows folder because they're the same ones I use on my other Java games (in Slick2D).

So now I'm stumped... I've tried following the tutorials, I've tried looking for an FAQ page, I've tried searching the forums for similar problems or a place for beginners, I've tried searching Google for similar problems.

I literally have no idea what I'm supposed to do to get jPCT to work. xD

Please halp. :D

System specs:
nVidia Geforce 9800GT
4gb DDR2 RAM
Java7 using Netbeans 7.0.1

Pages: [1]