No matter what I do, my points are green
typedef struct {
float x;
float y;
float red;
float green;
float blue;
} point;
void drawPoint(point p, float size) {
glPointSize(size);
glColor3f(p.red, p.green, p.blue);
glBegin(GL_POINTS);
glVertex2f(p.x, p.y);
glEnd();
}
...
glReadPixels(mx,windowHeight - my,1,1,GL_RGB,GL_FLOAT,&backColor);
wCurrentColor[0] = backColor[0];
wCurrentColor[2] = backColor[2];
wCurrentColor[1] = backColor[1];
...
I have a square that shows me all the time my current color, and it's correct.
Why my points are greeeeeen, snif snif.
Do you have a texture still bound which is leaking green into your points? Or any lighting state still enabled?
Yes I have 2 textures, at the end of DrawGLScene(GLvoid) method.
first I draw all the points, they are stored in a vector.
then the menu,
Can cause any problem?
...
glColor4f(1.0f,1.0f,1.0f,barColor.getAlpha());
glBindTexture(GL_TEXTURE_2D, textura[1]);
glBegin(GL_QUADS);
...
first I draw all the points, they are stored in a vector.
then the menu,
Can cause any problem?
...
glColor4f(1.0f,1.0f,1.0f,barColor.getAlpha());
glBindTexture(GL_TEXTURE_2D, textura[1]);
glBegin(GL_QUADS);
...
And one of the textures have this green color. There's any method to solve this, may be I must clean some kind of buffer at the end of DrawGLScene(GLvoid) ?????
If you leave texturing enabled at the end of the drawing function then it will remain enabled the next time you draw the points. The obvious solution would be to disable texturing when you don't need it any more.
Do just the oppposite to enabling the texture
Enabling: glEnable(GL_TEXTURE_2D);
Disabling: glDisable(GL_TEXTURE_2D);
Enabling: glEnable(GL_TEXTURE_2D);
Disabling: glDisable(GL_TEXTURE_2D);
well, I have typed glEnabled and gldisabled after and before the method where I draw on the screen. The bad new is that anything happened. I have 2 textures and in one of them I have a color palette where when I roll over the mouse, a little square shows the color under the mouse.
If I click on the palette, the color is stored in the memory and in the square.
This is just to change the color I wanna draw my points.
The texture with the palette have this color green, (and red, blue, etc..)
so I've decided to change the image to see what happens, I paint it one all yellow. And what's my surprise? the points still are green.
:( help, any idea?
If I click on the palette, the color is stored in the memory and in the square.
This is just to change the color I wanna draw my points.
The texture with the palette have this color green, (and red, blue, etc..)
so I've decided to change the image to see what happens, I paint it one all yellow. And what's my surprise? the points still are green.
:( help, any idea?
SOLVED!!!!!!!!!!!!!
typedef struct {
float x;
float y;
float red;
float green;
float blue;
} point
...if MOUSE CLICK and !COLLISION WITH THE MENU (i don't wanna draw under the menu)
if (MODE==1&&!m.collision(mx,my)) {
point p;
p = setGLCoord(mx, my); <-------------
p.red = wCurrentColor[0]; |
p.blue = wCurrentColor[1]; |
p.green = wCurrentColor[2]; |
//p = setGLCoord(mx, my);-------------
punts.push_back(p);
}
the method setGLCoords returns a new point struct.
then all the data on the other vars are erased
SORRY xD
typedef struct {
float x;
float y;
float red;
float green;
float blue;
} point
...if MOUSE CLICK and !COLLISION WITH THE MENU (i don't wanna draw under the menu)
if (MODE==1&&!m.collision(mx,my)) {
point p;
p = setGLCoord(mx, my); <-------------
p.red = wCurrentColor[0]; |
p.blue = wCurrentColor[1]; |
p.green = wCurrentColor[2]; |
//p = setGLCoord(mx, my);-------------
punts.push_back(p);
}
the method setGLCoords returns a new point struct.
then all the data on the other vars are erased
SORRY xD
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement