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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:58:12+00:00 2026-06-13T22:58:12+00:00

In my scene I have a cube within a sphere. I would like to

  • 0

In my scene I have a cube within a sphere. I would like to apply a RGB texture to a sphere and make it translucent. I can import the texture, apply it to the sphere and make it translucent but i am not getting the result I want.

My blend function is glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA)

My draw method is as follows:

def DrawGLScene():
    rotation1  = 60
    rotation2 = 60

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
    glEnable(GL_BLEND)
    glLoadIdentity()
    glTranslatef(0.0, 0.0, -8.0)
    glRotatef(rotation1, 1.0, 0.0, 0.0)
    glRotatef(rotation2, 0.0, 1.0, 0.0)
    glColor4f(1.0,1.0,1.0,1.0)

    glutSolidCube(2);
    glEnable(GL_COLOR_MATERIAL)
    glEnable(GL_TEXTURE_2D)
    glBindTexture(GL_TEXTURE_2D,1)
    glColor4f(1.0,1.0,1.0,0.3)
    Q=gluNewQuadric()
    gluQuadricNormals(Q, GL_SMOOTH)
    gluQuadricTexture(Q, GL_TRUE)
    glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP)
    glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP)
    gluSphere(Q, 2.35, 32, 16)
    glDisable(GL_TEXTURE_2D)

    glutSwapBuffers()

The result looks like this:

Cant see the back side of the sphere and artifacts on the sphere

It seemed there were depth problems as I could only see the back side of the sphere in parts in the bottom right. I then set glDepthFunc(GL_LESS) for drawing the cube and glDepthFunc(GL_ALWAYS) for drawing the sphere which resulted in:

Can now see the back of the sphere THROUGH the cube

Now the back side of the sphere is showing through the cube.

I have tried multiple combinations of glDepthFunc() for the objects but to no avail. Is the problem to do with how I am handling depth, blending or something else?

EDIT:

Using glEnable(GL_CULL_FACE) and glCullFace(GL_BACK) in the first example gives me the following which is still not correct as now you cannot see the back of the sphere at all.

with culling enabled

  • 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-13T22:58:12+00:00Added an answer on June 13, 2026 at 10:58 pm

    First, glEnable(GL_CULL_FACE). Draw the sphere once with glCullFace(GL_FRONT). Draw the cube (without culling). Lastly, draw the sphere again with glCullFace(GL_BACK).

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

Sidebar

Related Questions

I have a scene that stores vertices in 3D space. What i would like
i am using AndEngine. I have a scene that i would like to reuse
I have 2 simple 3D objects in my scene (a sphere and a cube),
I have a scene, called testScene, it works like this: @interface testScene : myScene
I have a scene and an object placed in some coordinates. I can transform
I have this question in mind: I need to make a scene that looks
I have a scene created like that: MyScene (subclass of CClayer) .m +(CCScene *)
I have some GUI-like elements in my WebGL scene which have to be displayed
I can't figure out what is up with this. I have a Scene class
I am trying to make an easy demo where I have a cube in

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.