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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:45:15+00:00 2026-05-28T05:45:15+00:00

Is it possible make a CCSprite to black and white one using setBlendFunc ?

  • 0

Is it possible make a CCSprite to black and white one using setBlendFunc ? If yes please tell how to do it.

More Details:

I have to make my game sprite (background,character) to gray salce/black and white for a certain point of time. I dont want to take another image for this. I have tried CCTexture2DMutable. But the thing is it take extra memory of the same sprite.

Is there any way to use one mask image and make all sprite to gray scale.
Please help.

  • 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-28T05:45:16+00:00Added an answer on May 28, 2026 at 5:45 am

    This is not mathematically correct grayscaling, but looks black & white:

    // setup grayscaling:
    GLfloat rgba[4] = { 0.65f, 0.65f, 0.65f, 1.0f };
    glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
    glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_DOT3_RGB );
    glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, rgba );
    glTexEnvi( GL_TEXTURE_ENV, GL_SRC0_RGB, GL_CONSTANT );
    glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR );
    glTexEnvi( GL_TEXTURE_ENV, GL_SRC1_RGB, GL_TEXTURE );
    glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR );
    // ... glDrawArrays() here ...
    // turn off grayscaling:
    glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
    

    Insert this code into CCSprite drawing method. 0.65f value of rgba is set experimentally, try to tune it.

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

Sidebar

Related Questions

Is it possible to make a site with ASP.NET MVC Framework using .NET 2.0?
Is it possible to make such buttons ( http://img225.imageshack.us/img225/6452/buttonslw9.jpg ) using CSS? It should
Please help me anyone of possible. I am building a game where I will
is possible make insert in the table with only one column and this column
is possible make php symfony cc in backend.php on my page? if yes, how?
when using a makefile, I want the following to be possible: make clean make
Possible Duplicate: make drop down list item unselectable I have an asp.net dropdownlist and
Possible Duplicates: Make a wizard like application in Android Pattern one activity, multiple views.
Is it possible to make a copy of Gdk.image object using lablgtk2 for Ocaml?
Is it possible to make the addition of a geopoint in a map more

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.