List of usage examples for org.lwjgl.opengl GL11 GL_NO_ERROR
int GL_NO_ERROR
To view the source code for org.lwjgl.opengl GL11 GL_NO_ERROR.
Click Source Link
From source file:kuake2.render.lwjgl.Main.java
License:Open Source License
/** * R_Init2//from w w w . ja v a 2 s .c o m */ protected boolean R_Init2() { VID.MenuInit(); /* ** get our various GL strings */ gl_config.vendor_string = GL11.glGetString(GL11.GL_VENDOR); VID.Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n'); gl_config.renderer_string = GL11.glGetString(GL11.GL_RENDERER); VID.Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n'); gl_config.version_string = GL11.glGetString(GL11.GL_VERSION); VID.Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n'); gl_config.extensions_string = GL11.glGetString(GL11.GL_EXTENSIONS); VID.Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n'); gl_config.parseOpenGLVersion(); String renderer_buffer = gl_config.renderer_string.toLowerCase(); String vendor_buffer = gl_config.vendor_string.toLowerCase(); if (renderer_buffer.indexOf("voodoo") >= 0) { if (renderer_buffer.indexOf("rush") < 0) gl_config.renderer = GL_RENDERER_VOODOO; else gl_config.renderer = GL_RENDERER_VOODOO_RUSH; } else if (vendor_buffer.indexOf("sgi") >= 0) gl_config.renderer = GL_RENDERER_SGI; else if (renderer_buffer.indexOf("permedia") >= 0) gl_config.renderer = GL_RENDERER_PERMEDIA2; else if (renderer_buffer.indexOf("glint") >= 0) gl_config.renderer = GL_RENDERER_GLINT_MX; else if (renderer_buffer.indexOf("glzicd") >= 0) gl_config.renderer = GL_RENDERER_REALIZM; else if (renderer_buffer.indexOf("gdi") >= 0) gl_config.renderer = GL_RENDERER_MCD; else if (renderer_buffer.indexOf("pcx2") >= 0) gl_config.renderer = GL_RENDERER_PCX2; else if (renderer_buffer.indexOf("verite") >= 0) gl_config.renderer = GL_RENDERER_RENDITION; else gl_config.renderer = GL_RENDERER_OTHER; String monolightmap = gl_monolightmap.string.toUpperCase(); if (monolightmap.length() < 2 || monolightmap.charAt(1) != 'F') { if (gl_config.renderer == GL_RENDERER_PERMEDIA2) { Cvar.Set("gl_monolightmap", "A"); VID.Printf(Defines.PRINT_ALL, "...using gl_monolightmap 'a'\n"); } else if ((gl_config.renderer & GL_RENDERER_POWERVR) != 0) { Cvar.Set("gl_monolightmap", "0"); } else { Cvar.Set("gl_monolightmap", "0"); } } // power vr can't have anything stay in the framebuffer, so // the screen needs to redraw the tiled background every frame if ((gl_config.renderer & GL_RENDERER_POWERVR) != 0) { Cvar.Set("scr_drawall", "1"); } else { Cvar.Set("scr_drawall", "0"); } // MCD has buffering issues if (gl_config.renderer == GL_RENDERER_MCD) { Cvar.SetValue("gl_finish", 1); } if ((gl_config.renderer & GL_RENDERER_3DLABS) != 0) { if (gl_3dlabs_broken.value != 0.0f) gl_config.allow_cds = false; else gl_config.allow_cds = true; } else { gl_config.allow_cds = true; } if (gl_config.allow_cds) VID.Printf(Defines.PRINT_ALL, "...allowing CDS\n"); else VID.Printf(Defines.PRINT_ALL, "...disabling CDS\n"); /* ** grab extensions */ if (gl_config.extensions_string.indexOf("GL_EXT_compiled_vertex_array") >= 0 || gl_config.extensions_string.indexOf("GL_SGI_compiled_vertex_array") >= 0) { VID.Printf(Defines.PRINT_ALL, "...enabling GL_EXT_compiled_vertex_array\n"); // qglLockArraysEXT = ( void * ) qwglGetProcAddress( "glLockArraysEXT" ); if (gl_ext_compiled_vertex_array.value != 0.0f) qglLockArraysEXT = true; else qglLockArraysEXT = false; // qglUnlockArraysEXT = ( void * ) qwglGetProcAddress( "glUnlockArraysEXT" ); //qglUnlockArraysEXT = true; } else { VID.Printf(Defines.PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n"); qglLockArraysEXT = false; } if (gl_config.extensions_string.indexOf("WGL_EXT_swap_control") >= 0) { qwglSwapIntervalEXT = true; VID.Printf(Defines.PRINT_ALL, "...enabling WGL_EXT_swap_control\n"); } else { qwglSwapIntervalEXT = false; VID.Printf(Defines.PRINT_ALL, "...WGL_EXT_swap_control not found\n"); } if (gl_config.extensions_string.indexOf("GL_EXT_point_parameters") >= 0) { if (gl_ext_pointparameters.value != 0.0f) { // qglPointParameterfEXT = ( void (APIENTRY *)( GLenum, GLfloat ) ) qwglGetProcAddress( "glPointParameterfEXT" ); qglPointParameterfEXT = true; // qglPointParameterfvEXT = ( void (APIENTRY *)( GLenum, const GLfloat * ) ) qwglGetProcAddress( "glPointParameterfvEXT" ); VID.Printf(Defines.PRINT_ALL, "...using GL_EXT_point_parameters\n"); } else { VID.Printf(Defines.PRINT_ALL, "...ignoring GL_EXT_point_parameters\n"); } } else { VID.Printf(Defines.PRINT_ALL, "...GL_EXT_point_parameters not found\n"); } // #ifdef __linux__ // if ( strstr( gl_config.extensions_string, "3DFX_set_global_palette" )) // { // if ( gl_ext_palettedtexture->value ) // { // VID.Printf( Defines.PRINT_ALL, "...using 3DFX_set_global_palette\n" ); // qgl3DfxSetPaletteEXT = ( void ( APIENTRY * ) (GLuint *) )qwglGetProcAddress( "gl3DfxSetPaletteEXT" ); //// qglColorTableEXT = Fake_glColorTableEXT; // } // else // { // VID.Printf( Defines.PRINT_ALL, "...ignoring 3DFX_set_global_palette\n" ); // } // } // else // { // VID.Printf( Defines.PRINT_ALL, "...3DFX_set_global_palette not found\n" ); // } // #endif if (!qglColorTableEXT && gl_config.extensions_string.indexOf("GL_EXT_paletted_texture") >= 0 && gl_config.extensions_string.indexOf("GL_EXT_shared_texture_palette") >= 0) { if (gl_ext_palettedtexture.value != 0.0f) { VID.Printf(Defines.PRINT_ALL, "...using GL_EXT_shared_texture_palette\n"); qglColorTableEXT = false; // true; TODO jogl bug } else { VID.Printf(Defines.PRINT_ALL, "...ignoring GL_EXT_shared_texture_palette\n"); qglColorTableEXT = false; } } else { VID.Printf(Defines.PRINT_ALL, "...GL_EXT_shared_texture_palette not found\n"); } if (gl_config.extensions_string.indexOf("GL_ARB_multitexture") >= 0) { VID.Printf(Defines.PRINT_ALL, "...using GL_ARB_multitexture\n"); qglActiveTextureARB = true; GL_TEXTURE0 = ARBMultitexture.GL_TEXTURE0_ARB; GL_TEXTURE1 = ARBMultitexture.GL_TEXTURE1_ARB; } else { VID.Printf(Defines.PRINT_ALL, "...GL_ARB_multitexture not found\n"); } if (!(qglActiveTextureARB)) return false; GL_SetDefaultState(); GL_InitImages(); Mod_Init(); R_InitParticleTexture(); Draw_InitLocal(); int err = GL11.glGetError(); if (err != GL11.GL_NO_ERROR) VID.Printf(Defines.PRINT_ALL, "glGetError() = 0x%x\n\t%s\n", new Vargs(2).add(err).add("" + GL11.glGetString(err))); return true; }
From source file:main.java.com.YeAJG.game.Game.java
License:Open Source License
public static void exitOnGLError(String errorMessage) { int errorValue = GL11.glGetError(); if (errorValue != GL11.GL_NO_ERROR) { String errorString = GLU.gluErrorString(errorValue); logger.error(errorMessage + ": " + errorString); if (Display.isCreated()) Display.destroy();//ww w . ja v a2s . c o m System.exit(-1); } }
From source file:org.bonsaimind.badgersvoyage.tools.planetstudio.ErrorChecker.java
License:Open Source License
public static void exitOnOpenGlError(String message) { int error = GL11.glGetError(); if (error != GL11.GL_NO_ERROR) { System.err.println(message); System.err.println(GLU.gluErrorString(error)); System.exit(-1);/*w ww . java 2 s . c o m*/ } }
From source file:org.free.jake2.render.lwjgl.Main.java
License:Open Source License
/** * R_Init2//from w w w . j ava 2s.com */ protected boolean R_Init2() { VID.MenuInit(); /* ** get our various GL strings */ gl_config.vendor_string = GL11.glGetString(GL11.GL_VENDOR); VID.Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n'); gl_config.renderer_string = GL11.glGetString(GL11.GL_RENDERER); VID.Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n'); gl_config.version_string = GL11.glGetString(GL11.GL_VERSION); VID.Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n'); gl_config.extensions_string = GL11.glGetString(GL11.GL_EXTENSIONS); VID.Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n'); gl_config.parseOpenGLVersion(); String renderer_buffer = gl_config.renderer_string.toLowerCase(); String vendor_buffer = gl_config.vendor_string.toLowerCase(); if (renderer_buffer.indexOf("voodoo") >= 0) { if (renderer_buffer.indexOf("rush") < 0) { gl_config.renderer = GL_RENDERER_VOODOO; } else { gl_config.renderer = GL_RENDERER_VOODOO_RUSH; } } else if (vendor_buffer.indexOf("sgi") >= 0) { gl_config.renderer = GL_RENDERER_SGI; } else if (renderer_buffer.indexOf("permedia") >= 0) { gl_config.renderer = GL_RENDERER_PERMEDIA2; } else if (renderer_buffer.indexOf("glint") >= 0) { gl_config.renderer = GL_RENDERER_GLINT_MX; } else if (renderer_buffer.indexOf("glzicd") >= 0) { gl_config.renderer = GL_RENDERER_REALIZM; } else if (renderer_buffer.indexOf("gdi") >= 0) { gl_config.renderer = GL_RENDERER_MCD; } else if (renderer_buffer.indexOf("pcx2") >= 0) { gl_config.renderer = GL_RENDERER_PCX2; } else if (renderer_buffer.indexOf("verite") >= 0) { gl_config.renderer = GL_RENDERER_RENDITION; } else { gl_config.renderer = GL_RENDERER_OTHER; } String monolightmap = gl_monolightmap.string.toUpperCase(); if (monolightmap.length() < 2 || monolightmap.charAt(1) != 'F') { if (gl_config.renderer == GL_RENDERER_PERMEDIA2) { Cvar.Set("gl_monolightmap", "A"); VID.Printf(Defines.PRINT_ALL, "...using gl_monolightmap 'a'\n"); } else if ((gl_config.renderer & GL_RENDERER_POWERVR) != 0) { Cvar.Set("gl_monolightmap", "0"); } else { Cvar.Set("gl_monolightmap", "0"); } } // power vr can't have anything stay in the framebuffer, so // the screen needs to redraw the tiled background every frame if ((gl_config.renderer & GL_RENDERER_POWERVR) != 0) { Cvar.Set("scr_drawall", "1"); } else { Cvar.Set("scr_drawall", "0"); } // MCD has buffering issues if (gl_config.renderer == GL_RENDERER_MCD) { Cvar.SetValue("gl_finish", 1); } if ((gl_config.renderer & GL_RENDERER_3DLABS) != 0) { if (gl_3dlabs_broken.value != 0.0f) { gl_config.allow_cds = false; } else { gl_config.allow_cds = true; } } else { gl_config.allow_cds = true; } if (gl_config.allow_cds) { VID.Printf(Defines.PRINT_ALL, "...allowing CDS\n"); } else { VID.Printf(Defines.PRINT_ALL, "...disabling CDS\n"); } /* ** grab extensions */ if (gl_config.extensions_string.indexOf("GL_EXT_compiled_vertex_array") >= 0 || gl_config.extensions_string.indexOf("GL_SGI_compiled_vertex_array") >= 0) { VID.Printf(Defines.PRINT_ALL, "...enabling GL_EXT_compiled_vertex_array\n"); // qglLockArraysEXT = ( void * ) qwglGetProcAddress( "glLockArraysEXT" ); if (gl_ext_compiled_vertex_array.value != 0.0f) { qglLockArraysEXT = true; } else { qglLockArraysEXT = false; } // qglUnlockArraysEXT = ( void * ) qwglGetProcAddress( "glUnlockArraysEXT" ); //qglUnlockArraysEXT = true; } else { VID.Printf(Defines.PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n"); qglLockArraysEXT = false; } if (gl_config.extensions_string.indexOf("WGL_EXT_swap_control") >= 0) { qwglSwapIntervalEXT = true; VID.Printf(Defines.PRINT_ALL, "...enabling WGL_EXT_swap_control\n"); } else { qwglSwapIntervalEXT = false; VID.Printf(Defines.PRINT_ALL, "...WGL_EXT_swap_control not found\n"); } if (gl_config.extensions_string.indexOf("GL_EXT_point_parameters") >= 0) { if (gl_ext_pointparameters.value != 0.0f) { // qglPointParameterfEXT = ( void (APIENTRY *)( GLenum, GLfloat ) ) qwglGetProcAddress( "glPointParameterfEXT" ); qglPointParameterfEXT = true; // qglPointParameterfvEXT = ( void (APIENTRY *)( GLenum, const GLfloat * ) ) qwglGetProcAddress( "glPointParameterfvEXT" ); VID.Printf(Defines.PRINT_ALL, "...using GL_EXT_point_parameters\n"); } else { VID.Printf(Defines.PRINT_ALL, "...ignoring GL_EXT_point_parameters\n"); } } else { VID.Printf(Defines.PRINT_ALL, "...GL_EXT_point_parameters not found\n"); } // #ifdef __linux__ // if ( strstr( gl_config.extensions_string, "3DFX_set_global_palette" )) // { // if ( gl_ext_palettedtexture->value ) // { // VID.Printf( Defines.PRINT_ALL, "...using 3DFX_set_global_palette\n" ); // qgl3DfxSetPaletteEXT = ( void ( APIENTRY * ) (GLuint *) )qwglGetProcAddress( "gl3DfxSetPaletteEXT" ); //// qglColorTableEXT = Fake_glColorTableEXT; // } // else // { // VID.Printf( Defines.PRINT_ALL, "...ignoring 3DFX_set_global_palette\n" ); // } // } // else // { // VID.Printf( Defines.PRINT_ALL, "...3DFX_set_global_palette not found\n" ); // } // #endif if (!qglColorTableEXT && gl_config.extensions_string.indexOf("GL_EXT_paletted_texture") >= 0 && gl_config.extensions_string.indexOf("GL_EXT_shared_texture_palette") >= 0) { if (gl_ext_palettedtexture.value != 0.0f) { VID.Printf(Defines.PRINT_ALL, "...using GL_EXT_shared_texture_palette\n"); qglColorTableEXT = false; // true; TODO jogl bug } else { VID.Printf(Defines.PRINT_ALL, "...ignoring GL_EXT_shared_texture_palette\n"); qglColorTableEXT = false; } } else { VID.Printf(Defines.PRINT_ALL, "...GL_EXT_shared_texture_palette not found\n"); } if (gl_config.extensions_string.indexOf("GL_ARB_multitexture") >= 0) { VID.Printf(Defines.PRINT_ALL, "...using GL_ARB_multitexture\n"); qglActiveTextureARB = true; GL_TEXTURE0 = ARBMultitexture.GL_TEXTURE0_ARB; GL_TEXTURE1 = ARBMultitexture.GL_TEXTURE1_ARB; } else { VID.Printf(Defines.PRINT_ALL, "...GL_ARB_multitexture not found\n"); } if (!(qglActiveTextureARB)) { return false; } GL_SetDefaultState(); GL_InitImages(); Mod_Init(); R_InitParticleTexture(); Draw_InitLocal(); int err = GL11.glGetError(); if (err != GL11.GL_NO_ERROR) { VID.Printf(Defines.PRINT_ALL, "glGetError() = 0x%x\n\t%s\n", new Vargs(2).add(err).add("" + GL11.glGetString(err))); } return true; }
From source file:org.jogamp.glg2d.GLG2DUtils.java
License:Apache License
public static void logGLError() { int error = GL11.glGetError(); if (error != GL11.GL_NO_ERROR) { LOGGER.log(Level.SEVERE, "GL Error: code " + error); }/*from ww w .j a v a 2 s . c o m*/ }
From source file:org.jogamp.glg2d.impl.shader.AbstractShaderPipeline.java
License:Apache License
protected int compileShader(int type, ByteBuffer src) throws ShaderException { int id = GL20.glCreateShader(type); GL20.glShaderSource(id, src);/* w ww. ja v a2s . c o m*/ int err = GL11.glGetError(); if (err != GL11.GL_NO_ERROR) { throw new ShaderException("Shader source failed, GL Error: 0x" + Integer.toHexString(err)); } GL20.glCompileShader(id); err = GL11.glGetError(); if (err != GL11.GL_NO_ERROR) { throw new ShaderException("Compile failed, GL Error: 0x" + Integer.toHexString(err)); } return id; }
From source file:render.Quad.java
public void initShaders() { int errValue; ShaderHandler help = new ShaderHandler(); vsId = help.readShader("./shader/VertexShader.glsl", GL.GL_VERTEX_SHADER); fsId = help.readShader("./shader/FragmentShader.glsl", GL.GL_FRAGMENT_SHADER); programId = GL.glCreateProgram();//from w ww . j a va2 s .c om GL.glAttachShader(programId, vsId); GL.glAttachShader(programId, fsId); GL.glBindAttribLocation(programId, 0, "inPos"); GL.glBindAttribLocation(programId, 1, "inColor"); GL.glLinkProgram(programId); GL20.glValidateProgram(programId); errValue = GL.glGetError(); if (errValue != GL11.GL_NO_ERROR) { System.out.println("Shader creation failed" + GLU.gluErrorString(errValue)); System.exit(-1); } }
From source file:terminal.gld.GLDisplay.java
License:Open Source License
public static void run() { try {//from w w w . ja va 2 s. co m Display.setDisplayMode(new DisplayMode(Settings.getGlX(), Settings.getGlY())); Display.setFullscreen(true); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); } try { Keyboard.create(); } catch (LWJGLException e) { e.printStackTrace(); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); glEnable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); glLoadIdentity(); GLU.gluPerspective(80, Settings.getGlX() / (float) Settings.getGlY(), 1f, 500f); glMatrixMode(GL_MODELVIEW); exit: { while (!Display.isCloseRequested()) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); GLDrawer.draw(); Display.update(); Display.sync(fps); int e = glGetError(); if (e != GL11.GL_NO_ERROR) System.out.println(e + " f " + org.lwjgl.opengl.Util.translateGLErrorString(e)); if (Keyboard.isKeyDown(Keyboard.KEY_END)) break exit; } Display.destroy(); Keyboard.destroy(); } Display.destroy(); Keyboard.destroy(); System.exit(9999); }
From source file:terminal.gld.GLDungeonDraw.java
License:Open Source License
private static void drawHUD() { glDisable(GL_FOG);/*from w w w. j a v a 2 s.com*/ String s = ""; s = entity.player.Display.getDispLine(); int e = glGetError(); if (e != GL11.GL_NO_ERROR) System.out.println(e + " h " + org.lwjgl.opengl.Util.translateGLErrorString(e)); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); GL11.glOrtho(0, 800, 0, 600, 1, -1); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glClear(GL_DEPTH_BUFFER_BIT); // glColor3f(1, 0, 0); String str = cleanstr(s); GLDrawer.fnt.drawString(10, 130, str, 0, str.length() - 1, .35f, .35f, TrueTypeFont.ALIGN_LEFT, mkcolarr(s)); glPopMatrix(); glMatrixMode(GL_PROJECTION); glPopMatrix(); // glLoadIdentity(); // GLU.gluPerspective(80, 1366 / 786, 1f, 500f); glMatrixMode(GL_MODELVIEW); }
From source file:thebounzer.org.lwgldemo.glutils.ShaderProgram.java
License:Open Source License
private boolean validateProgram(int programId) { GL20.glLinkProgram(programId);//ww w .ja v a 2 s.c om GL20.glValidateProgram(programId); boolean result = true; int errorCheckValue = GL11.glGetError(); if (errorCheckValue != GL11.GL_NO_ERROR) { logger.log(Level.SEVERE, "ERROR - Could not create the shaders:{0}", GLU.gluErrorString(errorCheckValue)); result = false; } return result; }