Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tesseract36

macrumors newbie
Original poster
Jan 12, 2009
2
0
HI, im new to mac development and am having a really hard time figuring it out. Right now im trying to use 3 sliders for RGB to select the color of an OpenGLView.

I attached my source code, well i think.

But here is my problem :

Code:
- (IBAction) setRed: (id) sender {
	R = (float)[redSlider value];
}
- (IBAction) setGreen: (id) sender {
	G = [sender value];
}

I really just guessing on this one but R & G are floats and used here :

Code:
- (void) drawRect: (NSRect) rect {
	glViewport(0, 0, (GLsizei) rect.size.width, (GLsizei) rect.size.height);
	
	glClearColor(R, G, B, 1.0f);
	printf("%i, %i, %i \n", R, G, B);
	
	glClear(GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT + GL_STENCIL_BUFFER_BIT);
	
	[[self openGLContext] flushBuffer];
}

I do not know how to get the NSSlider's value into my RGB variables. this whole drawing lines to develop relationships is really confusing but looks vary promising.

PS : Im coming from VB and C++ development, please use them to explain any references.
 

Attachments

  • Archive.zip
    43.7 KB · Views: 35
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.