Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3498798
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:32:01+00:00 2026-05-18T12:32:01+00:00

I have a simple OpenGL app that displays arbitrary 3D models. I’d like to

  • 0

I have a simple OpenGL app that displays arbitrary 3D models. I’d like to implement zoom. what I have now uses glScale, and works to some degree. However, I’m having two issues.

  1. Any sort of zoom (+) quickly gets to the point where the edges of the object are inside the near clipping plane. Right now, my zNear is something like 0.1, so it makes sense that increasing the scale of the object will cause clipping. I am wondering if there are any other approaches for achieving a better effect.

  2. As I zoom in, the object gets dimmer. Zoom out and it gets brighter. I have a light position at around 0, 0, 100. I have very simple lighting positioned at 0,0,100 and using only diffuse.

     gl.glEnable(GL10.GL_LIGHTING);
     gl.glEnable(GL10.GL_LIGHT0);
     gl.glEnable(GL10.GL_COLOR_MATERIAL);
    
     float[] lights;
    
     lights = new float[] { 0f, 0f, 0f, 1f };
     gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, lights, 0);
     lights = new float[] { 1f, 1f, 1f, 1f };
     gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, lights, 0);
     lights = new float[] { 0f, 0f, 0f, 1f };
     gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_SPECULAR, lights, 0);
    
     float matAmbient[] = { 0f, 0f, 0f, 1f };
     float matDiffuse[] = { 1f, 1f, 1f, 1f };
     float matSpecular[] = { 0f, 0f, 0f, 1f };
     gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_AMBIENT, matAmbient, 0);
     gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_DIFFUSE, matDiffuse, 0);
     gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_SPECULAR, matSpecular, 0);
    
     float lightPosition[] = { mesh.mid.vertex[X], mesh.mid.vertex[Y], 100f,
             1f };
     gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, lightPosition, 0);
    

I do not have attenuation settings, which I believe needs to be enabled to cause the light to be affected by distance. Regardless, I’m not changing the distance of the object, just scaling it. Sure the position of the faces are changing but not significantly. Anyway, I’d thinking zooming in would cause it to get brighter, not dimmer.

This happens to be using opengl-es 1.0 on the Android platform.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:32:01+00:00Added an answer on May 18, 2026 at 12:32 pm

    The partial answer to #2 is that I was not scaling my normals. In other words, the previously normalized normal values have a greater (relative) magnitude when the object is scaled smaller, causing the faces to reflect more light … and vice versa.

    You can set a parameter,

    glEnable(GL_NORMALIZE)
    

    and it solves the problem, at the expense of some extra calculations. the full story is here,
    http://www.opengl.org/resources/features/KilgardTechniques/oglpitfall/

    (see #16).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that uses OpenGL-ES and an EAGLContext within a UIView -
Good afternoon. I have been making a small openGL based app for android that
I have an iPad app with UI written in OpenGL ES 2.0, some UI
I have created a an OBJ loader that can import .OBJ files that were
I'm working on a image manipulation app that overlays a radial gradient over an
I am trying to render an openGL es surface from the NDK, but got
I wish I would find an answer for this. I have searched and searched
Ok, here it goes: I managed to compile the .xcodeproj provided with the last
This is my first post, and I've only recently started programming for Android and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.