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 1009975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:00:39+00:00 2026-05-16T09:00:39+00:00

Sorry about this long block of code, but I think it makes sense to

  • 0

Sorry about this long block of code, but I think it makes sense to include all of it. No matter what I play with, I cannot get my mesh to render fullscreen. The viewport is fullscreen, as is the GL view. Here’s what happens:

http://img191.imageshack.us/img191/247/screenshot2010082000163.png

This is the code that runs in my drawing loop:

int verticalDivisions = 16;
int horizontalDivisions = 16;
GLfloat *verticesArr;
GLfloat *textureCoordsArr;
GLuint textureID = texture[0];

unsigned int verticesArrsize = (verticalDivisions * ((2 + horizontalDivisions * 2) * 3));
unsigned int textureCoordsArraySize = verticalDivisions * ((2 + horizontalDivisions * 2) * 2);  
verticesArr = (GLfloat *)malloc(verticesArrsize * sizeof(GLfloat));
textureCoordsArr = (GLfloat*)malloc(textureCoordsArraySize * sizeof(GLfloat));

float height = 1.0f/verticalDivisions;
float width = 1.0f/horizontalDivisions;

int i,j, count;

count = 0;

for (j=0; j<verticalDivisions; j++) {
    for (i=0; i<=horizontalDivisions; i++, count+=6) { //2 vertices each time...
        float currX = i * width;
        float currY = j * height;
        verticesArr[count] = currX;///backingWidth;
        verticesArr[count+1] = (currY + height);///backingHeight;
        verticesArr[count+2] = 0.0f;

        verticesArr[count+3] = currX;///backingWidth;
        verticesArr[count+4] = currY;///backingHeight;
        verticesArr[count+5] = 0.0f;
        //NSLog(@"v1: (%f,%f) v2:(%f,%f)",currX,currY+height,currX,currY);
    }   
}


count = 0;

float xIncrease = 0.625f/(float)horizontalDivisions;
float yIncrease = 0.898f/(float)verticalDivisions;

int x,y;
//int elements;
count = 0;

for (y=0; y<verticalDivisions; y++) {
    for (x=0; x<horizontalDivisions+1; x++, count+=4) {
        float currX = (float)x * xIncrease;
        float currY = (float)y * yIncrease;
        textureCoordsArr[count] = (float)currX;
        textureCoordsArr[count+1] = (float)currY + yIncrease;

        textureCoordsArr[count+2] = (float)currX;
        textureCoordsArr[count+3] = (float)currY;
        //NSLog(@"v1: (%f,%f) v2:(%f,%f)",currX,currY+yIncrease,currX,currY);
    }
}

NSLog(@"expected %i vertices, and %i vertices were done",(verticalDivisions * ((2 + horizontalDivisions*2 ) * 2) ) , count );


glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);
glLoadIdentity();
glColor4f(255.0, 255.0, 255.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

glEnable(GL_TEXTURE_2D);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);


glBindTexture(GL_TEXTURE_2D, textureID);

glTexCoordPointer(2, GL_FLOAT, 0, textureCoordsArr);
glVertexPointer(3, GL_FLOAT, 0, verticesArr);


glPushMatrix();{
    int i;
    for (i=0; i<verticalDivisions; i++) {
        //glDrawArrays(GL_LINE_STRIP, i*(horizontalDivisions*2+2), horizontalDivisions*2+2);
        glDrawArrays(GL_TRIANGLE_STRIP, i*(horizontalDivisions*2+2), (horizontalDivisions*2+2));

    }
}glPopMatrix();


glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);



glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer);
[context presentRenderbuffer:GL_RENDERBUFFER_OES];

Thank you!

  • 1 1 Answer
  • 1 View
  • 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-16T09:00:40+00:00Added an answer on May 16, 2026 at 9:00 am

    Try changing a bit of your code to:

    float xStart = -0.5;
    float yStart = -0.5;
    for (j=0; j<verticalDivisions; j++) { 
        for (i=0; i<=horizontalDivisions; i++, count+=6) { //2 vertices each time... 
            float currX = xStart + i * width; 
            float currY = yStart + j * height; 
            verticesArr[count] = currX;///backingWidth;
        ....
    

    This should let you move the mesh about. After aligning to one corner (change xStart and yStart) you can scale width and height until it fits.

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

Sidebar

Related Questions

Sorry for this long winded question, but I'm not sure how to go about
Firstly, sorry about the long question... but this is doing my head in. Any
Well, first of all sorry about this question it must be pretty straight forward
sorry about input mistakes, english its not my mother lang. I have this code
First I am sorry about the length of this post, but I wanted to
First and foremost, I'm so sorry about how long this question is and appreciate
My question (which will follow after this, sorry about the long intro, the question
Hello yeah I'm asking this question a second time, sorry about that but I
This is going to sound too silly / too basic - sorry about that,
Sorry this is not a very well defined question, I am thinking about an

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.