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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:38:15+00:00 2026-05-19T22:38:15+00:00

This is weird, and I can’t find anything like it online. I am rendering

  • 0

This is weird, and I can’t find anything like it online. I am rendering a reflective sphere in OpenGL, and I’m trying to reposition the camera and use glCopytexImage2D to render directly to the Cube Map textures. Problem is, my reflective sphere ends up reflecting everything on my desktop EXCEPT the OpenGL environment! How does something like this even happen? It’s tripping me out. I will include my entire renderReflectiveSphere function here:

void drawReflectiveSphere(){

  float sphere_pos[] = {10.0, 0.0, -40.0};

  glMatrixMode(GL_MODELVIEW);
  glDisable(GL_TEXTURE_2D);

  glPushMatrix();
    //Positive x
    gluLookAt(sphere_pos[0], sphere_pos[1], sphere_pos[2],
       sphere_pos[0] + 1, sphere_pos[1], sphere_pos[2],
       0.0, 1.0, 0.0);
    glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, -128, -128, 128, 128, 0);

    //Negative x
    gluLookAt(sphere_pos[0], sphere_pos[1], sphere_pos[2],
       sphere_pos[0] - 1, sphere_pos[1], sphere_pos[2],
       0.0, 1.0, 0.0);
    glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, -128, -128, 128, 128, 0);

    //Positive y
    gluLookAt(sphere_pos[0], sphere_pos[1], sphere_pos[2],
       sphere_pos[0], sphere_pos[1] + 1, sphere_pos[2],
       0.0, 0.0, 1.0);
    glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, -128, -128, 128, 128, 0);

    //Negative y
    gluLookAt(sphere_pos[0], sphere_pos[1], sphere_pos[2],
       sphere_pos[0], sphere_pos[1] - 1, sphere_pos[2],
       0.0, 0.0, 1.0);
    glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, -128, -128, 128, 128, 0);

    //Positive z
    gluLookAt(sphere_pos[0], sphere_pos[1], sphere_pos[2],
       sphere_pos[0], sphere_pos[1], sphere_pos[2] + 1,
       0.0, 1.0, 0.0);
    glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, -128, -128, 128, 128, 0);

    //Negative z
    gluLookAt(sphere_pos[0], sphere_pos[1], sphere_pos[2],
       sphere_pos[0], sphere_pos[1], sphere_pos[2] - 1,
       0.0, 1.0, 0.0);
    glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, -128, -128, 128, 128, 0);
  glPopMatrix();

  glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
  glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
  glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
  glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
  glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
  glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
  glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
  glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 
  glEnable(GL_TEXTURE_GEN_S);
  glEnable(GL_TEXTURE_GEN_T);
  glEnable(GL_TEXTURE_GEN_R);
  glEnable(GL_TEXTURE_CUBE_MAP);

  glPushMatrix();
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glTranslatef(sphere_pos[0], sphere_pos[1], sphere_pos[2]);
    gluSphere(quadratic, 5.0f, 128, 128);
  glPopMatrix();


  //Reset frustrum, etc.
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, depth + 15.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();

  glDisable(GL_TEXTURE_GEN_S);
  glDisable(GL_TEXTURE_GEN_T);
  glDisable(GL_TEXTURE_GEN_R);
  glDisable(GL_TEXTURE_CUBE_MAP);

  glDrawBuffer(GL_BACK);
  glReadBuffer(GL_BACK);
}

I assume I’m doing a few things wrong, but where would OpenGL get the contents of my desktop from? And how can I set myself straight to do what I want?

  • 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-19T22:38:16+00:00Added an answer on May 19, 2026 at 10:38 pm

    I eventually solved this but the problem is in code not shown above. Essentially, I initialized my cube map texture to a size much too large.

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

Sidebar

Related Questions

Today I have seen this weird magic NTFS system supports: each file can have
So I discovered this weird bug, it's so odd and I can't understand why
I have this weird gridview problem in .net, I haven't found what can be
We're getting this weird exception when trying to create a BitmapDecoder off an ASP.Net
I'm trying to style a menu, but I keep running into this weird margin
I have noticed this weird behavior in firefox, it seems like font have some
I've seen this weird behavior on several sites recently: I scroll down a page
I've got this weird problem - I'm calling ChangeServiceConfig on a newly installed service
I'm experiencing this weird problem which my scrollbar jumps by itself to somewhere that
Today, I ran into this weird problem with a user using Mac OS X.

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.