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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:58:01+00:00 2026-05-24T03:58:01+00:00

I am learning to use shaders in OpenGL ES. As an example: Here’s my

  • 0

I am learning to use shaders in OpenGL ES.

As an example: Here’s my playground fragment shader which takes the current video frame and makes it grayscale:

varying highp vec2 textureCoordinate;

uniform sampler2D videoFrame;

void main() {
    highp vec4 theColor = texture2D(videoFrame, textureCoordinate);
    highp float avrg = (theColor[0] + theColor[1] + theColor[2]) / 3.0;
    theColor[0] = avrg; // r
    theColor[1] = avrg; // g
    theColor[2] = avrg; // b
    gl_FragColor = theColor;
}

theColor represents the current pixel. It would be cool to also get access to the previous pixel at this same coordinate.

For sake of curiousity, I would like to add or multiply the color of the current pixel to the color of the pixel in the previous render frame.

How could I keep the previous pixels around and pass them in to my fragment shader in order to do something with them?

Note: It’s OpenGL ES 2.0 on the iPhone.

  • 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-24T03:58:03+00:00Added an answer on May 24, 2026 at 3:58 am

    You need to render the previous frame to a texture, using a Framebuffer Object (FBO), then you can read this texture in your fragment shader.

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

Sidebar

Related Questions

I'm interested in learning to use OpenGL and I had the idea of writing
I have enjoyed learning to use OpenGL under the context of games programming, and
I am just learning OpenGL, and I'm realizing that for more complex shader effects,
I am learning to use mahout by starting with a example copied from the
im learning to use openGL and iv been told that because my wheel arches
I am currently learning to use Springy which is a force directed graph layout
I'm learning to use normal maps (per pixel lighting?) in 2D graphics with OpenGL.
I'm learning to use Java's Pattern and Matcher, and this is an example code
I am learning to use LabVIEW as part of my honours project, and was
I have been learning to use Emacs for a little while now. So far

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.