List of usage examples for org.lwjgl.opengl GL11 glBegin
public static native void glBegin(@NativeType("GLenum") int mode);
From source file:io.flob.blackheart.ICollectable.java
License:Open Source License
@Override public void _render() { GL11.glEnd();// w w w.ja va 2s . com if (texture == null) { texture = TextureLibrary.placeholder; } GL11.glPushMatrix(); GL11.glTranslatef(position.getX(), position.getY(), position.getZ()); FloatBuffer modelview = BufferUtils.createFloatBuffer(16); GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview); for (int i = 0; i < 3; i += 2) { for (int j = 0; j < 3; j++) { if (i == j) { modelview.put(i * 4 + j, 1.0f); } else { modelview.put(i * 4 + j, 0.0f); } } } GL11.glLoadMatrix(modelview); GL11.glBegin(GL11.GL_QUADS); GL11.glNormal3f(0f, 0f, 1f); GL11.glTexCoord2f(texture.getU(), texture.getV2()); GL11.glVertex2f(-size, -size); GL11.glTexCoord2f(texture.getU2(), texture.getV2()); GL11.glVertex2f(size, -size); GL11.glTexCoord2f(texture.getU2(), texture.getV()); GL11.glVertex2f(size, size); GL11.glTexCoord2f(texture.getU(), texture.getV()); GL11.glVertex2f(-size, size); GL11.glEnd(); GL11.glPopMatrix(); GL11.glBegin(GL11.GL_QUADS); }
From source file:io.flob.blackheart.Level.java
License:Open Source License
public void tick() throws Exception { if (display_list_dirty) { load_display_list();//ww w . ja va2s . c o m } ByteBuffer temp = ByteBuffer.allocateDirect(16); temp.order(ByteOrder.nativeOrder()); float fog_colour[] = new float[] { 0f, 0f, 0f, 0f }; GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP); temp.asFloatBuffer().put(fog_colour).flip(); GL11.glFog(GL11.GL_FOG_COLOR, temp.asFloatBuffer()); GL11.glFogf(GL11.GL_FOG_DENSITY, 0.25f); GL11.glHint(GL11.GL_FOG_HINT, GL11.GL_DONT_CARE); GL11.glFogf(GL11.GL_FOG_START, 0); GL11.glFogf(GL11.GL_FOG_END, 200); _barry.tick(); try { Collections.sort(objects_dynamic, this.sort_objects); } catch (Exception ex) { Output.error(ex.getMessage()); } if (Debug.collision_boxs) { _game._core._display.flush_texture(); for (int count = 0; count < objects_static.size(); count++) { if (objects_static.get(count) instanceof ICollidable) { ICollidable objcet = (ICollidable) objects_static.get(count); objcet.collision_box().render(); } } for (int count = 0; count < objects_dynamic.size(); count++) { if (objects_dynamic.get(count) instanceof ICollidable) { ICollidable objcet = (ICollidable) objects_dynamic.get(count); objcet.collision_box().render(); } } _barry.collision_box().render(); _barry.ray_picker().collision_box().render(); } GL11.glPushMatrix(); _game._core._texture.game_atlas.bind(); if (_game.anaglyph()) { GL11.glTranslatef(1 * 0.03f, 0, 0); GL11.glColorMask(true, false, false, true); } GL11.glBegin(GL11.GL_QUADS); GL11.glCallList(display_list); for (int count = 0; count < objects_dynamic.size(); count++) { objects_dynamic.get(count).tick(); } GL11.glEnd(); if (_game.anaglyph()) { GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glColorMask(false, true, true, true); GL11.glTranslatef(-1 * 0.03f, 0, 0); GL11.glBegin(GL11.GL_QUADS); GL11.glCallList(display_list); for (int count = 0; count < objects_dynamic.size(); count++) { objects_dynamic.get(count)._render(); } GL11.glEnd(); GL11.glColorMask(true, true, true, true); } GL11.glPopMatrix(); for (int count = 0; count < objects_dynamic.size(); count++) { if (objects_dynamic.get(count).IRemove()) { objects_dynamic.remove(count); } } _hud.tick(); if (_barry.health() <= 0) { _game._core.state(_game._core._game_dead); } }
From source file:io.flob.blackheart.Level.java
License:Open Source License
public void _render() throws Exception { // assume the texture is already bound _barry._look_through();/* w w w .j a v a2s. c o m*/ GL11.glBegin(GL11.GL_QUADS); GL11.glCallList(display_list); for (int count = 0; count < objects_dynamic.size(); count++) { objects_dynamic.get(count)._render(); } GL11.glEnd(); }
From source file:io.flob.blackheart.MobMachinegun.java
License:Open Source License
@Override public void _render() { GL11.glEnd();/* w w w. j a v a 2s . c o m*/ float size_x = size().getX() / 2f; float size_y = size().getY() / 2f + 0.025f; // HARD SET! GL11.glPushMatrix(); GL11.glTranslatef(position().getX(), position().getY(), position().getZ()); FloatBuffer modelview = BufferUtils.createFloatBuffer(16); GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview); for (int i = 0; i < 3; i += 2) { for (int j = 0; j < 3; j++) { if (i == j) { modelview.put(i * 4 + j, 1.0f); } else { modelview.put(i * 4 + j, 0.0f); } } } GL11.glLoadMatrix(modelview); GL11.glBegin(GL11.GL_QUADS); GL11.glNormal3f(0f, 0f, 1f); GL11.glTexCoord2f(texture[state].getU(), texture[state].getV2()); GL11.glVertex2f(-size_x, -size_y); GL11.glTexCoord2f(texture[state].getU2(), texture[state].getV2()); GL11.glVertex2f(size_x, -size_y); GL11.glTexCoord2f(texture[state].getU2(), texture[state].getV()); GL11.glVertex2f(size_x, size_y); GL11.glTexCoord2f(texture[state].getU(), texture[state].getV()); GL11.glVertex2f(-size_x, size_y); GL11.glEnd(); GL11.glPopMatrix(); GL11.glBegin(GL11.GL_QUADS); }
From source file:io.flob.blackheart.StateGameDead.java
License:Open Source License
@Override public void tick() throws Exception { _core._input.mouse(false);/*from w w w .j a v a 2 s .c o m*/ _core._texture.game_atlas.bind(); _core._game._level._render(); _core._display.mode_2D(); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(texture_background.getU(), texture_background.getV()); GL11.glVertex2f(0, 0); GL11.glTexCoord2f(texture_background.getU2(), texture_background.getV()); GL11.glVertex2f(_core._display.width(), 0); GL11.glTexCoord2f(texture_background.getU2(), texture_background.getV2()); GL11.glVertex2f(_core._display.width(), _core._display.height()); GL11.glTexCoord2f(texture_background.getU(), texture_background.getV2()); GL11.glVertex2f(0, _core._display.height()); button_tryagain.tick(); GL11.glEnd(); _core._font.button.render_centred((int) button_tryagain.getCenterX(), (int) button_tryagain.getCenterY(), button_tryagain_text); // Title _core._font.title.render_centred(_core._display.width() / 2, 80, title_text); _core._display.mode_3D(); if (button_tryagain.clicked()) { Mouse.setCursorPosition((int) (button_tryagain.getX() + (button_tryagain.width() / 2)), (int) (button_tryagain.getY() - button_tryagain.height())); _core._game._level.reload(); } }
From source file:io.flob.blackheart.StateGameLevelComplete.java
License:Open Source License
private void render_background() { GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(texture_background.getU(), texture_background.getV()); GL11.glVertex2f(0, 0);// w w w . j a v a 2 s. co m GL11.glTexCoord2f(texture_background.getU2(), texture_background.getV()); GL11.glVertex2f(_core._display.width(), 0); GL11.glTexCoord2f(texture_background.getU2(), texture_background.getV2()); GL11.glVertex2f(_core._display.width(), _core._display.height()); GL11.glTexCoord2f(texture_background.getU(), texture_background.getV2()); GL11.glVertex2f(0, _core._display.height()); }
From source file:io.flob.blackheart.StateSplash.java
License:Open Source License
@Override public void tick() throws Exception { _core._display.prepare();// w ww .j a v a2 s.c om _core._display.mode_2D(); Texture texture = TextureLoader.getTexture("PNG", getClass().getResourceAsStream("image/splash/flob.png")); texture.bind(); int x1 = (_core._display.width() / 2) - (texture.getTextureWidth() / 2); int y1 = (_core._display.height() / 2) - (texture.getTextureHeight() / 2); int x2 = (_core._display.width() / 2) + (texture.getTextureWidth() / 2); int y2 = (_core._display.height() / 2) + (texture.getTextureHeight() / 2); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2i(x1, y1); GL11.glTexCoord2f(1, 0); GL11.glVertex2i(x2, y1); GL11.glTexCoord2f(1, 1); GL11.glVertex2i(x2, y2); GL11.glTexCoord2f(0, 1); GL11.glVertex2i(x1, y2); GL11.glEnd(); _core._display.mode_3D(); _core._display.update(); }
From source file:io.flob.blackheart.StateTitle.java
License:Open Source License
private void render_background() { Texture texture = _core._texture.title_background; texture.bind();/* w w w . j a v a 2 s. c om*/ GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2i(0, 0); GL11.glTexCoord2f(1, 0); GL11.glVertex2i(texture.getTextureWidth(), 0); GL11.glTexCoord2f(1, 1); GL11.glVertex2i(texture.getTextureWidth(), texture.getTextureHeight()); GL11.glTexCoord2f(0, 1); GL11.glVertex2i(0, texture.getTextureHeight()); GL11.glEnd(); // Due to a limit in the font size the title_overlay has to be an image texture = _core._texture.title_overlay; texture.bind(); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2i(0, 0); GL11.glTexCoord2f(1, 0); GL11.glVertex2i(texture.getTextureWidth(), 0); GL11.glTexCoord2f(1, 1); GL11.glVertex2i(texture.getTextureWidth(), texture.getTextureHeight()); GL11.glTexCoord2f(0, 1); GL11.glVertex2i(0, texture.getTextureHeight()); GL11.glEnd(); }
From source file:io.flob.blackheart.StateTitle.java
License:Open Source License
private void render_buttons() { _core._texture.game_atlas.bind();//from ww w . j a va 2s. co m GL11.glBegin(GL11.GL_QUADS); button_mute.active(_core._sound.mute()); button_mute.tick(); button_help.tick(); button_anaglyph.active(_core._game.anaglyph); button_anaglyph.tick(); button_facebook.tick(); button_mouse_invert.active(_core._game.mouse_invert == 1); button_mouse_invert.tick(); button_play.tick(); GL11.glEnd(); }
From source file:io.flob.blackheart.StateTitleHelp.java
License:Open Source License
private void render_background() { Texture texture = _core._texture.title_background; texture.bind();/*from w w w .ja va 2 s . c o m*/ GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2i(0, 0); GL11.glTexCoord2f(1, 0); GL11.glVertex2i(texture.getTextureWidth(), 0); GL11.glTexCoord2f(1, 1); GL11.glVertex2i(texture.getTextureWidth(), texture.getTextureHeight()); GL11.glTexCoord2f(0, 1); GL11.glVertex2i(0, texture.getTextureHeight()); GL11.glEnd(); texture = _core._texture.title_help; texture.bind(); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2i(0, 0); GL11.glTexCoord2f(1, 0); GL11.glVertex2i(texture.getTextureWidth(), 0); GL11.glTexCoord2f(1, 1); GL11.glVertex2i(texture.getTextureWidth(), texture.getTextureHeight()); GL11.glTexCoord2f(0, 1); GL11.glVertex2i(0, texture.getTextureHeight()); GL11.glEnd(); }