Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (690)
Games in Android Showcase (200)
games submitted by our members
Games in WIP (764)
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  Discussions / General Discussions / Re: Library Performance vs. Stupid Mistake Friendly on: 2015-11-08 21:54:25
For your specific example, caching and passing the current thread id through underlying calls would all but remove the overhead.

Requiring the user to pass the current thread whenever they want to set the size of the window seems a little messy.

Yuck!

This doesn't seem the sort of thing that should be polluting your API.  What about using assertions instead?  These sort of checks sound like the sort of thing that should be switched off in "production" code anyway.

I already use assertions through my code to verify if the values they enter are valid and not null. I am not sure if there is a better way to do it, but currently i just do something like
1  
Assert.nonNull(value, message);
which throws a NullPointerException if the value is null and
1  
Assert.isTrue(value, message)
which throws an IllegalArgumentException if the value is false.

Hi

Hiding the NIO buffer is a bad idea especially with the library that you'd like to wrap, it requires direct NIO buffers for numerous calls, they aren't backed by a Java array by default, you would double the memory footprint with that.

I agree with nsigma's suggestion, it's a good compromise, it doesn't force the developer to pass the thread.

I have not delved into the OpenGL part of the library, but the other parts such as GLFW require quite small buffers, the largest being the GammaRamp. Most of the buffers used are for structs, which are not friendly to use, so i convert them into another object which is easier to use. The other times buffers are used are when they need more than one variable to be returned, such as count or width and height.

Although i have not looked into OpenGL much, i imagine it is the part which uses a huge amount of buffers for sending vertex, color or image information to the graphics cards. I do not plan on removing that use of buffers as they make sense for the situation.
2  Discussions / General Discussions / Re: Library Performance vs. Stupid Mistake Friendly on: 2015-11-08 08:30:01
For your specific example, caching and passing the current thread id through underlying calls would all but remove the overhead.

Requiring the user to pass the current thread whenever they want to set the size of the window seems a little messy.
3  Discussions / General Discussions / Library Performance vs. Stupid Mistake Friendly on: 2015-11-08 07:28:11
Hey,

I am making a simple wrapper for LWJGL that wraps some of the functionality to make it easier to use. Basically to make it into more of your traditional and preferred object-oriented format instead of many static function calls and un-conventional data types (Like ByteBuffer instead of byte[]).

Now the dilemma i am facing is how much should i move to correct people's errors in using the library, the tossup being performance vs debugging ease.

For example, many of the GLFW window handling methods should only be ran on the main thread. I could check if the current thread is the main thread,  but this is a little bit of an expensive call, not hugely, but a little bit.

I don't want to go too bare bones, then people might as well just be using LWJGL directly, but i still want it to perform very well.

Just was wondering what other people thought was a good sweet spot between performance and convenience.
4  Game Development / Newbie & Debugging Questions / Re: [LWJGL] [GLFW] ImageIO.read stalling and glitching with GLFW use on: 2015-11-06 10:46:29
Ah ok, good to know Smiley
5  Game Development / Newbie & Debugging Questions / Re: [LWJGL] [GLFW] ImageIO.read stalling and glitching with GLFW use on: 2015-11-06 09:58:02
Ah cool, thankyou, works perfectly now!  Smiley

I know this will probably be extremely newbie but could you explain to me/link me to another post explaining why AWT and GLFW cannot both be used simultaneously? Is there a conflict issue with the natives?
6  Game Development / Newbie & Debugging Questions / [Solved] [LWJGL] [GLFW] ImageIO.read stalling and glitching with GLFW use on: 2015-11-06 00:55:53
I have been making a lwjgl object-oriented wrapper just for fun and have hit a bit of a snag.

To test setting the cursor i have been trying to load a cursor image, but it isn't working.

When i try to load the image after creating my window, it stalls on ImageIO.read.

When i try to load the image before creating my window, it glitches and doesn't let me focus on the window. One thing i have noticed is that the application doesn't show up in my open applications bar (don't know the name, i'm on a mac) when i do this, but eclipse still shows it as running.

