Textures

[quote]wait a minute… all my textures have a red tint. I didnt notice on that example because it was a red square. Why the heck could that be?
[/quote]
Good to see you got it working. The red tint is probably because you’ve called glColor* at some point and set the current color to red. OR that you have lighting enabled and the light color is set to red. call gl.glDisable(GL.GL_LIGHTING) before you render your quad to see if its a lighting issue. If not then set the color to white before you render and see if thats it instead. IE gl.glColor3f(1.0f,1.0f,1.0f). You get the red tint because your TexEnv is set to GL_MODULATE which, as i pointed out before, modulates the incoming (texture) fragment color with the existing fragment color which can be set by lighting or glColor calls.

D.

I have tried both methods, but niether will remove the red tint.

even when i replace GL_MODULATE with GL_REPLACE it still has the red tint.

Is


public static void texImage2D(GL gl,GLU glu, BufferedImage image) {
        int width = image.getWidth();
        int height = image.getHeight();
   
        int[] rawData = image.getRGB(0, 0, width, height, null, 0, width);
        convertJavaToGL(width, height, rawData);
         
        gl.glPushClientAttrib(GL.GL_CLIENT_PIXEL_STORE_BIT);
        gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 4);
        //gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, 4, width, height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_INT_8_8_8_8, rawData);
        glu.gluBuild2DMipmaps(GL.GL_TEXTURE_2D,GL.GL_RGBA,width,height,GL.GL_RGBA,GL.GL_UNSIGNED_BYTE,rawData);
        gl.glPopClientAttrib();
      
     } 
     
     /**
      * Convertes the image data from argb to rgba and flips the image vertically.
      */
     private static void convertJavaToGL(int width, int height, int[] rawData) {
           for (int y1 = 0, y2 = height - 1; y2 >= y1; y1++, y2--) {
                 for (int x = 0; x < width; x++) {
                       int argb1 = rawData[y1 * width + x];
                       int argb2 = rawData[y2 * width + x];

                       int rgba1 = (argb1 << 8) | (argb1 >>> 24);
                       int rgba2 = (argb2 << 8) | (argb2 >>> 24);

                       rawData[y1 * width + x] = rgba2;
                       rawData[y2 * width + x] = rgba1;
                 }



ok?