Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GLUT alternative in Java & Android?

I noticed that GLUT is only available for C++. I am looking to reuse my OpenGL code on Java, then again port it to Android. Is there anything that is the 'standard' used instead of GLUT for these systems?

Edit: I am in fact using JOGL and interested in reimplementing via Java and not reusing C++. I have a basic understanding of C++, Java, and OpenGL, but nothing fancy yet. I'm fine with trying to figure out everything about windows like resizing, coloring, etc. I'm wondering if there's anything to help me with some of the (more advanced?) functions like glutSwapBuffers(), glutDisplayFunc(), glutMainLoop(), etc.

like image 238
BLaZuRE Avatar asked Oct 05 '22 10:10

BLaZuRE


2 Answers

What about JOGL or LWJGL .Their APIs are 1:1 to C++ glut.If you use the fixed pipeline you also have Glu lib with all you need inside.I didn't work with JOGL seriously because I didn't like the way it manages contexts and windows but I did do commercial projects with LWJGL and can tell this lib is fantastic.Also you can use it for mobile development.

I want to extend on this topic a little bit:

First , it seems like JOGL has got GLUT class which takes care mostly of primitives creation.Also I found this lib which is a partial port of C++ GLUT.But in fact , I don't understand your reason behind seeking GLUT C++ like lib.JOGL and LWJGL both supply you with input handling , context and window creation which are built in features.And in Java you will not probably be able to Unify context and windows creation under single roof because Android and Windows Java environments do it differently.Of course you can always roll your own class which will underneath take care of context/windows setup based on the platform but I think it is like re-inventing the wheel.

Regarding primitive geometry creation- I wouldn't bother to look into GLUT in such a case.Those are made using old ,deprecated (fixed) OpenGL pipeline.Today is 2013 and OpenGL is currently on 4.3 version and if you want to be synchronized with the current state of this technology and benefit from many new capabilities in OpenGL ,I would strongly recommend moving forward to OpenGL 3.3 onward.Doing this you need to code geometry manually.But there are many other benefits you gain like a total control over the way your rendering pipeline works.Also there are many online examples and tutorials on how create geometry for the programmable OpenGL. Hope it helps.

like image 65
Michael IV Avatar answered Oct 10 '22 01:10

Michael IV


There is jnigraphics and use NDK to develop the native C code for Android.

like image 40
Audrius Meškauskas Avatar answered Oct 10 '22 01:10

Audrius Meškauskas