views:

245

answers:

2

Hi everybody

I was trying to load a texture using joGL library but it seems that something is missing when using this method glTexImage2D at :

IOStream wdis = new IOStream(fileName);
wdis.skipBytes(18);
int width = wdis.readIntW(); // dis.skipBytes(2);
int height = wdis.readIntW(); // dis.skipBytes(2);
wdis.skipBytes(28);
byte buf[] = new byte[wdis.available()];
wdis.read(buf);
wdis.close();
gl.glBindTexture(GL.GL_TEXTURE_2D, BMPtextures[index]);
gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, 3, width, height, 0, GL.GL_BGR, GL.GL_UNSIGNED_BYTE, buf);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);

as IOStream is a class that extends DataInputStream

it shows a message that glTexImage2D(int,int,int,int,int,int,int,int,byte[]) is not found at javax.media.opengl.GL

I couldn't figure the problem her because it's an open source code and it seems to work perfectly with my friends but unfortunately not with me even though we are using the same library and the same JDK version what shall I do ??

A: 

There are two methods with the name "glTexImage2D" defined. One has the signature:

void glTexImage2D(int target, int level, int internalformat,
                  int width, int height, int border,
                  int format, int type, Buffer pixels)

and one

void glTexImage2D(int target, int level, int internalformat,
                  int width, int height, int border,
                  int format, int type, long pixels_buffer_offset)

But there is no overloading for "byte[]" as the last parameter. You may want to change your code to use one of the methods above.

Arne
A: 

well ya yesterday I've realized the problem : these two methods you are talking about with these signature are defined in joGL1.1 that imports

javax.media.openGL

but the signature that I've been used is defined in joGL1.0 that imports

net.java.games.jogl

problem solved :)

Nour