Using JOGL, and problem is - there is no alpha. I have a PNG file that shows transparency in photoshop.
Loading texture:
1 2 3 4 5 6 7 8
| public void LoadTextureFromResource(String res,String type) throws IOException { InputStream stream = getClass().getResourceAsStream(res); TextureData data = TextureIO.newTextureData(GLProfile.getDefault(),stream,GL2.GL_RGBA,GL2.GL_RGBA, false, type); this.texture = TextureIO.newTexture(data); this.loaded = true; } |
OpenGL init:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| GLCapabilities capabilities = new GLCapabilities(GLProfile.getDefault()); capabilities.setHardwareAccelerated(true); capabilities.setNumSamples(0); capabilities.setAlphaBits(8); capabilities.setSampleBuffers(true);
...... gl.glDisable(GL2.GL_LIGHTING); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); gl.glEnable (GL2.GL_BLEND); gl.glShadeModel(GLLightingFunc.GL_SMOOTH); gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); gl.glClearDepth(1.0f); gl.glEnable(GL.GL_DEPTH_TEST); gl.glDepthFunc(GL.GL_LEQUAL); gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); |
Tried changing blend func, some modes make everything transparent, this one renders fine but without alpha.
And ofcourse, im rendering object with that texture last.
Help??