Skip to main content
link rot
Source Link
Vaillancourt
  • 16.4k
  • 17
  • 56
  • 61

Today I came across a tutorial about color pickingtutorial about color picking and I implemented it on my machine. But there is a problem: when I disable the texture and draw the object I want to pick with its picking color, it turns to black (the first colorID) and then switches to the texture which I am placing on pick.

That is the case when I enable the textures after rendering the object. When I enable texturing before rendering my object, as in:

void MenuButton::Render(double windowWidth, double windowHeight)
{
    glEnable(GL_TEXTURE_2D);
    gui_OrthogonalStart(windowWidth, windowHeight);
        TextureManager::Inst()->BindTexture(gui_TextureID);
         glBegin(GL_QUADS);
            glTexCoord2f(0.0f, 1.0f); glVertex2f(gui_Position.GetX(), gui_Position.GetY() - 25.0f);
            glTexCoord2f(1.0f, 1.0f); glVertex2f(gui_Position.GetX() + 100.0f, gui_Position.GetY() - 25.0f);
            glTexCoord2f(1.0f, 0.0f); glVertex2f(gui_Position.GetX() + 100.0f, gui_Position.GetY());
            glTexCoord2f(0.0f, 0.0f); glVertex2f(gui_Position.GetX(), gui_Position.GetY()); 
         glEnd();
    gui_OrthogonalEnd();
}

Then the texture cannot be disabled and the color picking isn't working. I hope I explained it well. If the code provided in the link isn't enough tell me and I will post more.

Can this problem be solved in some way?

Today I came across a tutorial about color picking and I implemented it on my machine. But there is a problem: when I disable the texture and draw the object I want to pick with its picking color, it turns to black (the first colorID) and then switches to the texture which I am placing on pick.

That is the case when I enable the textures after rendering the object. When I enable texturing before rendering my object, as in:

void MenuButton::Render(double windowWidth, double windowHeight)
{
    glEnable(GL_TEXTURE_2D);
    gui_OrthogonalStart(windowWidth, windowHeight);
        TextureManager::Inst()->BindTexture(gui_TextureID);
         glBegin(GL_QUADS);
            glTexCoord2f(0.0f, 1.0f); glVertex2f(gui_Position.GetX(), gui_Position.GetY() - 25.0f);
            glTexCoord2f(1.0f, 1.0f); glVertex2f(gui_Position.GetX() + 100.0f, gui_Position.GetY() - 25.0f);
            glTexCoord2f(1.0f, 0.0f); glVertex2f(gui_Position.GetX() + 100.0f, gui_Position.GetY());
            glTexCoord2f(0.0f, 0.0f); glVertex2f(gui_Position.GetX(), gui_Position.GetY()); 
         glEnd();
    gui_OrthogonalEnd();
}

Then the texture cannot be disabled and the color picking isn't working. I hope I explained it well. If the code provided in the link isn't enough tell me and I will post more.

Can this problem be solved in some way?

Today I came across a tutorial about color picking and I implemented it on my machine. But there is a problem: when I disable the texture and draw the object I want to pick with its picking color, it turns to black (the first colorID) and then switches to the texture which I am placing on pick.

That is the case when I enable the textures after rendering the object. When I enable texturing before rendering my object, as in:

void MenuButton::Render(double windowWidth, double windowHeight)
{
    glEnable(GL_TEXTURE_2D);
    gui_OrthogonalStart(windowWidth, windowHeight);
        TextureManager::Inst()->BindTexture(gui_TextureID);
         glBegin(GL_QUADS);
            glTexCoord2f(0.0f, 1.0f); glVertex2f(gui_Position.GetX(), gui_Position.GetY() - 25.0f);
            glTexCoord2f(1.0f, 1.0f); glVertex2f(gui_Position.GetX() + 100.0f, gui_Position.GetY() - 25.0f);
            glTexCoord2f(1.0f, 0.0f); glVertex2f(gui_Position.GetX() + 100.0f, gui_Position.GetY());
            glTexCoord2f(0.0f, 0.0f); glVertex2f(gui_Position.GetX(), gui_Position.GetY()); 
         glEnd();
    gui_OrthogonalEnd();
}

Then the texture cannot be disabled and the color picking isn't working. I hope I explained it well. If the code provided in the link isn't enough tell me and I will post more.

Can this problem be solved in some way?

edited title
Link
user1430
user1430

Color Why is texturing interfering with my ID-based picking problemimplementation?

