In my application, I needed to pull the textures onto a geometric object. Actually, I did it. I use Tao.Opengl in the program. For texturing - DevIl

//Загрузка текстур private static uint MakeGlTexture(int Format, IntPtr pixels, int w, int h) { uint texObject; Gl.glGenTextures(1, out texObject); Gl.glPixelStorei(Gl.GL_UNPACK_ALIGNMENT, 1); Gl.glBindTexture(Gl.GL_TEXTURE_2D, texObject); // устанавливаем режим фильтрации и повторения текстуры 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_REPLACE); Gl.glTexImage2D(Gl.GL_TEXTURE_2D, 0, Gl.GL_RGB, w, h, 0, Gl.GL_RGB, Gl.GL_UNSIGNED_BYTE, pixels); return texObject; } public static byte[] ImageToByte(Image img) { ImageConverter converter = new ImageConverter(); return (byte[])converter.ConvertTo(img, typeof(byte[])); } private unsafe void texture(int imageId,Bitmap pic,int type, uint*obj) { Il.ilGenImages(1, out imageId); Il.ilBindImage(imageId); byte[] buf = ImageToByte(pic); Il.ilLoadL(type, buf, buf.Length); int width = Il.ilGetInteger(Il.IL_IMAGE_WIDTH); int height = Il.ilGetInteger(Il.IL_IMAGE_HEIGHT); *obj = MakeGlTexture(Gl.GL_RGB, Il.ilGetData(), width, height); Il.ilDeleteImages(1, ref imageId); } private unsafe void textureLoad() { fixed (uint* tex = &earth_tex) { texture(imageId_e, Properties.Resources.e2, Il.IL_JPG, tex); } fixed (uint* tex = &space_tex) { texture(imageId_s, Properties.Resources.space_b, Il.IL_JPG, tex); } fixed (uint* tex = &meteor_tex) { texture(imageId_m, Properties.Resources.meteor, Il.IL_JPG, tex); } } Glu.GLUquadric quadr; //Отрисовка сферы с текстурой: quadr = Glu.gluNewQuadric(); Glu.gluQuadricTexture(quadr, Gl.GL_TRUE); Gl.glEnable(Gl.GL_TEXTURE_2D); Gl.glBindTexture(Gl.GL_TEXTURE_2D, earth_tex); Glu.gluSphere(quadr, EARTH_RADIUS_Z, 64, 64); Gl.glDisable(Gl.GL_TEXTURE_2D); 

The textures are displayed successfully on my computer and my friends' computers. However, running the project on the terminal computers of the university presented the following picture to me: distressing sight The following image is used for texturing: texture used Here's what I actually look like: enter image description here How can this be caused? How to fix it?

  • What version of OpenGL is on the PC? Another version of the video card does not support this version of OpenGL - Alexsandr Ter
  • OpenGL version "1.4.0 - Build 8.14.10.1930". Intel (R) Q33 Express Chipset Family Video Card - Stepan
  • Even if the video card does not allow to work with such DevIl functions, what output can you offer? Frankly speaking, my brain broke already - Stepan
  • What version do you have at home? Use OpenGL features that are supported - Alexsandr Ter
  • "4.5.13399 Compatibility Profile Context 15.201.1151.1008" As far as I know, OpenGL does not give freedom to impose textures on geometric objects - Stepan

0