hey there guys i am new to this forum, but im not new to java allthought im new to LWJGL, my question is bascily … how would i load and draw a image in LWJGL ? i am not using slick and i am not going to use it either umm that really sums it all up, thanks
Slick, or Slick-Utils? Slick-Utils really is the best way to load a image, and the license isn’t hindering if you wanna sell your product at all, so that’s the only thing I can recommend.
You need to convert the image for OpenGL, basically. You have to split it up in its RGB(A) components and put that in a buffer then. After that you have to flip the buffer so that it is readable for OpenGL.
yea as i am new to LWJGL and i know java pretty well i like to make my own algorithms and such i don’t really have any reason other than that, im not hating on slick tho its a great engine and i have used it b4 i just want to see how i would do without it
I’m not saying that it’s bad, but it isn’t the best one. Besides, I believe that something as fundamental as texture loading is something you should code by yourself as a learning experience. =S
Yep, glTexImage2D operates on the last texture bound, which is global state. After the first thousand times you cringe at how ugly that sort of thing is, you get used to it. Welcome to OpenGL. You think that kind of thing is awful in Java, try dealing with it in a pure functional language sometime.
Better give up then? I mean, the integer texture ID you already have binded is just impossible to encapsulate in your own Texture object, along with all the relevant texture data like width, height and color channels, all of which are actually even queryable from OpenGL but a bit slow? Maybe you could encapsulate the texture ID in an Integer in proper OOP spirit? ;D
… which makes it (in addition to helping you understand OpenGL textures, Cero :point:) the perfect introduction to handling data for OpenGL with buffers which is also very practical for VBOs or any kind of batched rendering.
Well its all interesting; but I never started learning OpenGL really, because I dont even want to use it directly… way too low level for me.
It’s one of these legacy technology, terribly designed by todays standards, that have to be used on a low level, behind the scenes; but you guys do that, and I just use the TextureLoaders and whatnot =D