简体   繁体   中英

Why won't eclipse show lwjgl imports in the “quick fix” menu?

I have tried everything mentioned in this question with no success.

I have also tried deleting the entire workspace and letting eclipse generate a new one, and setting access restrictions.

Deleting my installation of eclipse manually and deleting the eclipse folder in my user folder (windows 10), then reinstalling a fresh download of eclipse didn't work.

eclipse will clean imports just fine. i could import something general, like an entire class, and eclipse will make more specific imports by shortcut or when i save and quit.

The problem is the quick fix menu on mouseover , which does not offer any import suggestions. (it will for java classes such as random from java.util though)

I think the problem is your missconception of the LWJGL library, or Java itself. Other than C++, in Java functions and variables HAVE to be in the scope of a class. This also includes static functions from OpenGL/LWJGL. Due to that restriction, LWJGL was implemented version-based. That means, all static variables and methods are contained in classes representing the version number the feature was implemented.

For example: glGetVertexArrays was introduced in OpenGL 3.0, which means, that you can find it in the GL30 class.

The advantage is, that it is possible to create backwards compatible software by only importing certain classes. eg if you want to make something OpenGL 3.3 compatible, you just don't import anything above GL33. The disadvantage is, that you have to either remember all the version numbers and their features, or you look it up in the Khronos Specification, or just guess.

To use LWJGL functions, you can either:

  • Import the class statically using eg import static org.lwjgl.opengl.GL30.*;

  • Use the classname eg int vao = GL30.glGenVertexArrays();

Note that when pressing [Ctrl]+[Shift]+O all static import ending with * are resolved to indiviual imports.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM