Point drawed over texture doesn't get the desired colour

Hi!

I was tasked with modifying some existing OpenGL 1.x code (a panoramic picture viewer, where the panorama is split into the six faces of a cube) so we’re able to draw lines/points on top of the loaded textures, where the points are the mouse coordinates unprojected to object coordinates.

I wrote a test program with a coloured cube just to try the line painting on top of it:

[ATTACH=CONFIG]902[/ATTACH]

I got this with the code pushing the GL_DEPTH_BUFFER_BIT attribute to the stack, disabling it before painting the points and poping the stack attribute after I have done with the painting.

I tried to use that same approach in the existing application, but I got these results (here, I’m trying only to paint a point):

[ATTACH=CONFIG]903[/ATTACH]

I specified red as the color for the point but, as you can see, it doesn’t have the desired one. I thought it might be due to blending and that it might be mixing its color with the underlying texture, so I pushed the GL_BLEND attribute to the stack as well and disabled it before painting, but the point isn’t getting the desired color anyway.

What is happening here? Is there a way to “force” the pipeline to paint the point red?

Cheers,
Andrés.

Have you disabled textures before drawing the point? Otherwise you will try to sample texcoords from the texture, even when drawing a point or a line.

WOW!!! Thanks!

I tried disabling a lot of things, even some textures, but your comment made me check all over again. I forgot to disable one type of texture. Now it works as I wanted!

Now, a question about your great answer:

you will try to sample texcoords from the texture

it’s like if I change the matrix mode to PROJECTION, do my work and then forget to change it back to MODELVIEW right? I mean, all my future changes will operate under the PROJECTION view.

No.
You use the fixed functionality pipeline. In the fixed function pipeline you will always take the fragment color from the highest enabled texture when rendering. The texcoords will be the last texcoords you have uploaded no matter what kind of draw mode you used.

Aha! Thanks for your explanation!!! :slight_smile: