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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:07:26+00:00 2026-05-26T20:07:26+00:00

I am using OpenGL ES 2.0 and GLSL to draw objects. Then I want

  • 0

I am using OpenGL ES 2.0 and GLSL to draw objects.
Then I want to read pixel from whatever my fragment shader draws on my screen.
I am blending two grayscale textures and at the end of my fragment shader, I have:

gl_FragColor = vec4(something...blending textures);

I know that gl_FragColor means the final color will be written in the frame buffer.
(According to http://nehe.gamedev.net/article/glsl_an_introduction/25007/)
Given that, I did something like

GLubyte *pixels = new GLubyte[320*240];
glReadPixels(0, 0, 320,240, GL_LUMINANCE, GL_UNSIGNED_BYTE, pixels);

After drawing image using that, at the first, I get same as the original texture1 and then get the black empty color. Can someone help me what’s wrong? Do I need to do something with FBO? I am a kinda lost…:(

  • 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-26T20:07:26+00:00Added an answer on May 26, 2026 at 8:07 pm

    Per the canonical ES 2.0 documentation for glReadPixels, the format parameter:

    Specifies the format of the pixel data. The following symbolic values
    are accepted: GL_ALPHA, GL_RGB, and GL_RGBA.

    So GL_LUMINANCE is not a supported read format in GL ES.

    Beyond that, assuming you have a working frame buffer of some sort and you’re applying your fragment shader by rendering a suitably placed piece of geometry to the frame buffer, glReadPixels should be the correct thing to use.

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

Sidebar

Related Questions

I am using openGL ES 2.0 and GLSL shader and working on FBO with
I need to draw a gridded image using opengl. I've read that images created
Using OpenGL ES I am rendering a simple cube class that draws it at
I'm using OpenGL with C++ in dev-c++ IDE. When I draw a circle, nothing
I'm using OpenGL for Android to draw my 2D images. Whenever I draw something
Finally i tried to draw a line using OpenGL ES framework in XCode 4.2
I have done a graphics project using OpenGL and now I want to convert
I want to start developing graphic programing using OpenGl To kick start I am
I'm using OpenGL and was told I should draw circles at each vertex of
I've dabbled with basic shader programming before, using the GLSL way. Now I've come

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.