943,811 Members | Top Members by Rank

Ad:
Apr 2nd, 2008
0

OpenGL, SDL RGB mapping

Expand Post »
Do anybody know about this mapping in the SDL_MapRGB
SDL_MapRGB(screen->format, R, G, B)

The screen is my SDL_Surface.

Does this define only a single color. The RGB are Uint8 type and I set them As I wish from 0-256.

Uint32 color = SDL_MapRGB(screen->format, R, G, B);

i don't understand the -> operator exactly in this line??
Last edited by slacke; Apr 2nd, 2008 at 3:31 pm.
Reputation Points: 14
Solved Threads: 7
Junior Poster
slacke is offline Offline
105 posts
since Jun 2006
Apr 4th, 2008
0

Re: OpenGL, SDL RGB mapping

http://www.cplusplus.com/doc/tutorial/classes.html
Very bottom of page, second to last section. Basically screen is a pointer that points to a class and you directly access it through ->. Could be a struct instead of a class but you get the point.
Last edited by Grigor; Apr 4th, 2008 at 12:17 pm.
Reputation Points: 27
Solved Threads: 3
Light Poster
Grigor is offline Offline
26 posts
since Jan 2007
Apr 5th, 2008
0

Re: OpenGL, SDL RGB mapping

Yes thats exactly what I was looking for, how did you know that??
"in order to refer directly to a member of an object pointed by a pointer we can use the arrow operator (->) of indirection"
But I read the whole site again. I like this tutorial very much.
Thanks

If you can help me out with this:

bufp = (Uint32 *)screen->pixels + y*screen->pitch/4 + x;
Huuh.
I access a member in my screen object of SDL_Surface class called pixels. Add to it (y*pitch/4+x)?? And What is the (Uint32 *)
I know, maybe I am asking the irrelevant questions but I can't get no sleep until I find that out.
Reputation Points: 14
Solved Threads: 7
Junior Poster
slacke is offline Offline
105 posts
since Jun 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Game Development Forum Timeline: Reccomendation for good college program in game design in CA
Next Thread in Game Development Forum Timeline: help me





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC