JOGL Texture disappears on mac osx

浪尽此生 提交于 2019-12-12 05:48:16

问题


I have done some research and cant find anyone that have the same experience of this problem.

I would appreciate if someone just can confirm that they can draw textures with eclipse and jogl running a macbook pro with JRE1.8. Or does someone else experience same problems?

Texture disappears on osx - GL_TEXTURE_2D JOGL Eclipse java


回答1:


jmaasing (a JogAmp user) uses Oracle Java 1.8 with JOGL 2.2.4 daily on a Mac Book Pro, he ran my first person shooter at least once and he didn't reproduce this problem.

Your title is plain wrong. Sorry it's a provocation, I'm really furious. Moreover, the mistake comes from your code, read this: https://www.opengl.org/sdk/docs/man/html/glBindTexture.xhtml

gl.glBindTexture(GL.GL_TEXTURE0, texture.getTarget());????????? This is wrong. The target is the first parameter and the second one isn't the texture unit, it's the texture identifier (sometimes called the texture "object") returned by glGenTextures. GL.GL_TEXTURE0 should be used with glActiveTexture. You're lucky if it works sometimes. Rather write:

gl.glBindTexture(texture.getTarget(), texture.getTextureObject());

Good luck. Sorry to be harsh but please read the manual.

Edit.: You call call Texture.enable(), Texture.bind() and Texture.disable() too.



来源:https://stackoverflow.com/questions/26800500/jogl-texture-disappears-on-mac-osx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!