Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (429)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (468)
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] 2
1  Discussions / General Discussions / Re: Per pixel lighting / shading systems... on: 2013-06-24 18:39:32
I've started a new one with libGDX now so let's see how it goes
2  Discussions / General Discussions / Re: Per pixel lighting / shading systems... on: 2013-06-24 16:00:16
why'd I bother getting used to Slick lol seems useless now lol, could you give me some information about it or links please?
3  Discussions / General Discussions / Per pixel lighting / shading systems... on: 2013-06-24 15:57:28
They possible with Slick? I've been trying to fix mine for over an hour now..
Downloaded new lwjgl, can't find a new Slick though.
Just can't seem to get Image graphics from the players image (or any other image), which means I can't alter my images for shading..
Is there any way around this? Cause every time I try get the image's graphics with image.getGraphics(); it throws a null, I've also had this error;
Quote
java.lang.RuntimeException: No OpenGL context found in the current thread.
   at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124)
   at org.newdawn.slick.opengl.pbuffer.GraphicsFactory.init(GraphicsFactory.java:40)
   at org.newdawn.slick.opengl.pbuffer.GraphicsFactory.createGraphics(GraphicsFactory.java:120)
   at org.newdawn.slick.opengl.pbuffer.GraphicsFactory.getGraphicsForImage(GraphicsFactory.java:91)
   at org.newdawn.slick.Image.getGraphics(Image.java:397)
   at org.background.worker.Shader.doInBackground(Shader.java:60)
   at org.background.worker.Shader.doInBackground(Shader.java:1)
   at javax.swing.SwingWorker$1.call(Unknown Source)
   at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at javax.swing.SwingWorker.run(Unknown Source)
   at org.background.LightProcessor.run(LightProcessor.java:36)
   at java.util.TimerThread.mainLoop(Unknown Source)
   at java.util.TimerThread.run(Unknown Source)

I've tried making the images on the initialization too.

