Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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  Game Development / Newbie & Debugging Questions / Re: LWJGL Textureloader not working? on: 2013-08-19 17:21:23
I'm wayyy confused; What is glCoord() doing? Is it like glVertex()? Because if i divided the actual plotting point by 256, i'd be way off of the desired drawing point.

EDIT: Okay, now I get it, the x and y refer to the individual characters. Like the top right would be (16,0). Okay. So now, i'll use a HashMap to connect the characters to their corresponding (x,y) coords and then use that to pick and draw the character. Sweet!
2  Game Development / Newbie & Debugging Questions / Re: LWJGL Textureloader not working? on: 2013-08-19 16:59:20
@davedes I saw many posts on the web about making one 256x256 texture with the whole font on it, each character in a 16x16 square, and I tried to use that. My idea was when using the glTexCoord(x,y) to use a floating point to specify which character I wanted. I figured since the chars were 16px long and the whole thing was 256px, in order to map the second(to the right) char of the very top row, the coords would be(0.0625, 0), being that the length of one char was 0.0625(1/16). But, i was getting stretched images of several chars at once, so I switched to the individual characters.
3  Game Development / Newbie & Debugging Questions / Re: LWJGL Textureloader not working? on: 2013-08-19 16:54:00
Yeah, noticed I forgot to mention that I used slick-util for the TextureLoader. I don't know how to edit posts though. Anyway, i've been trying to figure this out, and if I load a texture in the constructor of my MainComponent they display just fine. So should I just load ALL the textures at once on startup into the Texture[] array and then use them as needed? Btw thanks SO MUCH just for replying this has been bugging me SO BAD
(no pun intended)
4  Game Development / Newbie & Debugging Questions / Re: LWJGL Textureloader not working? on: 2013-08-19 16:41:22
20 hours, 63 views, but not even a single person commenting they don't even have a clue what's going on? -____-
5  Game Development / Newbie & Debugging Questions / LWJGL Textureloader not working? on: 2013-08-18 20:40:43
Okay, so I am new to LWJGL. I know Java pretty well, though. Anyway, I decided to create a clone of Pong, just to try it out, and had it working right up until I wanted to display text. Well, I just made a bunch of font files and was going to make a drawString() method. It would look like this:
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  
public void drawString(String draw, float x, float y) {
      StringTokenizer t = new StringTokenizer(draw);
      String[] chars = new String[2048];
      for(int i = 0;i<draw.length();i++) {
         chars[i] = t.nextToken("");
      }
      Texture[] tex = new Texture[2048];
      glEnable(GL_TEXTURE_2D);
      for(int j = 0;j<draw.length();j++) {
         try {
            tex[j] = TextureLoader.getTexture("PNG", new FileInputStream("res/font/" + chars[j] + ".png"));
         } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
         } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
         }
      }
      int o = 0;
      for(int a = 0;a<tex.length;a++) {
         drawRect(x+o, y, FONT_CONST, FONT_CONST, tex[a]);
      }
   
   }
But, when I run, since the score is 0 it tries to load a Texture. It doesn't report a FileNotFound or IOException, but is passing the Texture as null, since I keep getting NullPointerExceptions from the drawRect() call. This is really confusing me; I would be very grateful for help.
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.

Longarmx (45 views)
2014-10-17 03:59:02

Norakomi (35 views)
2014-10-16 15:22:06

Norakomi (27 views)
2014-10-16 15:20:20

lcass (31 views)
2014-10-15 16:18:58

TehJavaDev (61 views)
2014-10-14 00:39:48

TehJavaDev (61 views)
2014-10-14 00:35:47

TehJavaDev (51 views)
2014-10-14 00:32:37

BurntPizza (67 views)
2014-10-11 23:24:42

BurntPizza (39 views)
2014-10-11 23:10:45

BurntPizza (81 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!