LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: rileld on March 02, 2015, 03:32:45

Title: Help translating opengl texture tutorial to lwjgl
Post by: rileld on March 02, 2015, 03:32:45
I'm trying to recreate this tutorial: https://open.gl/textures using lwjgl. This is the source code I'm working off: https://open.gl/content/code/c3_basic.txt.

Here's a repo of my current progress: https://github.com/kevinm416/java-game. There is a main method in https://github.com/kevinm416/java-game/blob/master/src/main/java/com/kevinm416/game/OpenGlTextureTutorial.java, which I expect to produce a window with the texture showing. However, I can not get anything to show up.

Let me know if there's anything else I can do to make it easy for any of you to help me.

Title: Re: Help translating opengl texture tutorial to lwjgl
Post by: Kai on March 02, 2015, 22:05:08
I hate to break this on you, but your demo project with 20 source files, various "service" abstractions and also the use of reflection to simply instantiate a class is by far too complex and unwieldy for a tutorial about simple OpenGL textures.
Bring that down to a single source file that preferrably looks similar to the C source file you are porting, and people will like what you did. Simplicity and conciseness is key for tutorials!
Sorry if that maybe came along rude, but it is just very hard to grasp what is going on right now and what the error might be, given that the C source is so darn simple to understand because it focuses on the important part: the use of the OpenGL API.
Cheers,
Kai
Title: Re: Help translating opengl texture tutorial to lwjgl
Post by: Katsu on March 02, 2015, 23:48:40
I tried to translate it to Java + LWJGL3: http://pastebin.com/uKqiPBct
It is almost the same code as the text file on open.gl. To run this, you just need a texture called test.jpg in the project folder (or you can change line ~135). It works on my laptop which has OpenGL 3.1.

Katsu