Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT / OpenGL Texture Help
SWT / OpenGL Texture Help [message #454996] Wed, 04 May 2005 10:44 Go to next message
Eclipse UserFriend
I am trying to use the OpenGL plugin for eclipse. I have the quads drawing
correctly but I cannot seem to get textures working. I am specifically
interested in created a 3d globe. Has anyone been able to get textures
working? If so please send me sample code. I am already doing something
like:

// in my initGL
source = getTextureImageData(in);
GL.glGenTextures(1, textures);
GL.glBindTexture(GL.GL_TEXTURE_2D, textures[0]);
GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1);
GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S,GL.GL_REPEAT);
GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T,GL.GL_REPEAT);
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);
GL.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE);
GLU.gluBuild2DMipmaps(GL.GL_TEXTURE_2D, texFormat, source.width,
source.height, texFormat, GL.GL_UNSIGNED_BYTE, source.data);

// in my drawScene
GL.glEnable(GL.GL_TEXTURE_2D);
GL.glBindTexture(GL.GL_TEXTURE_2D, textures[0]);

// drawing code

...

GL.glDisable(GL.GL_TEXTURE_2D);
Re: SWT / OpenGL Texture Help [message #455021 is a reply to message #454996] Thu, 05 May 2005 09:36 Go to previous message
Eclipse UserFriend
John,

The examples plugin demonstrates a texture in use, see
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/opengl/org.eclipse.swt.opengl.examples_3.1.0.z ip .

Grant

"John Bauer" <john.bauer@gd-ais.com> wrote in message
news:8ef6a2f7783bc61d11b9b143facba952$1@www.eclipse.org...
> I am trying to use the OpenGL plugin for eclipse. I have the quads drawing
> correctly but I cannot seem to get textures working. I am specifically
> interested in created a 3d globe. Has anyone been able to get textures
> working? If so please send me sample code. I am already doing something
> like:
>
> // in my initGL
> source = getTextureImageData(in);
> GL.glGenTextures(1, textures);
> GL.glBindTexture(GL.GL_TEXTURE_2D, textures[0]);
> GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1);
> GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S,GL.GL_REPEAT);
> GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T,GL.GL_REPEAT);
> 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);
> GL.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE);
> GLU.gluBuild2DMipmaps(GL.GL_TEXTURE_2D, texFormat, source.width,
> source.height, texFormat, GL.GL_UNSIGNED_BYTE, source.data);
>
> // in my drawScene
> GL.glEnable(GL.GL_TEXTURE_2D);
> GL.glBindTexture(GL.GL_TEXTURE_2D, textures[0]);
>
> // drawing code
>
> ..
>
> GL.glDisable(GL.GL_TEXTURE_2D);
>
Previous Topic:Howto: Disable TabItem of a TabFolder
Next Topic:Window.setBlockOnOpen()
Goto Forum:
  


Current Time: Thu Oct 30 00:22:41 EDT 2025

Powered by FUDForum. Page generated in 0.07170 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top