Sign in to follow this  
falledAngel

No matter what I do, my points are green

Recommended Posts

falledAngel    122
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.

Share this post


Link to post
Share on other sites
falledAngel    122
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);
...

Share this post


Link to post
Share on other sites
Brother Bob    10344
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.

Share this post


Link to post
Share on other sites
falledAngel    122
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?

Share this post


Link to post
Share on other sites
falledAngel    122
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this