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

  • Home
  • SEARCH
  • 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 7894219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:20:19+00:00 2026-06-03T07:20:19+00:00

when I’m running my app on ipad1 I see different result then when I’m

  • 0

when I’m running my app on ipad1 I see different result then when I’m running the same app on ipad2. I’m interested in book size in the middle of screen.

iPad1 result

iPad2 result

My code is below.

- (void)drawGallery{

glDepthFunc(GL_LESS);
glEnable(GL_DEPTH_TEST);

ResourceManager *rm = [ResourceManager sharedInstance];
GLuint currProgram = [rm getProgram:PROGRAM_BASIC_LIGHTNING];

glUseProgram(currProgram);

glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
glViewport(0, 0, 768, 1024 + 2 * GALLERY_OFFSET_Y);

GLfloat modelviewProj[16];

for (Sheet *sh in self.interfaceManager.gallery.sheets){

    if ([self.interfaceManager.gallery shouldDrawSheet:sh]){

        [self MakePerspectiveMatrix:modelviewProj 
                            OriginX:0.0 
                            OriginY:0.0 
                              Width:SCREEN_WIDTH 
                             Height:SCREEN_HEIGHT
                           Rotation:sh.rotation
                       TranslationX:sh.translationX 
                       TranslationZ:sh.translationZ
                             ScaleX:1.0
                             ScaleY:SCREEN_HEIGHT/(SCREEN_HEIGHT + 2 * GALLERY_OFFSET_Y)];


        vertexDataTextured *model;
        if (sh.type == SHEET_TYPE_LEFT){
            model = (vertexDataTextured *)[rm getModel:MODEL_SHEET_LEFT];
        } else {
            model = (vertexDataTextured *)[rm getModel:MODEL_SHEET_RIGHT];
        }


        // update uniform values

        glUniformMatrix4fv(basic_lighting_uniforms[BASIC_LIGHTING_UNIFORM_MODEL_VIEW_PROJECTION_MATRIX], 1, GL_FALSE, modelviewProj);

        glUniform1f(basic_lighting_uniforms[BASIC_LIGHTING_UNIFORM_ROTATION], degreeToRadians(-sh.rotation));

        glActiveTexture(GL_TEXTURE0);
        GLuint texture = [rm getTexture:TEXTURE_COLORING_PICTURE Index1:self.currentBook.number Index2:sh.number];
        glBindTexture (GL_TEXTURE_2D, texture);


        glUniform1i(basic_lighting_uniforms[BASIC_LIGHTING_UNIFORM_TEXTURE], 0);

        glVertexAttribPointer(BASIC_LIGHTING_ATTRIB_VERTEX, 3, GL_FLOAT, GL_FALSE, sizeof(vertexDataTextured), &model[0].vertex);
        glEnableVertexAttribArray(BASIC_LIGHTING_ATTRIB_VERTEX);

        glVertexAttribPointer(BASIC_LIGHTING_ATTRIB_TEX_COORDS, 2, GL_FLOAT, GL_FALSE, sizeof(vertexDataTextured), &model[0].texCoord);
        glEnableVertexAttribArray(BASIC_LIGHTING_ATTRIB_TEX_COORDS);

        glDrawArrays(GL_TRIANGLES, 0, 6);  

        if (![self validateProgram:currProgram]) {
            NSLog(@"Failed to validate program: (%d)", currProgram);
        }
    }
}
}

Vertex Shader:

uniform mat4 modelViewProjectionMatrix;
uniform float rotation;
attribute lowp vec3 position;
attribute lowp vec2 texCoords;
varying lowp vec2 fTexCoords;
varying lowp vec4 computed_color;

void main()
{ 
    fTexCoords = texCoords;

    vec4 postmp = vec4(position.xyz, 1.0);
    vec4 newposition = modelViewProjectionMatrix * postmp;
    gl_Position = newposition;

    vec3 ambient_color = vec3(0.5, 0.5, 0.5);
    vec3 norm = vec3(sin(rotation), 0.0, cos(rotation));

    vec3 light_position1 = vec3(15.0, 0.0, 20.0);
    vec3 light_direction1 = normalize( vec3 (0.2, 0.0, 1.0) );
    vec4 light_diffuse_color1 = vec4 (0.4, 0.4, 0.4, 1.0);
    float ndotl1 = max(0.0, dot(light_direction1, norm));
    vec4 temp_color1 = ndotl1 * light_diffuse_color1 * 15.0 / (length(light_position1 - newposition.xyz));

    vec3 light_position2 = vec3(-30.0, 0.0, 25.0);
    vec3 light_direction2 = normalize( vec3(-0.2, 0.0, 1.0) );
    vec4 light_diffuse_color2 = vec4 (0.5, 0.5, 0.5, 1.0);
    float ndotl2 = max(0.0, dot(light_direction2, norm));
    vec4 temp_color2 = ndotl2 * light_diffuse_color2 * 15.0 / (length(light_position2 - newposition.xyz));

    computed_color = vec4(temp_color1.rgb + temp_color2.rgb + ambient_color, 1.0);
}

Fragment shader:

precision lowp float;
uniform sampler2D texture;
varying vec2 fTexCoords;
varying lowp vec4 computed_color;

void main()
{
    gl_FragColor = texture2D(texture, fTexCoords) * computed_color;
}
  • 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-06-03T07:20:21+00:00Added an answer on June 3, 2026 at 7:20 am

    The problem was in lowp presicion for position. Thanks to Brad Larson.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am currently running into a problem where an element is coming back from
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I am writing an app with both english and french support. The app requests
I have a reasonable size flat file database of text documents mostly saved in
I am using Paperclip to handle profile photo uploads in my app. They upload

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.