List of usage examples for org.lwjgl.opengl GL11 glDrawBuffer
public static void glDrawBuffer(@NativeType("GLenum") int buf)
From source file:com.ardor3d.renderer.lwjgl.LwjglRenderer.java
License:Open Source License
public void setDrawBuffer(final DrawBufferTarget target) { final RendererRecord record = ContextManager.getCurrentContext().getRendererRecord(); if (record.getDrawBufferTarget() != target) { int buffer = GL11.GL_BACK; switch (target) { case Back: break; case Front: buffer = GL11.GL_FRONT;//w w w . j a v a 2 s . c o m break; case BackLeft: buffer = GL11.GL_BACK_LEFT; break; case BackRight: buffer = GL11.GL_BACK_RIGHT; break; case FrontLeft: buffer = GL11.GL_FRONT_LEFT; break; case FrontRight: buffer = GL11.GL_FRONT_RIGHT; break; case FrontAndBack: buffer = GL11.GL_FRONT_AND_BACK; break; case Left: buffer = GL11.GL_LEFT; break; case Right: buffer = GL11.GL_RIGHT; break; case Aux0: buffer = GL11.GL_AUX0; break; case Aux1: buffer = GL11.GL_AUX1; break; case Aux2: buffer = GL11.GL_AUX2; break; case Aux3: buffer = GL11.GL_AUX3; break; } GL11.glDrawBuffer(buffer); record.setDrawBufferTarget(target); } }
From source file:com.ardor3d.renderer.lwjgl.LwjglTextureRenderer.java
License:Open Source License
private void setDrawBuffer(final int attachVal) { GL11.glDrawBuffer(attachVal); }
From source file:com.grillecube.client.opengl.GLH.java
public static void glhDrawBuffer(int buf) { GL11.glDrawBuffer(buf); }
From source file:com.opengrave.og.light.Depth2DFramebuffer.java
License:Open Source License
public Depth2DFramebuffer(int size) { framebufferSize = size;/* w w w. jav a2s . co m*/ framebuffer = GL30.glGenFramebuffers(); GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, framebuffer); shadowMap = new Texture2DShadowMap(framebufferSize); shadowMap.bindToFrameBuffer(); // GL11.glDrawBuffer(GL30.GL_COLOR_ATTACHMENT0); GL11.glDrawBuffer(GL11.GL_NONE); Util.checkErr(); GL11.glReadBuffer(GL11.GL_NONE); int i = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER); if (i != GL30.GL_FRAMEBUFFER_COMPLETE) { throw new RuntimeException("Framebuffer creation failed with code: " + i); } GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); // TESTING STUFF count = 2; FloatBuffer pos = BufferUtils.createFloatBuffer(3 * 3 * count); FloatBuffer tex = BufferUtils.createFloatBuffer(2 * 3 * count); pos.put(0.75f).put(0.75f).put(0f); pos.put(0.75f).put(0.25f).put(0f); pos.put(0.25f).put(0.75f).put(0f); pos.put(0.25f).put(0.25f).put(0f); pos.put(0.75f).put(0.25f).put(0f); pos.put(0.25f).put(0.75f).put(0f); pos.flip(); tex.put(1f).put(1f); tex.put(1f).put(0f); tex.put(0f).put(1f); tex.put(0f).put(0f); tex.put(1f).put(0f); tex.put(0f).put(1f); tex.flip(); vao_ID = GL30.glGenVertexArrays(); GL30.glBindVertexArray(vao_ID); int vbo_pos_ID = GL15.glGenBuffers(); int vbo_tex_ID = GL15.glGenBuffers(); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo_pos_ID); GL15.glBufferData(GL15.GL_ARRAY_BUFFER, pos, GL15.GL_STATIC_DRAW); GL20.glVertexAttribPointer(0, 3, GL11.GL_FLOAT, false, 0, 0); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo_tex_ID); GL15.glBufferData(GL15.GL_ARRAY_BUFFER, tex, GL15.GL_STATIC_DRAW); GL20.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, 0, 0); }
From source file:com.opengrave.og.light.DepthCubeFramebuffer.java
License:Open Source License
public DepthCubeFramebuffer(int size) { framebufferSize = size;//from w ww . ja v a 2s . com framebuffer = GL30.glGenFramebuffers(); // System.out.println("Creating Pointlight Framebuffer : " + // framebuffer); GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, framebuffer); shadowMap = new TextureCubeShadowMap(framebufferSize); // shadowMap.bindToFrameBuffer(); shadowMap.bindToFrameBuffer(0); // GL11.glDrawBuffer(GL30.GL_COLOR_ATTACHMENT0); GL11.glDrawBuffer(GL11.GL_NONE); Util.checkErr(); GL11.glReadBuffer(GL11.GL_NONE); int i = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER); if (i != GL30.GL_FRAMEBUFFER_COMPLETE) { throw new RuntimeException("Framebuffer creation failed with code: " + i); } GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); Util.checkErr(); }
From source file:eu.over9000.veya.rendering.Shadow.java
License:Open Source License
public void init() { depthMap = GL11.glGenTextures();//w w w. j a v a 2 s .c om GL11.glBindTexture(GL11.GL_TEXTURE_2D, depthMap); GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL13.GL_CLAMP_TO_BORDER); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL13.GL_CLAMP_TO_BORDER); shadowFBO = GL30.glGenFramebuffers(); GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, shadowFBO); GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL11.GL_TEXTURE_2D, depthMap, 0); GL11.glDrawBuffer(GL11.GL_NONE); GL11.glReadBuffer(GL11.GL_NONE); GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); }
From source file:fr.ign.cogit.geoxygene.appli.render.LwjglLayerRenderer.java
License:Open Source License
/** * Initialize layer FBO to receive GL primitives from a set of identical * symbolizers/*from w w w .j a v a 2s .co m*/ * * @param primitive * @param opacity * @param currentSymbolizer * @throws GLException */ private void clearFBOLayer() throws GLException { GLTools.glCheckError("preparing next FBO Layer"); GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, this.getLayerViewPanel().getGLCanvas().getFboId()); GL11.glDrawBuffer(GL30.GL_COLOR_ATTACHMENT0); GLTools.glCheckError("bind frame buffer"); // Blending mode in FBO drawing. GLTools.glCheckError("finalizing FBO initialization"); GL11.glClearColor(0f, 0f, 0f, 0f); GLTools.glCheckError("finalizing FBO initialization"); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); GLTools.glCheckError("finalizing FBO initialization"); glEnable(GL11.GL_BLEND); GLTools.glCheckError("finalizing FBO initialization"); GL20.glBlendEquationSeparate(GL14.GL_FUNC_ADD, GL14.GL_MAX); GLTools.glCheckError("finalizing FBO initialization"); GL14.glBlendFuncSeparate(GL11.GL_ONE, GL11.GL_ZERO, GL11.GL_ZERO, GL11.GL_ZERO); GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, 0); GLTools.glCheckError("finalizing FBO initialization"); }
From source file:jake2.desktop.LWJGLAdapter.java
License:Open Source License
@Override public void glDrawBuffer(int mode) { GL11.glDrawBuffer(mode); }
From source file:kuake2.render.lwjgl.Main.java
License:Open Source License
/** * R_BeginFrame/* ww w . jav a2 s . c om*/ */ protected void R_BeginFrame(float camera_separation) { gl_state.camera_separation = camera_separation; /* ** change modes if necessary */ if (gl_mode.modified || vid_fullscreen.modified) { // FIXME: only restart if CDS is required cvar_t ref; ref = Cvar.Get("vid_ref", "lwjgl", 0); ref.modified = true; } if (gl_log.modified) { GLimp_EnableLogging((gl_log.value != 0.0f)); gl_log.modified = false; } if (gl_log.value != 0.0f) { GLimp_LogNewFrame(); } /* ** update 3Dfx gamma -- it is expected that a user will do a vid_restart ** after tweaking this value */ if (vid_gamma.modified) { vid_gamma.modified = false; if ((gl_config.renderer & GL_RENDERER_VOODOO) != 0) { // wird erstmal nicht gebraucht /* char envbuffer[1024]; float g; g = 2.00 * ( 0.8 - ( vid_gamma->value - 0.5 ) ) + 1.0F; Com_sprintf( envbuffer, sizeof(envbuffer), "SSTV2_GAMMA=%f", g ); putenv( envbuffer ); Com_sprintf( envbuffer, sizeof(envbuffer), "SST_GAMMA=%f", g ); putenv( envbuffer ); */ VID.Printf(Defines.PRINT_DEVELOPER, "gamma anpassung fuer VOODOO nicht gesetzt"); } } GLimp_BeginFrame(camera_separation); /* ** go into 2D mode */ GL11.glViewport(0, 0, vid.width, vid.height); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, vid.width, vid.height, 0, -99999, 99999); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glColor4f(1, 1, 1, 1); /* ** draw buffer stuff */ if (gl_drawbuffer.modified) { gl_drawbuffer.modified = false; if (gl_state.camera_separation == 0 || !gl_state.stereo_enabled) { if (gl_drawbuffer.string.equalsIgnoreCase("GL_FRONT")) GL11.glDrawBuffer(GL11.GL_FRONT); else GL11.glDrawBuffer(GL11.GL_BACK); } } /* ** texturemode stuff */ if (gl_texturemode.modified) { GL_TextureMode(gl_texturemode.string); gl_texturemode.modified = false; } if (gl_texturealphamode.modified) { GL_TextureAlphaMode(gl_texturealphamode.string); gl_texturealphamode.modified = false; } if (gl_texturesolidmode.modified) { GL_TextureSolidMode(gl_texturesolidmode.string); gl_texturesolidmode.modified = false; } /* ** swapinterval stuff */ GL_UpdateSwapInterval(); // // clear screen if desired // R_Clear(); }
From source file:lwjake2.render.lwjgl.Main.java
License:Open Source License
/** * R_BeginFrame/*from w ww . ja v a2s .com*/ */ protected void R_BeginFrame(float camera_separation) { gl_state.camera_separation = camera_separation; /* ** change modes if necessary */ if (gl_mode.modified || vid_fullscreen.modified) { // FIXME: only restart if CDS is required cvar_t ref; ref = Cvar.Get("vid_ref", "lwjgl", 0); ref.modified = true; } if (gl_log.modified) { GLimp_EnableLogging((gl_log.value != 0.0f)); gl_log.modified = false; } if (gl_log.value != 0.0f) { GLimp_LogNewFrame(); } /* ** update 3Dfx gamma -- it is expected that a user will do a vid_restart ** after tweaking this value */ if (vid_gamma.modified) { vid_gamma.modified = false; if ((gl_config.renderer & GL_RENDERER_VOODOO) != 0) { // wird erstmal nicht gebraucht /* char envbuffer[1024]; float g; g = 2.00 * ( 0.8 - ( vid_gamma->value - 0.5 ) ) + 1.0F; Com_sprintf( envbuffer, sizeof(envbuffer), "SSTV2_GAMMA=%f", g ); putenv( envbuffer ); Com_sprintf( envbuffer, sizeof(envbuffer), "SST_GAMMA=%f", g ); putenv( envbuffer ); */ VID.Printf(Defines.PRINT_DEVELOPER, "gamma anpassung fuer VOODOO nicht gesetzt"); } } GLimp_BeginFrame(camera_separation); /* ** go into 2D mode */ GL11.glViewport(0, 0, vid.width, vid.height); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, vid.width, vid.height, 0, -99999, 99999); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glColor4f(1, 1, 1, 1); /* ** draw buffer stuff */ if (gl_drawbuffer.modified) { gl_drawbuffer.modified = false; if (gl_state.camera_separation == 0 || !gl_state.stereo_enabled) { if (gl_drawbuffer.string.equalsIgnoreCase("GL_FRONT")) GL11.glDrawBuffer(GL11.GL_FRONT); else GL11.glDrawBuffer(GL11.GL_BACK); } } /* ** texturemode stuff */ if (gl_texturemode.modified) { GL_TextureMode(gl_texturemode.string); gl_texturemode.modified = false; } if (gl_texturealphamode.modified) { GL_TextureAlphaMode(gl_texturealphamode.string); gl_texturealphamode.modified = false; } if (gl_texturesolidmode.modified) { GL_TextureSolidMode(gl_texturesolidmode.string); gl_texturesolidmode.modified = false; } /* ** swapinterval stuff */ GL_UpdateSwapInterval(); // // clear screen if desired // R_Clear(); }