Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: OpenGL-10.4.7 incompatibility
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OpenGL-10.4.7 incompatibility




On Jun 30, 2006, at 1:26 PM, nestor cardozo wrote:

Okay, I have identified where the problem in my program is:

When I disable lighting my app works fine in 10.4.7 Intel or ppc.

When lighting is enabled the app only works fine in 10.4.7 ppc.

The initialization code for my NSOpenGLView is in the

initWithCoder: method

The code that I use to define lighting within this method is something like:

	self = [super initWithCoder:c];
	NSOpenGLContext *glContext;
	glContext = [self openGLContext];
	[glContext makeCurrentContext];

// Lights
	GLfloat ambientLight[] = {intAmbient,intAmbient,intAmbient,1.0};
	GLfloat diffuseLight[] = {intDiffuse,intDiffuse,intDiffuse,1.0};
	GLfloat specular [] = {intSpecular, intSpecular, intSpecular, 1.0};
	GLfloat specref[] = {0.5, 0.5, 0.5, 1.0};

	glEnable(GL_LIGHTING);
	glLightfv(GL_LIGHT0, GL_AMBIENT,ambientLight);
	glLightfv(GL_LIGHT0, GL_DIFFUSE,diffuseLight);
	glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
	glEnable(GL_LIGHT0);
	glEnable(GL_COLOR_MATERIAL);
	glColorMaterial(GL_FRONT,GL_AMBIENT_AND_DIFFUSE);
	glMaterialfv(GL_FRONT,GL_SPECULAR,specref);
	glMateriali(GL_FRONT,GL_SHININESS,50);

	// other stuff
	return self;

As I said when I comment the glEnable (GL_LIGHTING) line, everything works fine (except that there are no lights). When I comment the glEnable(GL_COLOR_MATERIAL) line everything shows up well but only in gray.

The strange thing is that my code works well in 10.4.7 ppc, but not 10.4.7 Intel.

First, let me say that I'm not an OpenGL expert by any stretch. That said, is it possible that you're running into an endianness issue with the pixels you're working with? If, for example, they're always arranged big-endian in memory, and GL expects them to be native- endian, then the channels will be in the "wrong" positions within the pixel when running on Intel...


steve

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >OpenGL-10.4.7 incompatibility (From: nestor cardozo <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.