Java Code Examples for android.opengl.GLES11#glLightfv()
The following examples show how to use
android.opengl.GLES11#glLightfv() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CobraMkIII.java From Alite with GNU General Public License v3.0 | 6 votes |
@Override protected void init() { GLES11.glLightfv(GLES11.GL_LIGHT3, GLES11.GL_AMBIENT, lightAmbient, 0); GLES11.glLightfv(GLES11.GL_LIGHT3, GLES11.GL_DIFFUSE, lightAmbient, 0); GLES11.glLightfv(GLES11.GL_LIGHT3, GLES11.GL_SPECULAR, lightSpecular, 0); GLES11.glLightfv(GLES11.GL_LIGHT3, GLES11.GL_POSITION, lightPosition, 0); GLES11.glLightf(GLES11.GL_LIGHT3, GLES11.GL_SPOT_CUTOFF, 35.0f); GLES11.glLightf(GLES11.GL_LIGHT3, GLES11.GL_SPOT_EXPONENT, 100.0f); vertexBuffer = createFaces(VERTEX_DATA, NORMAL_DATA, 1, 0, 8, 2, 0, 1, 3, 1, 9, 4, 2, 1, 4, 1, 3, 4, 7, 6, 5, 0, 2, 5, 2, 6, 6, 2, 4, 7, 5, 6, 8, 0, 11, 8, 11, 5, 8, 5, 7, 8, 7, 4, 8, 4, 3, 8, 3, 10, 9, 1, 8, 9, 8, 10, 9, 10, 3, 11, 0, 5); texCoordBuffer = GlUtils.toFloatBufferPositionZero(TEXTURE_COORDINATE_DATA); alite.getTextureManager().addTexture(textureFilename); if (Settings.engineExhaust) { addExhaust(new EngineExhaust(this, 13, 13, 30, -50, 0, 0)); addExhaust(new EngineExhaust(this, 13, 13, 30, 50, 0, 0)); addExhaust(new EngineExhaust(this, 5, 5, 18, -115, 0, 0, 1.0f, 0.5f, 0.0f, 0.7f)); addExhaust(new EngineExhaust(this, 5, 5, 18, 115, 0, 0, 1.0f, 0.5f, 0.0f, 0.7f)); } initTargetBox(); }
Example 2
Source File: InGameManager.java From Alite with GNU General Public License v3.0 | 6 votes |
private void performViewTransformation(float deltaTime) { // Kudos to Quelo!! // Thanks for getting me started on OpenGL -- from simply // looking at this method, one cannot immediately grasp the // complexities of the ideas behind it. // And without Quelo, I certainly would not have understood! GLES11.glMatrixMode(GLES11.GL_MODELVIEW); GLES11.glLoadIdentity(); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_POSITION, lightPosition, 0); if (!paused) { ship.applyDeltaRotation((float) Math.toDegrees(deltaYawRollPitch.z * deltaTime), (float) Math.toDegrees(deltaYawRollPitch.x * deltaTime), (float) Math.toDegrees(deltaYawRollPitch.y * deltaTime)); } ship.orthoNormalize(); Matrix.invertM(viewMatrix, 0, ship.getMatrix(), 0); GLES11.glLoadMatrixf(viewMatrix, 0); }
Example 3
Source File: ShipEditorScreen.java From Alite with GNU General Public License v3.0 | 4 votes |
private void initGl() { Rect visibleArea = ((AndroidGraphics) game.getGraphics()).getVisibleArea(); int windowWidth = visibleArea.width(); int windowHeight = visibleArea.height(); float ratio = (float) windowWidth / (float) windowHeight; GlUtils.setViewport(visibleArea); GLES11.glDisable(GLES11.GL_FOG); GLES11.glPointSize(1.0f); GLES11.glLineWidth(1.0f); GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE_MINUS_SRC_ALPHA); GLES11.glDisable(GLES11.GL_BLEND); GLES11.glMatrixMode(GLES11.GL_PROJECTION); GLES11.glLoadIdentity(); GlUtils.gluPerspective(game, 45.0f, ratio, 1.0f, 900000.0f); GLES11.glMatrixMode(GLES11.GL_MODELVIEW); GLES11.glLoadIdentity(); GLES11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GLES11.glShadeModel(GLES11.GL_SMOOTH); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_AMBIENT, lightAmbient, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_DIFFUSE, lightDiffuse, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_SPECULAR, lightSpecular, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_POSITION, lightPosition, 0); GLES11.glEnable(GLES11.GL_LIGHT1); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_AMBIENT, sunLightAmbient, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_DIFFUSE, sunLightDiffuse, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_SPECULAR, sunLightSpecular, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_POSITION, sunLightPosition, 0); GLES11.glEnable(GLES11.GL_LIGHT2); GLES11.glEnable(GLES11.GL_LIGHTING); GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT); GLES11.glHint(GLES11.GL_PERSPECTIVE_CORRECTION_HINT, GLES11.GL_NICEST); GLES11.glHint(GLES11.GL_POLYGON_SMOOTH_HINT, GLES11.GL_NICEST); GLES11.glEnable(GLES11.GL_CULL_FACE); }
Example 4
Source File: ConstrictorScreen.java From Alite with GNU General Public License v3.0 | 4 votes |
private void initGl() { Rect visibleArea = ((AndroidGraphics) game.getGraphics()).getVisibleArea(); int windowWidth = visibleArea.width(); int windowHeight = visibleArea.height(); float ratio = (float) windowWidth / (float) windowHeight; GlUtils.setViewport(visibleArea); GLES11.glDisable(GLES11.GL_FOG); GLES11.glPointSize(1.0f); GLES11.glLineWidth(1.0f); GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE_MINUS_SRC_ALPHA); GLES11.glDisable(GLES11.GL_BLEND); GLES11.glMatrixMode(GLES11.GL_PROJECTION); GLES11.glLoadIdentity(); GlUtils.gluPerspective(game, 45.0f, ratio, 1.0f, 900000.0f); GLES11.glMatrixMode(GLES11.GL_MODELVIEW); GLES11.glLoadIdentity(); GLES11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GLES11.glShadeModel(GLES11.GL_SMOOTH); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_AMBIENT, lightAmbient, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_DIFFUSE, lightDiffuse, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_SPECULAR, lightSpecular, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_POSITION, lightPosition, 0); GLES11.glEnable(GLES11.GL_LIGHT1); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_AMBIENT, sunLightAmbient, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_DIFFUSE, sunLightDiffuse, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_SPECULAR, sunLightSpecular, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_POSITION, sunLightPosition, 0); GLES11.glEnable(GLES11.GL_LIGHT2); GLES11.glEnable(GLES11.GL_LIGHTING); GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT); GLES11.glHint(GLES11.GL_PERSPECTIVE_CORRECTION_HINT, GLES11.GL_NICEST); GLES11.glHint(GLES11.GL_POLYGON_SMOOTH_HINT, GLES11.GL_NICEST); GLES11.glEnable(GLES11.GL_CULL_FACE); }
Example 5
Source File: CougarScreen.java From Alite with GNU General Public License v3.0 | 4 votes |
private void initGl() { Rect visibleArea = ((AndroidGraphics) game.getGraphics()).getVisibleArea(); int windowWidth = visibleArea.width(); int windowHeight = visibleArea.height(); float ratio = (float) windowWidth / (float) windowHeight; GlUtils.setViewport(visibleArea); GLES11.glDisable(GLES11.GL_FOG); GLES11.glPointSize(1.0f); GLES11.glLineWidth(1.0f); GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE_MINUS_SRC_ALPHA); GLES11.glDisable(GLES11.GL_BLEND); GLES11.glMatrixMode(GLES11.GL_PROJECTION); GLES11.glLoadIdentity(); GlUtils.gluPerspective(game, 45.0f, ratio, 1.0f, 900000.0f); GLES11.glMatrixMode(GLES11.GL_MODELVIEW); GLES11.glLoadIdentity(); GLES11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GLES11.glShadeModel(GLES11.GL_SMOOTH); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_AMBIENT, lightAmbient, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_DIFFUSE, lightDiffuse, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_SPECULAR, lightSpecular, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_POSITION, lightPosition, 0); GLES11.glEnable(GLES11.GL_LIGHT1); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_AMBIENT, sunLightAmbient, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_DIFFUSE, sunLightDiffuse, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_SPECULAR, sunLightSpecular, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_POSITION, sunLightPosition, 0); GLES11.glEnable(GLES11.GL_LIGHT2); GLES11.glEnable(GLES11.GL_LIGHTING); GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT); GLES11.glHint(GLES11.GL_PERSPECTIVE_CORRECTION_HINT, GLES11.GL_NICEST); GLES11.glHint(GLES11.GL_POLYGON_SMOOTH_HINT, GLES11.GL_NICEST); GLES11.glEnable(GLES11.GL_CULL_FACE); }
Example 6
Source File: ShipIntroScreen.java From Alite with GNU General Public License v3.0 | 4 votes |
private void initGl() { Rect visibleArea = ((AndroidGraphics) game.getGraphics()).getVisibleArea(); int windowWidth = visibleArea.width(); int windowHeight = visibleArea.height(); float ratio = (float) windowWidth / (float) windowHeight; GlUtils.setViewport(visibleArea); GLES11.glDisable(GLES11.GL_FOG); GLES11.glPointSize(1.0f); GLES11.glLineWidth(1.0f); GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE_MINUS_SRC_ALPHA); GLES11.glDisable(GLES11.GL_BLEND); GLES11.glMatrixMode(GLES11.GL_PROJECTION); GLES11.glLoadIdentity(); GlUtils.gluPerspective(game, 45.0f, ratio, 1.0f, 900000.0f); GLES11.glMatrixMode(GLES11.GL_MODELVIEW); GLES11.glLoadIdentity(); GLES11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GLES11.glShadeModel(GLES11.GL_SMOOTH); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_AMBIENT, lightAmbient, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_DIFFUSE, lightDiffuse, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_SPECULAR, lightSpecular, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_POSITION, lightPosition, 0); GLES11.glEnable(GLES11.GL_LIGHT1); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_AMBIENT, sunLightAmbient, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_DIFFUSE, sunLightDiffuse, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_SPECULAR, sunLightSpecular, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_POSITION, sunLightPosition, 0); GLES11.glEnable(GLES11.GL_LIGHT2); GLES11.glEnable(GLES11.GL_LIGHTING); GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT); GLES11.glHint(GLES11.GL_PERSPECTIVE_CORRECTION_HINT, GLES11.GL_NICEST); GLES11.glHint(GLES11.GL_POLYGON_SMOOTH_HINT, GLES11.GL_NICEST); GLES11.glEnable(GLES11.GL_CULL_FACE); }
Example 7
Source File: PlanetScreen.java From Alite with GNU General Public License v3.0 | 4 votes |
private void initGl() { Rect visibleArea = ((AndroidGraphics) game.getGraphics()).getVisibleArea(); int windowWidth = visibleArea.width(); int windowHeight = visibleArea.height(); float ratio = (float) windowWidth / (float) windowHeight; GlUtils.setViewport(visibleArea); GLES11.glDisable(GLES11.GL_FOG); GLES11.glPointSize(1.0f); GLES11.glLineWidth(1.0f); GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE_MINUS_SRC_ALPHA); GLES11.glDisable(GLES11.GL_BLEND); GLES11.glMatrixMode(GLES11.GL_PROJECTION); GLES11.glLoadIdentity(); GlUtils.gluPerspective(game, 45.0f, ratio, 1.0f, 900000.0f); GLES11.glMatrixMode(GLES11.GL_MODELVIEW); GLES11.glLoadIdentity(); GLES11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GLES11.glShadeModel(GLES11.GL_SMOOTH); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_AMBIENT, lightAmbient, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_DIFFUSE, lightDiffuse, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_SPECULAR, lightSpecular, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_POSITION, lightPosition, 0); GLES11.glEnable(GLES11.GL_LIGHT1); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_AMBIENT, sunLightAmbient, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_DIFFUSE, sunLightDiffuse, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_SPECULAR, sunLightSpecular, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_POSITION, sunLightPosition, 0); GLES11.glEnable(GLES11.GL_LIGHT2); GLES11.glEnable(GLES11.GL_LIGHTING); GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT); GLES11.glHint(GLES11.GL_PERSPECTIVE_CORRECTION_HINT, GLES11.GL_NICEST); GLES11.glHint(GLES11.GL_POLYGON_SMOOTH_HINT, GLES11.GL_NICEST); // GLES11.glEnable(GLES11.GL_TEXTURE_2D); GLES11.glEnable(GLES11.GL_CULL_FACE); }
Example 8
Source File: FlightScreen.java From Alite with GNU General Public License v3.0 | 4 votes |
public void initializeGl(final Rect visibleArea) { float ratio = (float) windowWidth / (float) windowHeight; GlUtils.setViewport(visibleArea); GLES11.glDisable(GLES11.GL_FOG); GLES11.glPointSize(1.0f); GLES11.glLineWidth(1.0f); GLES11.glTexEnvf(GLES11.GL_TEXTURE_ENV, GLES11.GL_TEXTURE_ENV_MODE, GLES11.GL_MODULATE); GLES11.glBlendFunc(GLES11.GL_SRC_ALPHA, GLES11.GL_ONE_MINUS_SRC_ALPHA); GLES11.glDisable(GLES11.GL_BLEND); GLES11.glMatrixMode(GLES11.GL_PROJECTION); GLES11.glLoadIdentity(); GlUtils.gluPerspective(game, 45.0f, ratio, 1.0f, 900000.0f); GLES11.glMatrixMode(GLES11.GL_MODELVIEW); GLES11.glLoadIdentity(); GLES11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GLES11.glShadeModel(GLES11.GL_SMOOTH); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_AMBIENT, lightAmbient, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_DIFFUSE, lightDiffuse, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_SPECULAR, lightSpecular, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_POSITION, lightPosition, 0); GLES11.glEnable(GLES11.GL_LIGHT1); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_AMBIENT, sunLightAmbient, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_DIFFUSE, sunLightDiffuse, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_SPECULAR, sunLightSpecular, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_POSITION, sunLightPosition, 0); GLES11.glEnable(GLES11.GL_LIGHT2); GLES11.glEnable(GLES11.GL_LIGHTING); GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT); GLES11.glHint(GLES11.GL_PERSPECTIVE_CORRECTION_HINT, GLES11.GL_NICEST); GLES11.glHint(GLES11.GL_POLYGON_SMOOTH_HINT, GLES11.GL_NICEST); GLES11.glEnable(GLES11.GL_TEXTURE_2D); GLES11.glEnable(GLES11.GL_CULL_FACE); }
Example 9
Source File: ControlledShipIntroScreen.java From Alite with GNU General Public License v3.0 | 4 votes |
private void initializeGl(final Rect visibleArea) { AliteLog.d("Ship Intro Screen", "Initialize GL. glError: " + GLES11.glGetError()); float ratio = (float) windowWidth / (float) windowHeight; GlUtils.setViewport(visibleArea); GLES11.glDisable(GLES11.GL_FOG); GLES11.glPointSize(1.0f); GLES11.glLineWidth(1.0f); AliteLog.d("Ship Intro Screen", "Initialize GL lineWidth. glError: " + GLES11.glGetError()); GLES11.glBlendFunc(GLES11.GL_ONE, GLES11.GL_ONE_MINUS_SRC_ALPHA); GLES11.glDisable(GLES11.GL_BLEND); AliteLog.d("SIS", "Blending: " + GLES11.glGetError()); GLES11.glMatrixMode(GLES11.GL_PROJECTION); GLES11.glLoadIdentity(); GlUtils.gluPerspective(game, 45.0f, ratio, 1.0f, 900000.0f); GLES11.glMatrixMode(GLES11.GL_MODELVIEW); GLES11.glLoadIdentity(); AliteLog.d("SIS", "Matrix Setup: " + GLES11.glGetError()); GLES11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GLES11.glShadeModel(GLES11.GL_SMOOTH); AliteLog.d("SIS", "Clear Color & Shading Model: " + GLES11.glGetError()); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_AMBIENT, lightAmbient, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_DIFFUSE, lightDiffuse, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_SPECULAR, lightSpecular, 0); GLES11.glLightfv(GLES11.GL_LIGHT1, GLES11.GL_POSITION, lightPosition, 0); GLES11.glEnable(GLES11.GL_LIGHT1); AliteLog.d("SIS", "Defined Light 1: " + GLES11.glGetError()); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_AMBIENT, sunLightAmbient, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_DIFFUSE, sunLightDiffuse, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_SPECULAR, sunLightSpecular, 0); GLES11.glLightfv(GLES11.GL_LIGHT2, GLES11.GL_POSITION, sunLightPosition, 0); GLES11.glEnable(GLES11.GL_LIGHT2); AliteLog.d("SIS", "Defined Light 2: " + GLES11.glGetError()); GLES11.glEnable(GLES11.GL_LIGHTING); AliteLog.d("SIS", "After Enable Lighting: " + GLES11.glGetError()); AliteLog.d("SIS", "After Lighting: " + GLES11.glGetError()); GLES11.glClear(GLES11.GL_COLOR_BUFFER_BIT); GLES11.glEnable(GLES11.GL_TEXTURE_2D); GLES11.glEnable(GLES11.GL_CULL_FACE); AliteLog.d("SIS", "End of Init: " + GLES11.glGetError()); }