I've been following some game tutorials on youtube and developed a custom engine using Java (Graphics2D, BufferStrategy and such).

I have a class "Surface", which represents any 2D object (image, animation, sprite, text, graph, tiled map, height map, etc). All surfaces have some generic properties and a BufferedImage where the current state is drawn, and passed to the renderer when needed.

Everything works fine, but i wanted to try something "better" so now i have a new project using LWJGL 3 and... i'm totally lost. I know OpenGL and Graphics2D are parallel universes, but at this moment i just want to adapt the existing code to the new libraries.

How can i create a target surface for 2D drawing, which can receive pixels from different sources and drawing methods, using modern OpenGL/LWJGL?


Your best bet is to make a class that replicates Javas Graphics class in LWJGL.

For textures you can write your own LWJGL wrapper or use Slick 2D

| improve this answer | |
  • \$\begingroup\$ Thanks, but can you elaborate your answer? \$\endgroup\$ – Marlon Jul 2 '16 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.