Show Posts
|
Pages: [1]
|
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();} try { Display.setDisplayMode(new DisplayMode(640, 480)); Display.setVSyncEnabled(false); Display.setParent(this); 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-nbHowever 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?
|
|
|
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).
|
|
|
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.  Most of the time I just ran through the level, spamming attack if things got harry. It is very fun, good job. 
|
|
|
12
|
Game Development / Newbie & Debugging Questions / Efficient parsing?
|
on: 2013-04-02 17:28:40
|
http://pastebin.java-gaming.org/224c73c2b59This 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.
|
|
|
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
| 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);
|
|
|
|
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.  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. 
|
|
|
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?
|
|
|
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).
|
|
|
|
|
ivj94
(583 views)
2018-03-24 14:47:39
ivj94
(48 views)
2018-03-24 14:46:31
ivj94
(374 views)
2018-03-24 14:43:53
Solater
(62 views)
2018-03-17 05:04:08
nelsongames
(109 views)
2018-03-05 17:56:34
Gornova
(151 views)
2018-03-02 22:15:33
buddyBro
(693 views)
2018-02-28 16:59:18
buddyBro
(92 views)
2018-02-28 16:45:17
xxMrPHDxx
(493 views)
2017-12-31 17:17:51
xxMrPHDxx
(733 views)
2017-12-31 17:15:51
|
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
|
|