When i try to load the image in another thread started before i create the window it does the same as the first time, it stalls and never loads. The window is also never created.

When i try to load the image in another thread started after i create the window it does the same thing as the first time, it stalls and never loads.

It seems like using
1  
new Thread() {...}.start()

Isn't actually starting a new thread.

There are no errors, i do have a GLFWErrorCallback set up, and i do know that is working, but it is not throwing any errors either.

Here is my code to load the image:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
new Thread() {
         public void run() {
            try {
               System.out.println("Testing... Testing...");
               
               System.out.println("1");
               URL url = new URL("http://orig13.deviantart.net/410c/f/2012/010/a/4/sniper_cross_hairs_cursor_by_parodyskillz-d4lxmpf.png");
               
               System.out.println("2");
               ImageIO.read(url);
               
               System.out.println("3");
               System.out.println("success");
            } catch (IOException e) {
               e.printStackTrace();
            }
         }
      }.start();

Do note, this does work when i run this code in a fresh project with nothing in it.

My other code is too large to post here, so i will post what i think is relevant.

on startup:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
if(glfwInit() != GL_TRUE) {
         Error.fatal("Error initalizing GLFW", this);
      }
     
      Error.registerGLFWErrorCallback();
      Monitor.registerMonitorCallback();
     
      ShutdownHandler.addDisposable("Game", this);
     
      window = Window.create(640, 400, "Cool Window", null, null, null);
     
      window.getCreationHints().setResizable(true);
     
      window.init();
     
      start();


window.init()
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
if(exists()) {
         throw new UnsupportedOperationException("Window is already initialized");
      }
     
      creationHints.apply();
     
      windowId = glfwCreateWindow(creationWidth, creationHeight, title, creationMonitor.getId(), share.getId());
     
      if(windowId == NULL) {
         Error.fatal("Error creating window", this);
      }
     
      add(this);
     
      makeCurrent();
      glfwSwapInterval(1);
     
      this.keyInput = new KeyInput(this);
      this.mouseInput = new MouseInput(this);
      this.windowInput = new WindowInput(this);


I am using the VM Argument -XstartOnFirstThread.

I would really appreciate if someone could help me figure this out, it is extremely frustrating.
7  Games Center / Showcase / Re: Plague on: 2013-03-16 00:59:04
Hey guys, i was bored so i spent about half an hour working on the graphics. Its been a while since i've worked on this project and looking back over my code is not a pretty sight. Heres what i added:
+ blood splatter
+ vomitting - infected humans will now vomit and when a human who is not infected touches it it will get infected.
8  Games Center / WIP games, tools & toy projects / Re: Space on: 2012-10-11 01:04:50
doesnt work on mac  Cranky
9  Games Center / Showcase / Re: Polygon Skirmish on: 2012-10-10 04:41:09
i get this error when running

Exception in thread "main" java.lang.UnsupportedClassVersionError: Window : Unsupported major.minor version 51.0
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
   at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
   at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
   at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

im on a mac osx 10.7.4 and i use java se 6
10  Game Development / Newbie & Debugging Questions / Re: When i load my file everything inside the class is null? on: 2012-10-10 03:47:34
so yes it is serializable

btw it works without transient just that the array list is empty
11  Game Development / Newbie & Debugging Questions / Re: When i load my file everything inside the class is null? on: 2012-10-10 03:46:55
i imported point from java.awt.Point
12  Game Development / Newbie & Debugging Questions / Re: When i load my file everything inside the class is null? on: 2012-10-10 02:12:12
so i shouldnt use it? but im pretty sure when i dont use it i get a not serializable error
13  Game Development / Newbie & Debugging Questions / When i load my file everything inside the class is null? on: 2012-10-10 00:43:17
so i have a class SaveLevel and i save it fine but when i try to load it again everything inside the class is null?

SaveLevel class
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
public class SaveLevel  implements Serializable{
   
