Skip navigation.
 
mlRe: OpenGL-10.4.7 incompatibility
FROM : Steve Christensen
DATE : Fri Jun 30 23:05:31 2006

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

Related mailsAuthorDate
mlOpenGL-10.4.7 incompatibility nestor cardozo Jun 30, 22:26
mlRe: OpenGL-10.4.7 incompatibility Steve Christensen Jun 30, 23:05