Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (553)
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 / OpenGL Development / Re: Turning a 2D array of points into a mesh (or Wireframe) on: 2012-06-12 05:54:00
Well let me show you how I'm drawing.


      
1  
2  
3  
4  
5  
6  
7  
8  
9  
for(int i = 0; i < heightMap.length; i++)
      {
         glBegin(GL_LINE_STRIP);
         for(int j = 0; j < heightMap[i].length; j++)
         {
            glVertex3f(heightMap[i][j].x, heightMap[i][j].y, heightMap[i][j].z);
         }
         glEnd();
      }


So this draws lines for each row. But what I want is a connected mesh. I realize that the code I provided will not do this, but so have many other methods I have tried. So I'm wondering if I'm missing something about creating a mesh or wireframe.
2  Java Game APIs & Engines / OpenGL Development / Turning a 2D array of points into a mesh (or Wireframe) on: 2012-06-12 04:14:59
So I'm working with a terrain generation algorithm (Midpoint Displacement) to create a random landscape. Problem I'm having with it, is that I cannot for the life of me figure out how to get the points to display as a wireframe. I've tried using polygon mode, lines, triangles, but nothing gives me the correct result, as the end of one row will be connected to the beginning of the next, or when I try triangles, it works like line strip just spiky.

I'm new to 3D and OpenGL, but not Java. I finished a 2D game very easily and I want to begin work on a future senior design project. I know the algorithm works, as it displays well as just a point cloud.

Any help appreciated, sorry for the beginner question, figure this would be the place to ask. Thanks for any help.
3  Game Development / Newbie & Debugging Questions / Re: SpriteSheet loading class returns error when there seems to be none on: 2012-03-01 05:06:54
Thanks for the honesty. You were right. It wasn't tripping my crappy fail safe.

Thanks UprightPath you helped me get it working.
4  Game Development / Newbie & Debugging Questions / SpriteSheet loading class returns error when there seems to be none on: 2012-03-01 02:43:42
Class Here

Hi again,

This is a spritesheet loading class that gets a buffered image, the amount of tiles in the x and y directions and then splits the image into it's subimages and puts it into an appropriately sized array. Problem is, I start getting a rasterformatexception halfway through the first row, saying that (x + width) is outside the raster. Thing is, when I print the amount of space left on the x-axis for the picture, I'm only halfway through loading it. I've only tested it with a single spritesheet that is sized at 192x128. Every time I've looked at the class, everything seems in order. It runs fine for the first four, I'm even able to display the images it successfully loads (Albeit anything after the first image contains all the previous images).

I figure I must be leaving something out, since I'm new to using a BufferedImage, having used only ImageIcons before. So anyone with some more experience have a modification to the code that could help me out? Appreciate any help.

Edit: Ooops this version is the wrong one. Going to put the right one up in a sec.

Edit 2: Updated.
5  Game Development / Newbie & Debugging Questions / Re: Using JScrollPane as the camera for a top-down shooter on: 2012-02-29 07:49:17
Thank you ra4king. That got the display working.
6  Game Development / Newbie & Debugging Questions / Re: Using JScrollPane as the camera for a top-down shooter on: 2012-02-29 07:04:29
This would be basically what I have without all the extra methods and stuff for my actual game. No matter what I try this will just not draw.
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  
public class Game extends Canvas
{
   BufferStrategy strategy;

   Game()
   {
     /*
      *   Frame crap!
      *
      */

       
      //Make the frame and a panel to put stuff in
     JFrame frame = new JFrame("GAME");
      frame.setPreferredSize(new Dimension(1024,768));
     
      JPanel panel = (JPanel) frame.getContentPane();
      panel.setPreferredSize(new Dimension(frame.getWidth(), frame.getHeight()));
      panel.setLayout(null);
     
      setBounds(0,0,frame.getWidth(),frame.getHeight());
      frame.add(this);
     
      setIgnoreRepaint(true);
     
      frame.pack();
     
      //Some stuff to make the frame do what we want
     frame.setResizable(false);
      frame.setVisible(true);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setLocationRelativeTo(null);
     
      //Make the buffering strategy
     createBufferStrategy(2);
      strategy = getBufferStrategy();
    }
   public void paint(Graphics g)
   {
      Graphics2D d = (Graphics2D) strategy.getDrawGraphics();
     
      d.setColor(Color.BLUE);
      d.fillRect(50,50,200,200);
     
      d.dispose();
      strategy.show();
   }
   public static void main(String[] args)
   {
      Game g = new Game();
   }


I can't make that rectangle draw. Let alone my actual paint method with enemies and such. Any tips?
7  Game Development / Newbie & Debugging Questions / Re: Using JScrollPane as the camera for a top-down shooter on: 2012-02-29 05:34:33
Canvas is giving me some problems drawing. Anything explicitly different than JPanel that would be causing me problems? I have the BufferStrategy and such. When it did draw all it did was flicker.
8  Game Development / Newbie & Debugging Questions / Re: Using JScrollPane as the camera for a top-down shooter on: 2012-02-29 04:48:57
It's actually stemming from a couple colleagues at school. I asked about canvas and they said that I shouldn't bother and it wouldn't help performance very much. So I just went with JPanel and it seemed simple enough so I stuck with it.
9  Game Development / Newbie & Debugging Questions / Re: Using JScrollPane as the camera for a top-down shooter on: 2012-02-29 04:42:18
Thanks for the replies. I'll start restructuring everything to run on a canvas. I've just been drawing to a class that extended JPanel.
10  Game Development / Newbie & Debugging Questions / Using JScrollPane as the camera for a top-down shooter on: 2012-02-29 04:20:17
Hey all,

New here, but the community seems great. As the title says, I'm trying to use a JScrollPane as a camera in my game. My main problem is that I can't center the camera on the player. I can make the camera scroll when the player hits the edge with scrollRectToVisible(), but even that breaks after a bit, allowing the character to walk off screen. A good example of what I'm trying to do is Notch's Left 4k Dead. I looked at the source for that, but everything seems to be somewhat hacked together. I have looked at the Java API for methods that would help me follow the player but none of them seem to work. I've toyed around with changing the underlying JViewPort but that didn't work either.

Any help would be appreciated with this problem.
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 (24 views)
2014-08-22 19:31:30

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

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

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

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

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

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

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

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

Norakomi (42 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!