LWJGL Forum

Please login or register.

Login with username, password and session length

Author Topic: Loading textures with and without the help of Slick-Utils library  (Read 330 times)

smokethepot

  • Newbie
  • *
  • Offline Offline
  • Posts: 9

Hello! I was trying to learn how to display textures on the screen with the help of Slick-Utils library but I was consistently getting a NoSuchMethodException. I looked for an answer on the web as to why was this happening and got the answer that Slick-Utils is outdated and isn't compatible with LWJGL 3 anymore. Is it true?

Then I thought of making my own texture class. Can anyone give me any examples/pseudocode for this if possible?
Logged

yoojeen

  • Newbie
  • *
  • Offline Offline
  • Posts: 7

Mac OS?
Not only slick textures isn't work. On a Mac OS lwjgl3-tutorial by SilverTiger is not work too. Just black screen.

can't initialized textured fonts in a Fonts class
https://github.com/SilverTiger/lwjgl3-tutorial/wiki/Fonts
seems, any texture loader isn't work
for this reason i can't get to use lwjgl since the beginning of the third version
Logged

spasi

  • Administrator
  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 1820

GLFW is not compatible with AWT on macOS. Any library that tries to use ImageIO or java.awt.Font will trigger AWT initialization and there will be a conflict between the AWT and GLFW event loops. You can try with -Djava.awt.headless, but in general we recommend to port your code to LWJGL's stb bindings. STBImage replaces ImageIO and STBTruetype can be used for text rendering.
Logged

yoojeen

  • Newbie
  • *
  • Offline Offline
  • Posts: 7

seems, a problem with or nearest of BufferedImage.

for me - i cant load any textures. i have lwjgl without textures :D

The AWT is part of the Java Foundation Classes (JFC) — the standard API for providing a graphical user interface (GUI) for a Java program.

biggest product not work for a MacOS? :)

why lwjgl 2.9.1 isn't have a same promblem? 

mabe is a bug, аnd send an error report for Oracle needed?
But there is no error in the log

Logged

spasi

  • Administrator
  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 1820

This question has been answered countless times the past 4 years, please search the forum for similar topics. It may sound surprising but there's no way around it, it's just how macOS works.
Logged

yoojeen

  • Newbie
  • *
  • Offline Offline
  • Posts: 7

i'm newbie, for expample, and slick with lwjgl - this is the only one method for textures in java+lwjgl that i knew and that worked before. with the appearance of the version three zero i threw the development on the lwjgl and waited for it to work, but people still suffer.

but thanx for answer.
Logged

spasi

  • Administrator
  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 1820

The solution was mentioned in my first reply. Use the STBImage class to load textures. It's faster, allocates less memory, it's less code (literally one line of code) and you get the image in a buffer that you can immediately upload to an OpenGL texture. There are plenty of examples in the LWJGL repo, in lwjgl3-demos and in the forum/wiki.
Logged

yoojeen

  • Newbie
  • *
  • Offline Offline
  • Posts: 7

thanks for the advice, spasi! If i subordinate STBImage - i'll write about it, if i don't forget :)
Logged