   static final long serialVersionUID = 99999999999999L;
   
   transient public ArrayList<Point> path = new ArrayList<Point>();
   transient public String imagePath;
   
   public SaveLevel(String imagePath){
      this.imagePath=imagePath;
   }
   
}


Loading Script
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
Level level = null;
      SaveLevel sLevel = null;
     
      ObjectInputStream ois;
      try {
         ois = new ObjectInputStream(getClass().getResourceAsStream(url));
         sLevel = (SaveLevel) ois.readObject();
         ois.close();
      } catch (FileNotFoundException e) {
         e.printStackTrace();
      } catch (IOException e) {
         e.printStackTrace();
      } catch (ClassNotFoundException e) {
         e.printStackTrace();
      }
     
      System.out.println(sLevel.imagePath);
      System.out.println(sLevel.path);
14  Game Development / Newbie & Debugging Questions / Re: How to get the angle from 1 point to another on: 2012-10-10 00:38:38
sorry for not replying Tongue

i am not using anything except the api that i made myself
15  Game Development / Newbie & Debugging Questions / Re: How to get the angle from 1 point to another on: 2012-10-09 02:16:22
thanks! i havent tested yet but should it be y2-y1?
16  Game Development / Newbie & Debugging Questions / How to get the angle from 1 point to another on: 2012-10-08 23:34:02
i know this probable takes trigonometry or calculus or something complicated but i haven't done anything like that yet...  i haven't even done sin and cos. so how would i go about finding the angle?

E.g.
point1(0,0) and point2(1,1)

that angle would be -45 degrees or 315 degrees

so if you have a formula can you please show it to me and ill be very grateful. this is not a school project by the way

if there is an easier way basicly i want to make an image(of a gun) point towards another image(of a mob)
17  Games Center / Showcase / Re: Plague on: 2012-10-07 03:23:53
any ideas how i can stop the flickering i went on ra4king's link but thats about audio? i think that must of been about something else
18  Games Center / WIP games, tools & toy projects / Re: Auctus[0.1] on: 2012-09-29 23:30:01
doesnt run for me Sad i get this error

Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
   at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1758)
   at java.lang.Runtime.loadLibrary0(Runtime.java:823)
   at java.lang.System.loadLibrary(System.java:1045)
   at org.lwjgl.Sys$1.run(Sys.java:73)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
   at org.lwjgl.Sys.loadLibrary(Sys.java:95)
   at org.lwjgl.Sys.<clinit>(Sys.java:112)
   at org.lwjgl.opengl.Display.<clinit>(Display.java:132)
   at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
   at auctus.Auctus.main(Auctus.java:204)
19  Games Center / Featured Games / Re: Overbind on: 2012-09-29 22:57:14
doesnt let me turn around...
20  Games Center / Showcase / Re: Plague on: 2012-09-29 22:16:41
seems like there is a problem loading the sounds Tongue ill try to fix it but im off soonish to the australian basketball nationals for a week.
Its weird though because it works for me (im on a mac if that makes a difference)
21  Games Center / Showcase / Plague on: 2012-09-29 12:34:21
Download]

This is my fun but simple game that i have made. It is probably my first finished game (with graphics and sounds).

Screenies Grin:
- Main Menu


-Game


have a go and...
Download

[size=15pt]Post your highest scores below![/size]
Pages: [1]
 
Wave Propagation (216 views)
2016-09-20 13:29:55

steveyg90 (329 views)
2016-09-15 20:41:23

steveyg90 (329 views)
2016-09-15 20:13:52

steveyg90 (366 views)
2016-09-14 14:44:42

steveyg90 (393 views)
2016-09-14 14:42:13

theagentd (426 views)
2016-09-12 16:57:14

theagentd (361 views)
2016-09-12 14:18:31

theagentd (294 views)
2016-09-12 14:14:46

Nihilhis (726 views)
2016-09-01 13:36:54

roseslayer (1294 views)
2016-08-06 11:43:29
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21
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!