Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (595)
Games in Android Showcase (169)
games submitted by our members
Games in WIP (647)
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 / Engines, Libraries and Tools / Re: Netbeans RCP + LWJGL on: 2013-08-02 16:17:35

Reported bug on lwjgl forum. I will get this to work.
2  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Netbeans RCP + LWJGL on: 2013-08-02 14:43:08
Self reply incase anyone googles this.
Got it working!

To make LWJGL work with the Netbeans RCP Platform create a class that extends java.awt.Canvas
In the constructor put
while (!isDisplayable()) {Thread.yield();} //This is the magical line that took me a week to figure out, a little hacky
try {
   Display.setDisplayMode(new DisplayMode(640, 480));
   Display.setParent(this); //Magic.
} catch (LWJGLException ex) {
   System.err.println("Display could not be created");

Then create and add the canvas to your module. If your using the netbeans GUI designer make sure there is a no argument constructor in your canvas and go to Tools>Add to Palette and choose your canvas from project etc (If you have the file open in the editor it will ask which category to put the file in, netbeans is awesome).

I get some handled exceptions when I run it, but it runs fine regardless. E.g:
java.lang.Exception: Dangerous reflection access to sun.misc.Unsafe by class org.lwjgl.MemoryUtilSun$AccessorUnsafe detected!
[catch] at org.netbeans.TopSecurityManager.checkMemberAccess(
   at java.lang.Class.checkMemberAccess(
   at java.lang.Class.getDeclaredFields(
   at org.lwjgl.MemoryUtilSun$AccessorUnsafe.getUnsafeInstance(
   at org.lwjgl.MemoryUtilSun$AccessorUnsafe.<init>(
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
   at java.lang.reflect.Constructor.newInstance(
   at java.lang.Class.newInstance(
   at org.lwjgl.MemoryUtil.loadAccessor(
   at org.lwjgl.MemoryUtil.<clinit>(
   at org.lwjgl.opengl.LinuxDisplay.setTitle(
   at org.lwjgl.opengl.Display.setTitle(
   at org.lwjgl.opengl.Display.createWindow(
   at org.lwjgl.opengl.Display.create(
   at org.lwjgl.opengl.Display.create(
   at org.lwjgl.opengl.Display.create(

org.lwjgl.LWJGLException: X Error - disp: 0x7fc54c38cac0 serial: 8409 error: BadDrawable (invalid Pixmap or Window parameter) request_code: 153 minor_code: 8
   at org.lwjgl.opengl.LinuxDisplay.globalErrorHandler(
   at org.lwjgl.opengl.LinuxContextImplementation.nSwapBuffers(Native Method)
   at org.lwjgl.opengl.LinuxContextImplementation.swapBuffers(
   at org.lwjgl.opengl.ContextGL.swapBuffers(
   at org.lwjgl.opengl.DrawableGL.swapBuffers(
   at org.lwjgl.opengl.Display.swapBuffers(
   at org.lwjgl.opengl.Display.update(
Caused: java.lang.RuntimeException
   at org.lwjgl.opengl.Display.update(
   at org.lwjgl.opengl.Display.update(
[catch] at

3  Java Game APIs & Engines / Engines, Libraries and Tools / Netbeans RCP + LWJGL on: 2013-07-30 14:16:54
Hi, I've been working on a game engine. It uses the LWJGL, Artemis Entity Component System, and TWL Gui libraries. I have a fully working entity component based engine that loads and renders 3d models with modern gl (VBO GLSL based). However I want to put it into a netbeans rcp platform module.
The only resource I can find on this is
However this causes problems with input and TWL, not to mention AWTGLCanvas was deprecated due to Display.setParent. But that causes a Display parent must be displayable error.
Any ideas?

Extra info: I complied my engine into a jar and imported it, LWJGL, TWL, Artemis all as wrapped jars. Natives are loaded with System.loadNatives
4  Game Development / Newbie & Debugging Questions / LWJGL GUIs on: 2013-07-08 20:06:22
Alright so I'm searching for a gui library to work with lwjgl, and I know there are a plenty thanks to google. But what I want to know is which one is right for me. I need a tree display object (Like JTree), resizeable containers (Like netbeans, or visual studio), menu bars, and is documented and up to date. Any recommendations?
Last time I tried swing+lwjgl they fought over taking exclusive control of the input devices.
5  Game Development / Newbie & Debugging Questions / Entity Component Systems on: 2013-04-04 19:55:50
Ok so I'm trying to create a entity component system to store general game objects.
I created my abstract entity class that has parent/children/name variables and basic methods for managing hierarchy models.
Then I have my abstract updatable class which when update() is called will call update of it's children, and their children, down the model.
Then I tried making an Asset class, of which some classes (Mesh, Shader, Image, UITheme) will extend but it has been a over all messy pain.

I'm going to redesign the entire thing, as it's just not flexible enough.
MasterEntity(Will have name/children but no parent) {
  Scene(Will store entities)
  Entity(Will have parent) {
    Asset(Will be a actual file) {
      Shaders, Meshes, Images, UIThemes
    GameObject(Adds update() and tranforms) {
       Components {Matter, Cameras, Particle Emitter, Ridgidbody, etc}

Anyone have any good links?
How does the diamond operator work, and should I use it?
Should I make these extend, or make interfaces, or what?
6  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [Public Domain] UN project, General purpose library, 2D, 3D and anything else on: 2013-04-04 18:36:12
Are you able to compile a plug and play library jar?
I'm using the latest oracle java with netbeans on ubuntu 12.04, and I can run/profile/debug just fine, but I can't build; It complains about JDK_HOME being wrong, even though I manually set it in the netbeans.conf. I have no idea how ant/maven/javac/any of that stuff works really to fix it myself.  Undecided
7  Game Development / Newbie & Debugging Questions / Re: Euler angles/3D rotation problem on: 2013-04-03 23:38:25
Make sure that it's not rotating above 360, and also for the look up/look down make sure you limit the angle to 89/179 or the tan function will glitch.

For example in my camera:
if (cameraRot.x+mouseDX>=360) {
        } else if (cameraRot.x+mouseDX<0) {
        } else {
        if (cameraRot.y-mouseDY>=-90 && cameraRot.y-mouseDY<=90) {
        } else if (cameraRot.y-mouseDY<-90) {
        } else if (cameraRot.y-mouseDY>0) {

Also I would search up gimbal lock if your going to use euler angles (
8  Game Development / Newbie & Debugging Questions / Re: Euler angles/3D rotation problem on: 2013-04-03 21:13:57
Here you can use one of my old camera's for reference:
The big problem with that one though is that is recalculates the matrix every frame, you should have a camera.setPosition/Rotation which sets a boolean flag to true, then when the update is called if the boolean flag is true update the matrix, that will save performance.
9  Games Center / Featured Games / Re: Heroes of Loot on: 2013-04-03 21:02:57
I got to level 11, but then a opening/closing wall crushed me. Sad
Most of the time I just ran through the level, spamming attack if things got harry.
It is very fun, good job.  Grin
10  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [Public Domain] UN project, General purpose library, 2D, 3D and anything else on: 2013-04-03 20:52:20
OMO I would love the image, 3d model, sound loading; As I have been trying to make those myself (Mostly successfully but slowly). I will definitely try it out, and try to support (Although I doubt I will be much help).  Wink
11  Game Development / Game Mechanics / Re: World generation questions on: 2013-04-02 19:40:21
Perlin noise.

Edit: Here's a link to a guide to noise on this website
12  Game Development / Newbie & Debugging Questions / Efficient parsing? on: 2013-04-02 17:28:40
This is my Compatiblity.shader file, and I'm combining the .vert and .frag shaders into one file. My current code for parsing is:
String shader=AssetHandler.readFile(path+".shader");
            String version=shader.substring(
                    (shader.indexOf("<VERSION>")==-1) ? 0 : shader.indexOf("<VERSION>")+9,
                    (shader.indexOf("</VERSION>")==-1) ? 0 : shader.indexOf("</VERSION>")).trim();
                    ((version.isEmpty()) ? "" : ("#version "+version))
                    + shader.substring(shader.indexOf("<VERT>")+6, shader.indexOf("</VERT>")), GL_VERTEX_SHADER);
                    ((version.isEmpty()) ? "" : ("#version "+version))
                    + shader.substring(shader.indexOf("<FRAG>")+6, shader.indexOf("</FRAG>")), GL_FRAGMENT_SHADER);

Is this ok? I feel like it could be a lot cleaner and nicer. I'm going to add a <varying> tag next.
13  Game Development / Game Mechanics / Re: Smooth Graphics Algorithm? on: 2013-04-02 16:17:35
Would mipmapping with trilinear/anisotropic work here? Also how do you get the Memory Allocated?
14  Game Development / Newbie & Debugging Questions / Re: OpenGL states at start on: 2013-04-02 13:45:48
What is ARB? I see it everywhere all the time. Some kind of compatibility layer?
15  Game Development / Newbie & Debugging Questions / OpenGL states at start on: 2013-04-01 20:31:31
What should I set the OpenGL states too when I start the program?

My current code:
//Initialize OpenGL
        System.out.println("OpenGL version: "+glGetString(GL_VERSION));
        GLVersion=Float.valueOf(glGetString(GL_VERSION).split(" ")[0]);
        glClearColor(0.1f, 0.1f, 0.2f, 0f);
        if (GLVersion>=3.2) {glEnable(GL32.GL_DEPTH_CLAMP); ModernGL=true;}
        glDepthRange(0, 1);
16  Game Development / Newbie & Debugging Questions / Re: LWJGL canvas in Swing app - resize problems on: 2013-04-01 20:29:42
I did that, once I used a atomic reference to the window size and updated the viewport/projection when needed. However there was a bug where if you gave input to the lwjgl area it would hog the input from swing, is that fixed now?
17  Game Development / Newbie & Debugging Questions / Fastest way to load a file into a ArrayList? on: 2013-03-28 03:05:18
I'm trying to load a 3.4MB file into a collection of some sort, where calling index 5 would return line 5 of the file. Also clean up such as removing whitespace and empty lines. My current code is a buffered reader that's throwing everything into a single string, which then later gets split into the ArrayList. The first thing I tried (Scanner line by line) made it take like 10 minutes to load; Now it's around 2-5.

What's better for reading a file that's going to be parsed? Scanner, BufferedReader, ByteReader?
What's the best way to turn a large string into a collection?
18  Java Game APIs & Engines / OpenGL Development / Re: Why is/are my VBO(s) so slow? on: 2013-03-25 19:33:57
Ok, at native resoultion it is the same frame rate so it's just the video card being weak, not me.  Wink
I only used that ObjLoader because it was the only one I could find that worked, and I have no idea how to do it myself (What's an indice?). I do not have much experience with this stuff (learning from trial and error, which means if it works I use it). This forum is friendly, quick, and helpful; I think it will become one of my go to places. Thank you.  Smiley
19  Java Game APIs & Engines / OpenGL Development / Re: Why is/are my VBO(s) so slow? on: 2013-03-25 18:37:56
Ok so it's my GPU not my code that's causing it to be slow? (Commenting out glDrawArrays brought it up to the 60 cap)
Nice to know. Also nice explanations of vertex buffers. So with vertex buffers you can calculate exactly how many bytes you want to buffer to the shader, and separate them into attributes?
20  Java Game APIs & Engines / OpenGL Development / Re: Why is/are my VBO(s) so slow? on: 2013-03-25 13:55:48
Matter class:
This is what each object is, and where the mesh draw is called from.

Camera class:
Projection and view buffers

Main class:
Did I do depth and culling correctly?

Matter extends Updatable which extends Entity, which gives the objects children/parents; a hierarchy structure.
When update is called on the root object it recurses through the family tree.

I am not absolutely sure of how vertex buffers even work, just how to use them in a way.

Edit: Moved glEnableVertexAttribArray into the VBO instead of every draw, not much different but works. Thanks to agentd.
Also where is layman's documentation on what stride and offset do?
21  Games Center / WIP games, tools & toy projects / Re: Wizards of Yore (second try) on: 2013-03-25 13:47:16
I absolutely love the art style! My pixel art looks like corrupted video ram.
22  Java Game APIs & Engines / OpenGL Development / Re: Why is/are my VBO(s) so slow? on: 2013-03-25 13:27:30
On my test rig (Testing on low end first)
AMD Athlon 2 1.6Ghz
Radeon x1200
6-10 Frames per second (Using my own and TWL's counter)
When profiled with netbeans (Game loop commented to not loop) glDrawArrays is 1056 ms (51% of the loop time).
Edit: I run at 60FPS when glDrawArrays alone is commented out.

My main computer, built for gaming runs it at the capped 60 (3Ghz Phenom II, Radeon HD 4870, 4GB RAM).
It does have shaders but it's a simple proj*model*view*vertex glFrag=1,1,1.
I would like to run this on low end systems better. I'm not very good at optimization.
23  Java Game APIs & Engines / OpenGL Development / Why is/are my VBO(s) so slow? on: 2013-03-25 13:03:38
I am rendering around 5000 objects. My mesh class ( which loads .obj files and creates a VBO for them is only instanced once (it loads Cube.obj), then the draw method is called whenever one of these object's update method is called. I gained a bit of performance by moving the buffers to the objects and only updating them if the objects position/orientation changes. Am I just doing it wrong?

Also if you could tell me how to change the loading code from BufferedReader(Faster for line by line) to Scanner (Faster for parsing).
Pages: [1]
KaiHH (5 views)
2015-07-07 11:39:58

deepthought (54 views)
2015-06-30 15:39:44

deepthought (57 views)
2015-06-30 15:39:09

deepthought (65 views)
2015-06-30 15:36:52

Za\'Anzabar (44 views)
2015-06-29 05:44:54

TritonDreyja (50 views)
2015-06-24 17:10:40

CopyableCougar4 (52 views)
2015-06-23 00:34:45

BurntPizza (58 views)
2015-06-21 20:36:46

cookiecompiler (99 views)
2015-06-11 15:42:53

cookiecompiler (58 views)
2015-06-11 15:41:14
How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14 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‑
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!