Opinions?
4  Game Development / Game Mechanics / Re: Braid-like time reversal on: 2012-03-02 14:05:21
ah, just an idea never tried it before (:
5  Game Development / Game Mechanics / Re: Braid-like time reversal on: 2012-03-02 13:44:23
could reverse time while you have created snapshots of a few variables (jumping, falling, speed, etc)
then reverse the process with the variables activating at the time they activated.
Just an idea.
I might attempt this at some point (:
6  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-03-02 12:37:18
Not really sure what else there is to say everything else works and this would be simple in java2d.

There is a converter but then I would have to convert back lol

Peace
7  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-02-20 13:57:50
Stilll not fixed!

Peace..
8  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-02-12 22:07:01
*FACEPALM* Of course!

@OP
You're loading that image from another thread! You should do everything on the same thread as the rendering thread and after the GL Context has been initialized Tongue

Surprisingly I already thought of it but never did try it, I'll just make a trigger or something that I can set in that thread then activate in the other thread.

Nice one mate (:

EDIT:
Wait don't know if that'll work because I tried getting graphics of a Image in render() and it makes the game freeze.
So strange... :/
9  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-02-11 16:55:58
This is line 40 in GraphicsFactory:
1  
fbo = GLContext.getCapabilities().GL_EXT_framebuffer_object;


I have no idea how a NullPointer can be thrown there, unless this is an LWJGL bug where GLContext.getCapabilities() returns null.

Exactly what I mean, the error is totally confusing and shouldn't happen its a pretty simple procedure I'm trying and I have tried several ways around which have also failed.

I can't paste anymore code neither cause I ain't at home.
Would really appreciate it if somebody could figure this out. Smiley
Peacee
10  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-02-11 13:11:20
Just rolled out of bed so I could be wrong/late.

Define the variable you'd like to use to connect a image to "Sprite".
Define the image/path, than link it to that Sprite variable.
Than render that Sprite variable after linking the Image to it.
1  
2  
3  
4  
5  
6  
7  
public BufferedImage Sprite;
public ImageIcon player = new ImageIcon("path/to/file.png");

   public void paint(Graphics g) {
      Sprite = player.getImage();
      g.drawIage(Sprite, 20, 20, null);
   }


Hope it helps some Smiley
Its slick not java 2d mate.

And i'll edit my thread with sscce in a minute.

edit; updated.
11  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-02-10 15:18:52
This is in render and the image is created in init()



Window is crashed..
12  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-02-10 14:50:55
First of all I'd like to say that I'm a complete newbie. Perhaps that's why I find something odd in the next piece of code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
try {
    Image image = null;
    try {
        image = new Image(256,256);
    } catch (SlickException se) {se.printStackTrace();
}

//This is the line I'm talking about. What's the purpose of this?
image.getScaledCopy(player.getIcon.getWidth(), player.getIcon.getHeight());

Graphics g = image.getGraphics();
Image pixel = null;


You're not setting another Image with the return of getScaledCopy(). Does this method sets 'image' to it's scaled copy?

Anyway I don't think it has something to do with your problem. But I do think that it might be a variable scope problem. Have you tried creating the 'image' outside the method and initializing it inside?



Oh no that was an accident I forgot to put image = image.getScaledCopy().
Yeah the image I have tried that the image in first post is made in init().
Yet again I'm just not sure what's going on, should be simple.
13  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-02-10 13:37:36
Ooops, I forgot you are using Slick. I have never used it (except for the utils to load PNG textures).

Some random things that probably wont work (sorry :-():
  • Do you try to create the image AFTER this.getApp().start() is called?
  • The init() method is of a class inherited from org.newdawn.slick.BasicGame? Although I don't think it's relevant for this error, you could append the @Override tag to it, so you get a warning if it doesn't override for some reason.
  • If your class is inherited from *.BasicGame, do you call the super() constructor on your constructor?
Yeah I create after this.getApp().start() and the init method of that is not thats in Main which has the superclass BasicGame and it is calling Super(String).
Really not sure, if I was in java2d this would be easy.
But slick is awesome ¬.¬
14  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-02-10 13:18:14
Is your OpenGL context created? I think with LWJGL you have to call Display.create(), but it is some time since I last used it.

Other thing I could think of is enabling textures in OpenGL:
1  
import org.lwjgl.opengl.GL11.glEnable(GL11.GL_TEXTURE_2D);


Tried both don't seem to work.
This my initialize method;

15  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-02-10 12:59:52
Well I updated my LWJGL from 2.8.3 - 2.8.4 and downloaded (newer?) version of Slick.
Still doesn't work :/




Help?
16  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-02-10 12:45:29
I thought I was I'll download new LWJGL
Thanks mate.
17  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-02-10 00:16:32
Pretty sure and I've tried different constructors of Image and even images that I know work.
When I try get Graphics from the players icon that would throw a null too.

Even the graphics I use to paint the images if I try setting that and using it there it still doesn't work.
Rather confusing me.
18  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-02-10 00:02:55
Was just trying to create a blank Image eg new Image(256, 256) to draw graphics on and create a image.
The image is throwing a null at the moment but the graphics also does.
I don't get what's happening the principle is simple.
I've tried numerous different ways, ImageBuffer, loading a actual Image it all seems to be obsolete.



Peace
19  Game Development / Newbie & Debugging Questions / Problem with Slick 2d Image / Graphics on: 2012-02-09 23:40:06
Hey, trying to create a simple new Image, blank, then add the graphics altered from another image and replace it with the image just made.

Sounds simple but when I've been trying to create a new image or even access any Images graphics its not been working, throwing a null error every time, real confused at this been wrecking my brain for past hour or two.

EDIT:
this is shader class with the problem in it:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
package org.background.worker;

import java.util.Iterator;

import javax.swing.SwingWorker;

import org.background.LightProcessor;
import org.model.World;
import org.model.emitters.Emitter;
import org.model.emitters.Light;
import org.model.player.Player;
import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
/**
 * Shader, for lighting.
 * @author Senior
 */

public class Shader extends SwingWorker<World, Void> {

   private LightProcessor processor = null;
   
   public LightProcessor getProcessor() {
      return processor;
   }

   public void setProcessor(LightProcessor processor) {
      this.processor = processor;
   }

   public Shader(LightProcessor processor) {
      this.setProcessor(processor);
   }

   @Override
   protected World doInBackground() throws Exception {
      if(processor.getWorld() == null)
          return null;
      World world = this.getProcessor().getWorld();
      Player player = world.getPlayer();
      if(player == null)
         return null;
      if(world.getLightEmitters().size() > 0) {
         for(Iterator<Emitter> it$ = world.getLightEmitters().descendingIterator(); it$.hasNext();) {
            Light l = (Light) it$.next();
            if(l == null)
               continue;
            if(!l.getPosition().isWithin(player.getPosition(), (int)l.getRange()))
               continue;
            if(player.getIcon() == null)
               continue;
           
            try {
               Image image = null;
               image = world.getBlank();
               if(image == null)
                  continue;
               image = image.getScaledCopy(player.getIcon().getWidth(), player.getIcon().getHeight());
               if(image == null)
                  continue;
               //Next line is problem line.
              Graphics g = image.getGraphics();
               if(g == null)
                  continue;
               Image pixel = null;
               
               for(int h = 0; h < player.getIcon().getHeight(); h++) {
                  for(int w = 0; w < player.getIcon().getWidth(); w++) {
                     pixel = player.getIcon().getSubImage(w, h, 1, 1);
                     g.drawImage(pixel, w, h, Color.red);
                  }
               }
               
               player.setIcon(image);
            } catch(Exception e) {
               e.printStackTrace();
            }
         }
      }
      return world;
   }
   
}

In theory it should work but can't find the graphics here is the error:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
java.lang.NullPointerException
   at org.newdawn.slick.opengl.pbuffer.GraphicsFactory.init(GraphicsFactory.java:40)
   at org.newdawn.slick.opengl.pbuffer.GraphicsFactory.createGraphics(GraphicsFactory.java:120)
   at org.newdawn.slick.opengl.pbuffer.GraphicsFactory.getGraphicsForImage(GraphicsFactory.java:91)
   at org.newdawn.slick.Image.getGraphics(Image.java:397)
   at org.background.worker.Shader.doInBackground(Shader.java:62)
   at org.background.worker.Shader.doInBackground(Shader.java:1)
   at javax.swing.SwingWorker$1.call(Unknown Source)
   at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at javax.swing.SwingWorker.run(Unknown Source)
   at org.background.LightProcessor.run(LightProcessor.java:37)
   at java.util.TimerThread.mainLoop(Unknown Source)
   at java.util.TimerThread.run(Unknown Source)

And here is where the Image 'blank' is set:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public World(Main main) {
      this.setMain(main);
      //Set up workers.
     this.setProcessor(new Processor(this));
      this.setLightProcessor(new LightProcessor(this));
     
      try {
         this.setBlank(new Image("./data/blank.png", false, Image.FILTER_LINEAR));
....
      } catch(SlickException e) {
         e.printStackTrace();
      }
   }

The world is initialized in the init() method of Main extends BasicGame.

Any ideas?

Peace.
20  Games Center / Archived Projects / Re: Super Mario Remake, started a-new. on: 2012-02-09 20:37:37
Thread updated with new video and todo.

Peace.
21  Games Center / Showcase / Re: 2D Action RPG and Platformer (Code named LeadCrystal) on: 2012-02-09 16:50:18
Looks pretty damn good so far mate, good luck!

I've been wanting to make dynamic shadows when I make a new lighting system.
Did you say you've been working on this 4 month?

Not exactly... I think I say that since our last tech video, it's been 4 months, and we've progressed a lot since then.  The project itself is much older than that, roughly a year and four months.  Although we took a 4 month hiatus at one point, and we didn't have openGL until last august, which blew open tons of doors in terms of what we could do.  When we started out we knew basically nothing so we used Java2D, which hindered our capabilities a lot.

Cool mate must have been a lot of effort i started using java2d nowadays I use slick and opengl, just finished my hill physics.
I fancy doing dynamic lighting but it'll be a right effort.
22  Games Center / Showcase / Re: 2D Action RPG and Platformer (Code named LeadCrystal) on: 2012-02-09 11:38:51
Looks pretty damn good so far mate, good luck!

I've been wanting to make dynamic shadows when I make a new lighting system.
Did you say you've been working on this 4 month?
23  Discussions / Miscellaneous Topics / Re: [Super Mario 2D RPG Platformer Project] on: 2012-02-09 11:34:40
If you're talking about my Mario remake I'm making yeah But goodluck my friend (:
24  Games Center / Archived Projects / Re: Super Mario Remake, started a-new. on: 2012-02-07 00:42:21
Thread has been updated with a new video.
Started remaking the side scroller.

Peace.
25  Games Center / Archived Projects / Re: Unnamed SideScroller; Wall kicking & more (: on: 2012-02-03 01:42:06
Pixel perfect slopes added (:

Peace
26  Games Center / Archived Projects / Re: Unnamed SideScroller; Have a look. ;) on: 2012-01-27 22:43:41
The tags on your youtube video

Quote
Wall Kick (INXS Album) Kick Dance New Better Get Than Getting Rip Face Robbie Other Face (professional Wrestling) Side Professional Wrestling Christina Aguilera Dancing Match Championship Team Game Backyard World Each Title Extreme Dark Dance Music Arm Some Stuff Singing Each Other Other Side Tournament Basics Beautiful Game (retailer) Keeps

I could make a comment, but I won't.

Lol seemed too much of an effort writing in stuff so I just clicked the suggestions lol

New video added Wall kicking been improved Smiley

Peace.
27  Games Center / Archived Projects / Re: Unnamed SideScroller; Have a look. ;) on: 2012-01-27 14:21:12
Added new video and new image.
Peace.
28  Games Center / Archived Projects / Re: Unnamed SideScroller; Have a look. ;) on: 2012-01-25 13:09:32
thanks mate there has been more updates since video.
peace
29  Games Center / Archived Projects / Re: Unnamed SideScroller; Have a look. ;) on: 2012-01-24 13:20:56
This is serious lol & Yes background processes using SwingWorker.

Peace.
30  Games Center / Archived Projects / Super Mario Remake, started a-new. on: 2012-01-22 16:59:55
Hill physics: Mario remake Hill physics.
Started remaking this Side Scroller Super mario remake.

This mario remake will include the level graphics from nearly all snes mario's Smiley

TODO:

  • Pixel perfect collision (Done)
  • Acceleration and deceleration walking & running (Done)
  • Hill physics (Sliding down and forcing acceleration down) (Done)
  • Jumping and falling (Done)
  • Different types of objects (Spikes, moving platforms)
  • Sliding down walls and wall jumping
  • Items (Coins, powerups etc)
  • Skybox background (Done)
OLD:

Old video; Improved wall kick & more (New)

Well I've been working on this for past few days; http://www.youtube.com/watch?v=0YUuF_lIgzI

Its going to be a fairly hefty side scroller once it's finished, using background processes to deliver maximum potential I'm sure this project will go far.

What do you think of the video?

Pixel perfect slopes (:

250 Entities;

Structure and some settings;


Peace.
Pages: [1] 2
 

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (81 views)
2014-04-15 18:08:23

BurntPizza (73 views)
2014-04-15 03:46:01

UprightPath (84 views)
2014-04-14 17:39:50

UprightPath (67 views)
2014-04-14 17:35:47

Porlus (84 views)
2014-04-14 15:48:38

tom_mai78101 (107 views)
2014-04-10 04:04:31

BurntPizza (167 views)
2014-04-08 23:06:04

tom_mai78101 (263 views)
2014-04-05 13:34:39

trollwarrior1 (214 views)
2014-04-04 12:06:45

CJLetsGame (223 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!