Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (482)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (550)
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
http://lwjgl.org/forum/topics/hi-vs-low-level-api-performance/5129/view.html

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
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
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.setVSyncEnabled(false);
   Display.setParent(this); //Magic.
  Display.create();
} catch (LWJGLException ex) {
   System.err.println("Display could not be created");
   ex.printStackTrace(System.err);
   System.exit(-1);
}


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:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
java.lang.Exception: Dangerous reflection access to sun.misc.Unsafe by class org.lwjgl.MemoryUtilSun$AccessorUnsafe detected!
[catch] at org.netbeans.TopSecurityManager.checkMemberAccess(TopSecurityManager.java:440)
   at java.lang.Class.checkMemberAccess(Class.java:2233)
   at java.lang.Class.getDeclaredFields(Class.java:1795)
   at org.lwjgl.MemoryUtilSun$AccessorUnsafe.getUnsafeInstance(MemoryUtilSun.java:74)
   at org.lwjgl.MemoryUtilSun$AccessorUnsafe.<init>(MemoryUtilSun.java:62)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
   at java.lang.Class.newInstance(Class.java:374)
   at org.lwjgl.MemoryUtil.loadAccessor(MemoryUtil.java:375)
   at org.lwjgl.MemoryUtil.<clinit>(MemoryUtil.java:63)
   at org.lwjgl.opengl.LinuxDisplay.setTitle(LinuxDisplay.java:759)
   at org.lwjgl.opengl.Display.setTitle(Display.java:541)
   at org.lwjgl.opengl.Display.createWindow(Display.java:312)
   at org.lwjgl.opengl.Display.create(Display.java:848)
   at org.lwjgl.opengl.Display.create(Display.java:757)
   at org.lwjgl.opengl.Display.create(Display.java:739)
   at Core.Main.run(Main.java:34)
   at java.lang.Thread.run(Thread.java:724)


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
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(LinuxDisplay.java:318)
   at org.lwjgl.opengl.LinuxContextImplementation.nSwapBuffers(Native Method)
   at org.lwjgl.opengl.LinuxContextImplementation.swapBuffers(LinuxContextImplementation.java:79)
   at org.lwjgl.opengl.ContextGL.swapBuffers(ContextGL.java:175)
   at org.lwjgl.opengl.DrawableGL.swapBuffers(DrawableGL.java:90)
   at org.lwjgl.opengl.Display.swapBuffers(Display.java:618)
   at org.lwjgl.opengl.Display.update(Display.java:646)
Caused: java.lang.RuntimeException
   at org.lwjgl.opengl.Display.update(Display.java:648)
   at org.lwjgl.opengl.Display.update(Display.java:628)
   at Core.Main.run(Main.java:93)
[catch] at java.lang.Thread.run(Thread.java:724)


GL HF
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 http://netbeans.dzone.com/lwjgl-nb
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) {
  Input
  UI
  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:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
if (cameraRot.x+mouseDX>=360) {
            cameraRot.x=cameraRot.x+mouseDX-360;
        } else if (cameraRot.x+mouseDX<0) {
            cameraRot.x=360-cameraRot.x+mouseDX;
        } else {
            cameraRot.x+=mouseDX;
        }
        if (cameraRot.y-mouseDY>=-90 && cameraRot.y-mouseDY<=90) {
            cameraRot.y+=-mouseDY;
        } else if (cameraRot.y-mouseDY<-90) {
            cameraRot.y=-90;
        } else if (cameraRot.y-mouseDY>0) {
            cameraRot.y=90;
        }


Also I would search up gimbal lock if your going to use euler angles (http://www.youtube.com/watch?v=zc8b2Jo7mno).
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: http://pastebin.java-gaming.org/4c7cb59245c
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: http://www.java-gaming.org/topics/noise-bandpassed-white/27071/view.html 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
http://pastebin.java-gaming.org/224c73c2b59
This is my Compatiblity.shader file, and I'm combining the .vert and .frag shaders into one file. My current code for parsing is:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
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();
            vertShader=createShader(
                    ((version.isEmpty()) ? "" : ("#version "+version))
                    + shader.substring(shader.indexOf("<VERT>")+6, shader.indexOf("</VERT>")), GL_VERTEX_SHADER);
            fragShader=createShader(
                    ((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:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
//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);
        glEnable(GL_DEPTH_TEST);
        if (GLVersion>=3.2) {glEnable(GL32.GL_DEPTH_CLAMP); ModernGL=true;}
        glDepthMask(true);
        glDepthFunc(GL_LEQUAL);
        glDepthRange(0, 1);
        glClearDepth(1);
        glEnable(GL_CULL_FACE);
        glCullFace(GL_BACK);
        glFrontFace(GL_CCW);
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: http://pastebin.java-gaming.org/3598a689842
This is what each object is, and where the mesh draw is called from.

Camera class: http://pastebin.java-gaming.org/598a8789247
Projection and view buffers

Main class: http://pastebin.java-gaming.org/98a8882974e
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
3GB RAM
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 (http://pastebin.java-gaming.org/b35985a9848) 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]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (14 views)
2014-08-22 19:31:30

atombrot (28 views)
2014-08-19 09:29:53

Tekkerue (25 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (15 views)
2014-08-16 06:20:21

Tekkerue (22 views)
2014-08-16 06:12:11

Rayexar (61 views)
2014-08-11 02:49:23

BurntPizza (39 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38
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!