Contributor posted 07-13-2003 06:07 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!!

Frequent Contributor posted 07-13-2003 07:29 PM

(a) This is a beginner question and not appropriate for this forum.
(b) Do a search on the web for glReadPixel and you’ll find all the information you need on how to use it.

Contributor posted 07-14-2003 12:52 AM

dear rgpcfogkals i have to learn something to you!
In the past i have always thunk that beginners doesnt need very eccellent material or professors because they dont need 100% of precision, they are only beginners…
But now that i ma a little older i can surely tell you that that was a wrong idea i had!
If a beginner learn from a beginner and he does all the thing with 60-80% precision, after a couple of years it will be impossible for him to really return at the perfect methodology of work he wanted at the start from professionally professors. I simply dont want to get stupid habit. But now i did see wath for a technician are u…
That is stupid you wirte to me an answer (i was so happy there was one…) in wich u tell me u are profi and i m only a ****… so uselessy… U are sure profi with opengl but please try to be more modest in your life!!!


People are all kinds in this world,so are they in this forum. I hope that you don’t feel too bitter to something that make you a little upset.I find there are always people here are willing to help ( if your problem is not too hard to answer ) . Just ignore those who thought himself a VIP .Have a nice day.

[This message has been edited by RunningRabbit (edited 07-14-2003).]

now a little time is over and i have to say i feel better… i excuse me and i thank you for ur answer!!
U know i m still one that think everybody can help everybody others!

We all try to help, but if we do not understand the question, it is hard to give a good answer.

I think trying to use readpixel it not the correct way to go about creating a path for you application, that is why no one has come up with a answer.

You need to look into using variables, this is a simple example:

0 = path
1 = walked path
2 = wall


// variable would look something like this
int map[4][4] = {{2,1,2,2},{2,1,0,2),{2,1,1,1}, {2, 2, 2, 2}};

You check the player moving against the variables, player can only move in area’s marked with a 0, once a play has been in an area it is changed to 1.

Is this sort of the idea you are looking for?

Nexusone is correct. Thanks for that answer, i was thinking about the same problem.

Hi all!!
Nexus thanks for your asnwer that was a good idea wath u had! I will try in that way too but i would like to understand how i could read from the window a color of a pixel without saving it when i draw it… Bye thatnk you allll

the word “glReadPixles” has been mentioned some times in this thread, even you have written in the opening post. so i wonder WHY you do not use it, as a) you already seem to know the answer to your question and b) it is definitely exactly what you are looking for?