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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:00:13+00:00 2026-05-26T23:00:13+00:00

I would like to render image in OpenGL ES, pixel by pixel. I want

  • 0

I would like to render image in OpenGL ES, pixel by pixel. I want to do it this way because I plan to move those pixels over time to create various effect.

For performance and design reasons I decided to use only every other pixel in both directions (thus reducing their number to one quarter)

I have only very basic understanding of opengl, so I am probably missing some key knowledge to achieve this.

What is the best way to achieve this? Do I have to really render it pixel by pixel? Or can I somehow create texture out of array of pixels?

I would like to make this work on as much devices as possible (so OpenGL ES 1.1 solution is preffered, but if it is not possible or it would be really inconvenient or slow, 2.0 can be used)

I tried to do this using VBO with mixed results. I am not sure I have done it properly, because there are some problems (and it is very slow). Here is my code:

Initialization:

glGenBuffers(1, &pointsVBO);
glBindBuffer(GL_ARRAY_BUFFER, pointsVBO);

glBufferData(GL_ARRAY_BUFFER, 160*240*sizeof(Vertex), 0, GL_DYNAMIC_DRAW);

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);

Rendering:

- (void)renderPoints:(ImagePixel**)imagePixels {
    int count = 160 * 240;
    for(int i = 0; i < count; ++i) {
         vertices[i].v[0] = imagePixels[i]->positionX;
         vertices[i].v[1] = imagePixels[i]->positionY;
         vertices[i].color[0] = imagePixels[i]->red;
         vertices[i].color[1] = imagePixels[i]->green;
         vertices[i].color[2] = imagePixels[i]->blue;
         vertices[i].color[3] = 1;
    }

    glVertexPointer(2, GL_FLOAT, sizeof(Vertex), vertices[0].v);
    glColorPointer(4, GL_FLOAT, sizeof(Vertex), vertices[0].color);

    // update vbo
    GLvoid *vbo_buffer = glMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES);
    memcpy(vbo_buffer, vertices, count * sizeof(Vertex));
    glUnmapBufferOES(GL_ARRAY_BUFFER);

    // draw contents of vbo
    glDrawArrays(GL_POINTS, 0, count);
}

Vertex struct:

typedef struct Vertex
{
    float v[2];
    float color[4];
} Vertex;

imagePixels array is filled with data from image.

When I do this, I get most of my image but I am missing few last rows and I can see some random pixels around the screen. Is it possible that I hit some limit in drawArrays that uses only portion of data?

Second problem is, that points in second half of columns aren’t aligned properly. I guess this is caused by rounding errors in float math when computing position during rendering itself (supplied coordinates are all multiples of 2). Is there any way how to prevent this? I need all points to be aligned in proper grid.

I will provide you with screenshot as soon as I get my iphone back

  • 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-26T23:00:14+00:00Added an answer on May 26, 2026 at 11:00 pm

    If you really are wanting to manipulate every pixel, you should probably just use a single full-screen quad in OpenGL and update its texture each frame.

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

Sidebar

Related Questions

I want to use libharu to render my documents to PDF. I would like
I would like to render a list of HTML links in ASP.NET MVC. Note
I would like to render the 3D volume data: Density(can be mapped to Alpha
I would like to render a constructions like: <a href='/home'>Home</a> <span class='active'>Community</span> <a href='/about'>About</a>
I have 2 arrays that I would like to render in a template, one
I'm using Java3D to render a three-dimensional scene. I would like to overlay a
I'm using the Google Maps API and would like it to render a very
I would like to get at the raw image data, as in a pointed
I would like to download an image without having it's URL placed in the
I would like your suggestion about this problem... To make it simple, I'll consider

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.