LWJGL Forum

Please login or register.

Login with username, password and session length
Pages: [1] 2 3 ... 10
 1 
 on: March 24, 2017, 22:23:48 
Started by Gojira - Last post by Gojira
I only took a quick look at this site, but it seems to be very good.  Explains mathematics behind many Open GL and game concepts.  They have a very detailed explanation of how the Open GL projection matrix is derived, which I found very helpful.

https://www.scratchapixel.com/index.php


 2 
 on: March 24, 2017, 15:49:35 
Started by Celsius - Last post by Celsius
I'm new at LWJGL and I'm always rendering a blurred image. :(
I've tried everything and searched in the internet. I hope you can help me.

Render Class:
Code: [Select]
public class Render {

private Main instance;
private boolean isRunning;

public Render(Main instance) {
this.instance = instance;
this.isRunning = true;
}

public void renderLauncher() throws LWJGLException {
init();
loop();
clean();
}

private void init() throws LWJGLException {
LoadGL11Event loadGL11Event = new LoadGL11Event();
loadGL11Event.setState(EventState.PRE);
loadGL11Event.call();

Display.setDisplayMode(new DisplayMode(getInstance().getDisplayWidth(), getInstance().getDisplayHeight()));
Display.setTitle(getInstance().getName());
Display.setResizable(true);
Display.setVSyncEnabled(true);
Display.create();

glEnable(GL_TEXTURE_2D);
glClearColor(0.0F, 0.0F, 0.0F, 0.0F);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glViewport(0, 0, getInstance().getDisplayWidth(), getInstance().getDisplayHeight());
glMatrixMode(GL_MODELVIEW);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, getInstance().getDisplayWidth(), getInstance().getDisplayHeight(), 0, 1, -1);
glMatrixMode(GL_MODELVIEW);

loadGL11Event.setState(EventState.POST);
loadGL11Event.call();
}

private void loop() {
while (!Display.isCloseRequested() && isRunning) {
glClear(GL_COLOR_BUFFER_BIT);

if (Display.wasResized()) {
glViewport(0, 0, Display.getWidth(), Display.getHeight());
}

getInstance().setDisplayWidth(Display.getWidth());
getInstance().setDisplayHeight(Display.getHeight());

glPushMatrix();

Render2DEvent render2DEvent = new Render2DEvent(Display.getWidth(), Display.getHeight());
render2DEvent.call();

glPopMatrix();

Display.sync(60);
Display.update();
}
}

private void clean() {
getInstance().shutdown();
isRunning = false;
Display.destroy();
System.exit(0);
}

private Main getInstance() {
return instance;
}
}


Background Class:

Code: [Select]
public class Background {

private int textureID;
private int width;
private int height;

@EventHandler
public void onLoadGL11(LoadGL11Event loadGL11Event) {
if (loadGL11Event.getState().equals(EventState.POST)) {
try {
InputStream input = Main.getInstance().getClass().getResourceAsStream("/res/background.jpg");
BufferedImage image = ImageIO.read(input);
this.textureID = loadTexture(image);
this.width = image.getWidth();
this.height = image.getHeight();
} catch (IOException e) {
e.printStackTrace();
}
}
}

@EventHandler
public void onRender2D(Render2DEvent render2DEvent) {
glBindTexture(GL_TEXTURE_2D, textureID);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2f(0, 0);
glTexCoord2f(1, 0);
glVertex2f(width, 0);
glTexCoord2f(1, 1);
glVertex2f(width, height);
glTexCoord2f(0, 1);
glVertex2f(0, height);
        glEnd();
}

public static int loadTexture(BufferedImage image) {
int[] pixels = new int[image.getWidth() * image.getHeight()];
image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());

ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * 4);

for (int y = 0; y < image.getHeight(); y++) {
for (int x = 0; x < image.getWidth(); x++) {
int pixel = pixels[y * image.getWidth() + x];
buffer.put((byte) ((pixel >> 16) & 0xFF));
buffer.put((byte) ((pixel >> 8) & 0xFF));
buffer.put((byte) (pixel & 0xFF));
buffer.put((byte) ((pixel >> 24) & 0xFF));
}
}

buffer.flip();

int textureID = glGenTextures();

glBindTexture(GL_TEXTURE_2D, textureID);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);


glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);


glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, image.getWidth(), image.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
buffer);

return textureID;
}
}

 3 
 on: March 22, 2017, 22:31:29 
Started by keybounce - Last post by keybounce
This shows up in Minecraft, on the mac.

With a dead internal trackpad, I'm using a trackpad app on my kindle fire with a server on my mac. This works for most programs.

It fails to register anything while playing Minecraft, until I bring up any gui -- the menu before starting the game, the <Esc> pause menu, a crafting table, etc -- at that point, the tablet trackpad moves the OS mouse pointer just fine. But as soon as I go into the game, I cannot move my camera by using the trackpad.

The odd thing? I was pretty certain that I was able to do exactly this a couple of weeks ago. I know that Minecraft on the mac uses the latest builds of lwjgl; did something change recently, or am I mistaken, and this has never worked?

(To help track this down, perhaps: It works with portal 1; it fails with portal 2 and world of tanks:blitz.)

Program: Remote Mouse 2.806.
http://www.remotemouse.net/

 4 
 on: March 22, 2017, 16:54:14 
Started by Maineri - Last post by Maineri
Hi!

For some reason my game keeps glitching on fullscreen when taking screenshots or using alt + tab. It is hard to explain but I have it on video.

Video: https://youtu.be/-IE9I6n9oY0

