Hello!
I am currently playing around with the excellent LWJGL library and I stumbled over the following "problem":
When I do the following...
Quotetry {
IntBuffer ib;
ib = BufferHelper.newIntBuffer(16);
GL11.glGetInteger(GL13.GL_MAX_TEXTURE_UNITS, ib);
maxTextureUnits = ib.get(0);
} catch (Throwable e) {
throw new RenderException("Could not query maximum texture unit count.", e);
}
...I get this error...
Quoteowp.gfx.render.RenderException: Could not query maximum texture unit count.
at owp.gfx.render.opengl.GlActiveTexture.getMaxTextureUnits(GlActiveTexture.java:105)
at owp.gfx.render.opengl.GlActiveTexture.setActiveTexture(GlActiveTexture.java:81)
at owp.gfx.render.opengl.GlActiveTextureTest.testSetActiveTexture(GlActiveTextureTest.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
Caused by: java.lang.UnsatisfiedLinkError: nglGetIntegerv
at org.lwjgl.opengl.GL11.nglGetIntegerv(Native Method)
at org.lwjgl.opengl.GL11.glGetInteger(Unknown Source)
at owp.gfx.render.opengl.GlActiveTexture.getMaxTextureUnits(GlActiveTexture.java:101)
... 27 more
The native sources seem to provide the needed function, though.
Do I miss some important point?
I am using version 0.92.
Thanks a lot for your help!
Maybe my LWJGL initialization code will be helpful:
Quotepublic synchronized static void initializeWindowed(
String title, int width, int height, int minBpp, int minAlpha, int minDepth, int minStencil,
int minSamples, boolean vsynch)
throws LWJGLException {
Display.setTitle(title);
Display.setFullscreen(false);
Display.setVSyncEnabled(vsynch);
Display.setDisplayMode(new DisplayMode(width, height));
Display.create(new PixelFormat(minBpp, minAlpha, minDepth, minStencil, minSamples));
initializeInputs();
initialized = true;
}
Quoteprivate static void initializeInputs() {
try {
Keyboard.create();
Keyboard.enableBuffer();
Keyboard.enableTranslation();
hasKeyboard = true;
} catch (LWJGLException e) {
if (logger.isEnabledFor(Level.INFO))
logger.info(Str.format("Could not create Keyboard input."), e);
Keyboard.destroy();
hasKeyboard = false;
}
try {
Mouse.create();
Mouse.enableBuffer();
Mouse.setGrabbed(true);
hasMouse = true;
} catch (LWJGLException e) {
if (logger.isEnabledFor(Level.INFO))
logger.info(Str.format("Could not create Mouse input."), e);
Mouse.destroy();
hasMouse = false;
}
try {
Controller.create();
hasController = true;
} catch (LWJGLException e) {
if (logger.isEnabledFor(Level.INFO))
logger.info(Str.format("Could not create Controller input."), e);
Controller.destroy();
hasController = false;
}
Thanks for your patience once more as I get the feeling that my problem has something to do with me doing some real stupid error... :shock:
You don't need to create the input. It is done automagically. Other than that, whats your graphics card, os etc.
Oh shame on me! I just realized that I have a real stupid error in my code.
My JUnit test case that triggered the error simply did not call the initialization code! :oops:
I have put it in, now it works fine (hey I happen to have 8 texture units available :) ).
Sorry for wasting your time and thanks for your quick answer!