Basic animation in LWJGL

How does a basic animation work in lwjgl? Should I have a timer to change the texture to its’ next frame?

Sorry, but don’t you think you should get more familar with the basics first?

In case not, look at delta timing.

2d animation wouldn’t be basic?

If you think you are fine, ok.
Having a timer for every single texture in the program is a waste.
Make it jump to the frame it has to be in when it is rendered when it is rendered.

No idea how to do that.

Quick question: why not use something more beginner friendly like libGDX?

If not, then you can at least look how libGDX does it: http://www.gamefromscratch.com/post/2013/12/09/LibGDX-Tutorial-3B-Simple-Animation.aspx

As you can see, an animation is a shifting of the texture coordinates to different regions of a spritesheet. Think of it as a sliding window. You could just change textures completely, but that would be a huge waste (having to upload a whole texture for each frame) when you can just change the portion of a single texture that your’e displaying.

LibGDX? Does it run on computers? I thought it was only for android and LWJGL was best for game development and everything.

You obviously haven’t looked at the website: http://libgdx.badlogicgames.com/

First words on the page besides the menu: “Desktop/Android/BlackBerry/iOS/HTML5 Java game development framework”

:o Someone (Spacebeans) told me that pretty much ebery one here uses LWJGL and it’s a low end graphics thingy. I tried libgdx before but didn’t go through setup properly. But minecraft was made in lwjgl so I thought it was best for 3d and some 2d. If I do make this deadly switch, what would be the use for LWJGL?

EDIT: Just found this post

OpenGL is interesting to learn like anything else, but would I really ever apply it? Still LWJGL Looks different from c++ OpenGL which probably has more jobs.

I won’t bandy out the proportions of people who use what (I don’t know them, who does really), but I can give a quick rundown:

LWJGL: Indeed low level. You are calling OpenGL code yourself. Thus you have to build all the high level constructs (sprites, animation, ui, particle systems, etc.) yourself. This may be desirable if you want absolute control or simply can’t stand using someone else’s pre-made solution in a library. I’d say not suitable for beginners as they wouldn’t know what to do with all the control afforded to them, and the low level OGL API can be confusing and hard to grasp.

libGDX: “Medium level” in that it has stuff already done for you (Animation, SpriteBatch, Camera, ModelBuilder, lots of others…) but not super high level (think GameMaker or whatever) and still gives access to the LWGJL underneath if you need it. This I recommend for beginners and anyone who doesn’t mind using pre-built solutions and likes to save time not building their own solutions.

LWJGL is a library that has done the dirty work of allowing access the C OpenGL/OpenAL/OpenCL API to Java. LibGDX is a framework that that uses LWJGL (on Windows/Mac/Linux) to allow much easier game making. It also has a backend for Android, HTML5, and iOS, allowing 1 code base to target multiple platforms.

I spent the past 2- 3 months learning LWJGL and my knowledge is capped at 3D models. I will use LibGDX since I want to start on a project and Slick2D is considered depreciated. Would it be best to learn c++ later on and learn OpenGL from text books and then go back to LWJGL? Rendering a 3D model just kills me and makes little sense. :cranky:

As a beginner, you should probably not be worrying about 3D anyway. 2D games will be where you want to put your focus. As for coming back to LWJGL, no, you don’t need to learn C++, ra4king here in fact has some of the best OGL tutorials ported to LWJGL: https://github.com/ra4king/LWJGL-OpenGL-Tutorials/

Also, you don’t need to come back to LWJGL if it’s not the right tool for the job. You don’t even need to know OGL if it’s not the right tool for the job. A decent chunk of being a programmer is knowing what tool to use for the job.
Review what LWJGL and libGDX are and make your decision.

Thanks, appearently LibGDX has everything I need for the job. 2D and later on 3D. Eventually I want to come back and design a basic engine for lwjgl though. Thanks ;D

EDIT: Now that I understand how to use ra4kings translations, I have the urge to still use LWJGL so I can create an engine.

Can you please explain what you mean by engine?