In the video you can see that first it has a loading screen and then the game starts. Every texts of loading screen are deleted after loading screen. But when I take screenshot and paste it to paint it still shows the loading screen. Also the small screen on windows taskbar has the loading screen on it. When I go back to the game and do the same again it doesn't show the loading screen but it is not the real time either.

So screenshots etc.. shows earlier time of the game. The game should not have anything that could do that.

Help me please!

 5 
 on: March 17, 2017, 15:45:26 
Started by ted_gress - Last post by drokid
I totally agree that http://wiki.lwjgl.org/ needs either one of those two:
- a total and thorough reworking for LWJGL 3
- a very prominent hint that everything written there _only_ applies to LWJGL 2

The reason why there is so little tutorials/demos/examples/guides for LWJGL 3 is that version 3 of LWJGL is quite new still in flux and no one so far had time to do a thorough guide for it. The 3D Game Development with LWJGL book is indeed a good place to start. But be aware that this book is supposed to explain how to implement 3D graphics concepts, such as "shadows", "frustum culling", "mouse picking" in LWJGL. It will not get into details about the mapping/binding scheme used by LWJGL to make OpenGL functions accessible.

I will try to work further on that "intro" package of the lwjgl3-demos suite to explain more of the LWJGL 3 design. Because, if you're familiar with OpenGL, then the binding scheme and how LWJGL handles native concepts (making OpenGL context current, handling memory, handling callbacks, ...) are the only things that could possibly get in your way.

Thanks, nice to hear that.

 6 
 on: March 17, 2017, 14:46:31 
Started by ted_gress - Last post by Kai
I totally agree that http://wiki.lwjgl.org/ needs either one of those two:
- a total and thorough reworking for LWJGL 3
- a very prominent hint that everything written there _only_ applies to LWJGL 2

The reason why there is so little tutorials/demos/examples/guides for LWJGL 3 is that version 3 of LWJGL is quite new still in flux and no one so far had time to do a thorough guide for it. The 3D Game Development with LWJGL book is indeed a good place to start. But be aware that this book is supposed to explain how to implement 3D graphics concepts, such as "shadows", "frustum culling", "mouse picking" in LWJGL. It will not get into details about the mapping/binding scheme used by LWJGL to make OpenGL functions accessible.

I will try to work further on that "intro" package of the lwjgl3-demos suite to explain more of the LWJGL 3 design. Because, if you're familiar with OpenGL, then the binding scheme and how LWJGL handles native concepts (making OpenGL context current, handling memory, handling callbacks, ...) are the only things that could possibly get in your way.

 7 
 on: March 17, 2017, 13:54:40 
Started by ted_gress - Last post by drokid
Yes, setting up the environment was clear, and also was showing a window.. I couldn't go further.

I skimmed through many things but as an example
I tried to port this basic code here http://wiki.lwjgl.org/wiki/LWJGL_Basics_3_(The_Quad).html
to lwjgl3 by the help of migration guide https://github.com/LWJGL/lwjgl3-wiki/wiki/2.6.6-LWJGL3-migration
Showing the window was ok but I couldn't show the quad, and since the exceptions are native I got stuck..

You may say I should use vertex buffers, yes I use them normally in my current code in lwjgl2 but I couldn't manage to port my code either. I got help from the samples in the intro package of demo-suite about vbs but I couldn't manage to handle 3d environment and camera I think.

I am aware that just a complain message without details is not much of a use, normally I would clear out problems and even try to fix if there is something I could help but I lost too much time and I don't have time and effort left to discuss the problems in detail and also I believe the problem is not something hidden, it is obvious; "newcomers" will struggle among useless documents and videos.

On lwjgl there is a nice setup document and general information, they are good but that's all. For tutorials and guide it directs to wiki https://github.com/LWJGL/lwjgl3-wiki/wiki
which just tells you to go and learn native opengl.. (I've done many things in opengl before so I consider myself who knows it but I couldn't continue with lwjgl, I might be a dummy that's ok but I guess there would be plenty of people like me) When people can't find things on official site we continue to search. I am not sure if http://wiki.lwjgl.org/ is active anymore but even if it is not we are not aware of it and spend time trying to find out something that works there. Also I couldn't find something on youtube that works for the latest lwjgl.

Anyway, the last link I sent looks promising, I hope it will do the thing.





 8 
 on: March 16, 2017, 21:05:26 
Started by ted_gress - Last post by Kai
Can you be a bit more concrete as to what exactly is deprecated and how things can be changed for the better?
Unless people actually say, *what exactly* they feel is deprecated the perceived situation will _never_ change. I make the firm assertion, though, that every "official" documentation you'll find on lwjgl.org and on the GitHub LWJGL3 Wiki, especially regarding how to setup LWJGL3, is up to date, and if followed precisely, you'll get a working setup in no time.

 9 
 on: March 16, 2017, 20:27:27 
Started by ted_gress - Last post by drokid
I am one of those guys who spend days just to be able to start working with lwjgl, and couldn't manage to do so yet. Rich documentation just makes it worse because most of them(even some related with lwjgl3) are deprecated.

I've worked with opengl before, and lwjgl2. When I couldn't manage to work in lwjgl3 I turned back to my old setup lwjgl2.
The current state of LWJGL can be very efficient but doesn't allow new people to start working with it.

I wanted to mention this here because I was so frustrated after spending days for nothing rather than working on my real problems.

Thanks for the suggestions though.

edit: This one looks promising, http://forum.lwjgl.org/index.php?topic=6179.0

 10 
 on: March 14, 2017, 17:22:24 
Started by devil0150 - Last post by kappa
There is also the LibGDX library which has a LWJGL backend for the desktop and GWT one for web games.

Pages: [1] 2 3 ... 10