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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:21:03+00:00 2026-06-13T04:21:03+00:00

I have a radial gradient texture (RGBA) that goes from a black fully opaque

  • 0

I have a radial gradient texture (RGBA) that goes from a black fully opaque color in the center to fully transparent one at the edges:

ball.png

I’ve set up an iOS project using the recent OpenGL template, which uses GLKit. I added texture capability and have the following code set in the setupGL method:

glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

When I overlap two of these textures (each has a separate z) in an ortho projection on a white background, I expect something like this:

right.png

But instead I get this:

wrong.png

My question is simply: why? Can OpenGL ES 2.0’s blending not achieve this effect? (I’ve gotten it to work before in OpenGL ES 1.1) Is there a common thing I’m missing? Is it maybe a premultiplied alpha problem with my texture? If so could it be something strange with my PNG or the way I’m loading it? I’m loading textures using GLKTextureLoader.

It’s very possible I’m wrong, but I understand that it couldn’t be a shader problem as alpha blending happens before it gets to the fragment shader. My shaders do little more than pass the information directly through. (Maybe that’s a problem?)

Vertex Shader:

attribute vec4 position;
attribute vec2 texCoordIn;

varying vec2 texCoordOut;

uniform mat4 modelViewProjectionMatrix;

void main()
{
    gl_Position = modelViewProjectionMatrix * position;
    texCoordOut = texCoordIn;
}

Fragment Shader:

varying lowp vec2 texCoordOut;
uniform sampler2D texture;

void main()
{
    gl_FragColor = texture2D(texture, texCoordOut);
}

I’ve also tried setting the glBendFunc as follows, but I get the same results:

glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

Any tips or common hangups are welcome. Thanks!

  • 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-06-13T04:21:04+00:00Added an answer on June 13, 2026 at 4:21 am

    Well, I’m an idiot. What’s actually happening is a simple problem with my vertices. I was using a single glDrawArrays call to draw all the textures at once, but I forgot to add extra vertices between the rectangles to create the degenerate triangles. So basically a third ball was being drawn squashed in the center. But it LOOKED like an alpha blending problem!

    Big dummy, right here.

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

Sidebar

Related Questions

I have this : background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,rgba(255,255,255,0.56)), color-stop(100%,rgba(210,210,210,1)));
-moz-radial-gradient(center -200px , ellipse farthest-corner, #323C49 0%, #718299 65%) no-repeat scroll 0 0 transparent;
If I have css gradient code that looks like this: background-image: radial-gradient(circle farthest-side at
I have a ViewController with a radial gradient background. Inside that I have a
I have the following radial gradient: <radialGradient inkscape:collect=always xlink:href=#linearGradient2454 id=radialGradient2460 cx=4022.8572 cy=5451.2656 fx=4022.8572 fy=5451.2656
I have drawn a circle and applied radial gradient. fine. But when i changed
I have a UIView which I want to have a radial gradient, and I'm
I have the following style applied to my div element: background-image: -moz-radial-gradient(50% -10%, ellipse
I have a radial blur shader in GLSL, which takes a texture, applies a
I'm working on a image manipulation app that overlays a radial gradient over 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.