opengl - Black screen in LWJGL -
i'm porting game of code obfuscated due porting c java.
my problem users report black screen , no other problems (sound working fine e.g.), no errors showing problem. on pc runs fine, , makes hell of debugging.
i wondering if can post (list of) reason(s) might occurring. i've read somewhere 1 of issues using 32 bits java on 64 bits system.
my code below, opensourced at: https://code.google.com/p/jake2t/
private void rendersidebyside() { glbindtexture(gl_texture_2d, 0); glbindframebufferext(gl_framebuffer_ext, sbsfboid); // render side side glpushattrib(gl_all_attrib_bits); glpushmatrix(); glmatrixmode(gl_projection); glloadidentity(); gluortho2d(0, width, 0, height); glmatrixmode (gl_modelview); glloadidentity (); glviewport(0,0,width,height); glclearcolor(0.0f, 0.0f, 1.0f, 0.0f); glclear (gl_color_buffer_bit | gl_depth_buffer_bit); gldisable(gl_depth_test); gldisable(gl_lighting); gldisable(gl_blend); gldisable(gl_alpha_test); gldisable(gl_cull_face); int shaderid = sbsshader.getid(); gldisable(gl_texture_2d); arbshaderobjects.gluseprogramobjectarb(shaderid); if (postfbotexturelocation[0] < 0) { postfbotexturelocation[0] = arbshaderobjects.glgetuniformlocationarb(shaderid, "lefttexture"); } if (postfbotexturelocation[1] < 0) { postfbotexturelocation[1] = arbshaderobjects.glgetuniformlocationarb(shaderid, "righttexture"); } if (postfbodepthtexturelocation[0] < 0) { postfbodepthtexturelocation[0] = arbshaderobjects.glgetuniformlocationarb(shaderid, "leftdepthtexture"); } if (postfbodepthtexturelocation[1] < 0) { postfbodepthtexturelocation[1] = arbshaderobjects.glgetuniformlocationarb(shaderid, "rightdepthtexture"); } // load images colors , depth values glactivetexture(gl_texture0); glbindtexture(gl_texture_2d, postfbotextureid[0]); arbshaderobjects.gluniform1iarb(postfbotexturelocation[0], 0); glactivetexture(gl_texture1); glbindtexture(gl_texture_2d, postfbotextureid[1]); arbshaderobjects.gluniform1iarb(postfbotexturelocation[1], 1); glactivetexture(gl_texture2); glbindtexture(gl_texture_2d, postfbodepthtexture[0]); arbshaderobjects.gluniform1iarb(postfbodepthtexturelocation[0], 2); glactivetexture(gl_texture3); glbindtexture(gl_texture_2d, postfbodepthtexture[1]); arbshaderobjects.gluniform1iarb(postfbodepthtexturelocation[1], 3); glbegin (gl_quads); gltexcoord2f(0.0f, 0.0f); glvertex2i (0, 0); gltexcoord2f(1.0f, 0.0f); glvertex2i (width, 0); gltexcoord2f(1.0f, 1.0f); glvertex2i (width, height); gltexcoord2f(0.0f, 1.0f); glvertex2i (0, height); glend(); arbshaderobjects.gluseprogramobjectarb(0); // rendering warping glpopmatrix(); glpopattrib(); unbindfbo(); } public void drawpostfbos() { rendersidebyside(); glpushattrib(gl_all_attrib_bits); glpushmatrix(); glmatrixmode(gl_projection); glloadidentity(); gluortho2d(0, width, 0, height); glmatrixmode (gl_modelview); glloadidentity (); glviewport(0,0,width,height); glclearcolor(0.0f, 0.0f, 1.0f, 0.0f); glclear (gl_color_buffer_bit); gldisable(gl_depth_test); gldisable(gl_lighting); gldisable(gl_blend); gldisable(gl_alpha_test); gldisable(gl_cull_face); gldisable(gl_texture_2d); int shaderid = riftshader.getid(); arbshaderobjects.gluseprogramobjectarb(shaderid); if (sbsfbotexturelocation < 0) { sbsfbotexturelocation = arbshaderobjects.glgetuniformlocationarb(shaderid, "tex"); } glactivetexture(gl_texture0); glbindtexture(gl_texture_2d, sbsfbotextureid); arbshaderobjects.gluniform1iarb(sbsfbotexturelocation, 0); glbegin (gl_quads); gltexcoord2f(0.0f, 0.0f); glvertex2i (0, 0); gltexcoord2f(1.0f, 0.0f); glvertex2i (width, 0); gltexcoord2f(1.0f, 1.0f); glvertex2i (width, height); gltexcoord2f(0.0f, 1.0f); glvertex2i (0, height); glend(); arbshaderobjects.gluseprogramobjectarb(0); glpopmatrix(); glpopattrib(); }
the common problems opengl 3+ programmer doesn't consider when coding are:
opengl extensions
- use of arb , ext extension.
- use of correct ogl extension.
use multiple implementation of different ogl extensions. here example using c++:
#ifndef _mesa_invert_ /*** ... codes here ... ***/ #else /*** ... alt codes here ... ***/ #endif
check if video card support following extension using:
Comments
Post a Comment