added 1 characters in body
Source Link
Tsvetan
  • 243
  • 5
  • 15

Today I came across a tutorial about color picking) and I implemented it on my machine. But there is a problem: when I disable the texture and draw the object I want to pick with its picking color, it turns to black (the first colorID) and then switches to the texture which I am placing on pick.

That is the case when I enable the textures after rendering the object. When I enable texturing before rendering my object, as in:

void MenuButton::Render(double windowWidth, double windowHeight)
{
    glEnable(GL_TEXTURE_2D);
    gui_OrthogonalStart(windowWidth, windowHeight);
        TextureManager::Inst()->BindTexture(gui_TextureID);
         glBegin(GL_QUADS);
            glTexCoord2f(0.0f, 1.0f); glVertex2f(gui_Position.GetX(), gui_Position.GetY() - 25.0f);
            glTexCoord2f(1.0f, 1.0f); glVertex2f(gui_Position.GetX() + 100.0f, gui_Position.GetY() - 25.0f);
            glTexCoord2f(1.0f, 0.0f); glVertex2f(gui_Position.GetX() + 100.0f, gui_Position.GetY());
            glTexCoord2f(0.0f, 0.0f); glVertex2f(gui_Position.GetX(), gui_Position.GetY()); 
         glEnd();
    gui_OrthogonalEnd();
}

Then the texture cannot be disabled and the color picking isn't working. I hope I explained it well. If the code provided in the link isn't enough tell me and I will post more.

Can this problem be solved in some way?

Today I came across a tutorial about color picking) and I implemented it on my machine. But there is a problem: when I disable the texture and draw the object I want to pick with its picking color, it turns to black (the first colorID) and then switches to the texture which I am placing on pick.

That is the case when I enable the textures after rendering the object. When I enable texturing before rendering my object, as in:

void MenuButton::Render(double windowWidth, double windowHeight)
{
    glEnable(GL_TEXTURE_2D);
    gui_OrthogonalStart(windowWidth, windowHeight);
        TextureManager::Inst()->BindTexture(gui_TextureID);
         glBegin(GL_QUADS);
            glTexCoord2f(0.0f, 1.0f); glVertex2f(gui_Position.GetX(), gui_Position.GetY() - 25.0f);
            glTexCoord2f(1.0f, 1.0f); glVertex2f(gui_Position.GetX() + 100.0f, gui_Position.GetY() - 25.0f);
            glTexCoord2f(1.0f, 0.0f); glVertex2f(gui_Position.GetX() + 100.0f, gui_Position.GetY());
            glTexCoord2f(0.0f, 0.0f); glVertex2f(gui_Position.GetX(), gui_Position.GetY()); 
         glEnd();
    gui_OrthogonalEnd();
}

Then the texture cannot be disabled and the color picking isn't working. I hope I explained it well. If the code provided in the link isn't enough tell me and I will post more.

Can this problem be solved in some way?

Today I came across a tutorial about color picking and I implemented it on my machine. But there is a problem: when I disable the texture and draw the object I want to pick with its picking color, it turns to black (the first colorID) and then switches to the texture which I am placing on pick.

That is the case when I enable the textures after rendering the object. When I enable texturing before rendering my object, as in:

void MenuButton::Render(double windowWidth, double windowHeight)
{
    glEnable(GL_TEXTURE_2D);
    gui_OrthogonalStart(windowWidth, windowHeight);
        TextureManager::Inst()->BindTexture(gui_TextureID);
         glBegin(GL_QUADS);
            glTexCoord2f(0.0f, 1.0f); glVertex2f(gui_Position.GetX(), gui_Position.GetY() - 25.0f);
            glTexCoord2f(1.0f, 1.0f); glVertex2f(gui_Position.GetX() + 100.0f, gui_Position.GetY() - 25.0f);
            glTexCoord2f(1.0f, 0.0f); glVertex2f(gui_Position.GetX() + 100.0f, gui_Position.GetY());
            glTexCoord2f(0.0f, 0.0f); glVertex2f(gui_Position.GetX(), gui_Position.GetY()); 
         glEnd();
    gui_OrthogonalEnd();
}

Then the texture cannot be disabled and the color picking isn't working. I hope I explained it well. If the code provided in the link isn't enough tell me and I will post more.

Can this problem be solved in some way?

deleted 8 characters in body
Source Link
user1430
user1430
Loading
Source Link
Tsvetan
  • 243
  • 5
  • 15
Loading