PDA

View Full Version : i m madd



Mad_Musician
07-11-2003, 05:37 AM
good day to all opengl people!!
i have some trouble with a program..
i would like to know how can i read from a "coulour buffer" of the screen the color of a xy pixel in the graphical windows that i create with glut.
i would like to move cursor on that with window with arrows key but the problem is that i dont know how to do for to stop the cursor if he "hit" one segment of the path that he still walked. so i thunk i could "read" from the window the colour of the xy position of the cursor and determinate if that is a path segment (that i colour red) or free place to walk on (that is black). I dont want to save each step of the cursor because that would result the program very slowly, so if u can help me fisrt of all excuse my english my mother speak is italian.... thanky oyu all and good programming day!!!!

nexusone
07-11-2003, 07:35 AM
When you talk about walking, the cursor?

Do you want to do like a paint function?

Or like create a map that a player in a game follows and mark were he can and can not walk?



Originally posted by Mad_Musician:
good day to all opengl people!!
i have some trouble with a program..
i would like to know how can i read from a "coulour buffer" of the screen the color of a xy pixel in the graphical windows that i create with glut.
i would like to move cursor on that with window with arrows key but the problem is that i dont know how to do for to stop the cursor if he "hit" one segment of the path that he still walked. so i thunk i could "read" from the window the colour of the xy position of the cursor and determinate if that is a path segment (that i colour red) or free place to walk on (that is black). I dont want to save each step of the cursor because that would result the program very slowly, so if u can help me fisrt of all excuse my english my mother speak is italian.... thanky oyu all and good programming day!!!!

dorbie
07-11-2003, 08:38 AM
Use glReadPixels to read back. Make sure you read the correct buffer glReadBuffer may be required (probably not but check your results).

Mad_Musician
07-12-2003, 09:33 AM
Hi opengl people!! thank you fisrt of all for ur interess in my question.
I will try to be more understandable.
I have a cursor that i can move on a window of opengl. That cursor draw a red path along the way he "walk". My problem is that i want to make impossible for the "player" to move the cursor on a path segment he still "walked", like it was a wall. Now i m understanding i have to recognize where the wall is. My question is can i read from the colour of the pixel in the window if there is a wall or not. In few words i would like to read the colour of a pixel in the opengl window without save in a array each pixel i have drawn before. I know there is a buffer as the depth buffer from where u can read the information of a pixel with a function (i think glReadPixel but i didnt it before and the tutorials i did read are too difficult for me. If u were so gently to wrote me a little example that were beautifull!!!
I would need something like

colorofxypixel = glreadthecolorofxypixel

but i dont know how to dooooo
i use glut and opengl libraries i did study a little c and c++ but not win32 or such things like mfc and co...
(my target were to program a little wolfied game because in that i have i cannot save my play....)
So thank u all and good programming day!!
byeeeeeee