LWJGL
May 21, 2012, 01:00:03
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
LWJGL 2.8.3 released!
Home
Help
Search
Login
Register
LWJGL
>
Programming
>
OpenGL
>
panel problem
Pages: [
1
]
« previous
next »
Print
Author
Topic: panel problem (Read 2152 times)
ararie
Newbie
Posts: 11
panel problem
«
on:
May 21, 2007, 19:26:09 »
Hi!
i'm using the tutorials from nehe and right now i'm currently using Lesson10 with a few changes... however, what i wanted to do was create a window with 2 panels, the first contains lesson 10, the second is another panel....
is that possible? i tried extending lesson10 into a JPanel and on my main method i made a JFrame room, instantiated lesson 10 and made another JPanel itemPanel with a JLabel 'label'. then i added both into 'room' and it compiled fine. when i ran it it didn't show itemPanel or the JLabel and i figured it's coz i forgot to take out 'createWindow()' from lesson10. so i did this but it gave me an error:
java.lang.NullPointerException on this line:
GL11.glGenTextures(buf); // Create Texture In OpenGL
please help!
Logged
Matzon
Administrator
Demigod
Posts: 2177
Re: panel problem
«
Reply #1 on:
May 21, 2007, 22:02:34 »
just put an AWTGLCanvas into you jpanel
Logged
http://certusgames.com
(Free Online Multiplayer Java Games)
http://lwjgl.org
(OpenGL/OpenAL for Java)
ararie
Newbie
Posts: 11
Re: panel problem
«
Reply #2 on:
May 23, 2007, 14:10:33 »
so.. do i extend my room as an awtGLcanvas and not as a jpanel?
Logged
Matzon
Administrator
Demigod
Posts: 2177
Re: panel problem
«
Reply #3 on:
May 24, 2007, 01:28:35 »
well that depends on what you want to do ... either solutions will work
Logged
http://certusgames.com
(Free Online Multiplayer Java Games)
http://lwjgl.org
(OpenGL/OpenAL for Java)
ararie
Newbie
Posts: 11
Re: panel problem
«
Reply #4 on:
May 25, 2007, 14:57:40 »
okay so this is what did
public class MetalRoom extends AWTGLCanvas
{ the code here is very similar to Lesson 10 of nehe.gamedev.net
infact it's the same code, i just added a few more items in the room
//constructor
public MetalRoom() throws LWJGLException
{}
//the main method
public static void main(String args[]) {
JFrame game = new JFrame("The Metal Room");
game.setSize(640, 480);
game.isVisible();
JPanel room = new JPanel();
JPanel item = new JPanel();
try
{ MetalRoom demo = new MetalRoom();
room.add(demo);
game.setLayout(new BorderLayout());
game.add(room, BorderLayout.NORTH);
JLabel test = new JLabel("this is a test");
item.add(test);
game.add(item, BorderLayout.SOUTH);
demo.run(false);
}
catch(LWJGLException e)
{ System.out.println(e);
System.exit(0);
}
}
}
makes sense?
it compiled fine.. but it gives me a runtime error
java.lang.NullPointer
at org.lwjgl.opengl.GL11.glGenTextures(GL11.java:1317)
at MetalRoom.loadTexture(MetalRoom.java:375)
at MetalRoom.setupWorld(MetalRoom.java:1083)
at MetalRoom.init(MetalRoom.java:203)
at MetalRoom.run(MetalRoom.java:127)
at MetalRoom.main(MetalRoom.java:1292)
........ what now?
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Programming
-----------------------------
=> Lightweight Java Library Game Development
=> LWJGL Documentation
=> Bug Reports / RFE
=> OpenGL
=> OpenAL
=> General Java Game Development
-----------------------------
Archive
-----------------------------
=> Resolved Bugs/RFE
=> DirectX
=> DevIL
=> FMOD
Loading...