| | |
OpenGL, SDL RGB mapping
Please support our Game Development advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Do anybody know about this mapping in the SDL_MapRGB
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.
i don't understand the -> operator exactly in this line??
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.
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.
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.
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.

"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.
![]() |
Other Threads in the Game Development Forum
- Previous Thread: Reccomendation for good college program in game design in CA
- Next Thread: help me
| Thread Tools | Search this Thread |
3d advertising ai algorithm ban c++ cambridge camera censorship china competition console development engine fov fpx game gamer games gaming gauntanamo government idaho in-gameadvertisement intellectualproperty l-systems laracroft lindenmayer live manhunt math mathematics matrix mercenaries microsoft mmorpg modded msn naked news nintendo obama opengl palin physics pirate playstation politics projection ps3 rpg search selection software sony stephenhawking stocks studio technology terrorism tombraider uk videogame web wii world-of-warcraft xbox xbox-live xbox360





