OpenGL, SDL RGB mapping

Please support our Game Development advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2006
Posts: 98
Reputation: slacke is an unknown quantity at this point 
Solved Threads: 7
slacke's Avatar
slacke slacke is offline Offline
Junior Poster in Training

OpenGL, SDL RGB mapping

 
0
  #1
Apr 2nd, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 25
Reputation: Grigor is an unknown quantity at this point 
Solved Threads: 3
Grigor's Avatar
Grigor Grigor is offline Offline
Light Poster

Re: OpenGL, SDL RGB mapping

 
0
  #2
Apr 4th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 98
Reputation: slacke is an unknown quantity at this point 
Solved Threads: 7
slacke's Avatar
slacke slacke is offline Offline
Junior Poster in Training

Re: OpenGL, SDL RGB mapping

 
0
  #3
Apr 5th, 2008
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Game Development Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC