Home » U++ Library support » U++ Library : Other (not classified elsewhere) » opengl & tekstures
Re: opengl & tekstures [message #2714 is a reply to message #1853] |
Sat, 22 April 2006 12:05   |
lindquist
Messages: 33 Registered: March 2006 Location: Denmark
|
Member |
|
|
I'm successfully using the GLCtrl with texturing.
Image img = PngEncoder::New()->LoadImageFile("texture/test.png");
PixelArray pix = ImageToPixelArray(img);
// pixelformat
GLuint chan,fmt,id;
switch (pix.GetBPP())
{
case 24:
chan = 3;
fmt = GL_RGB;
break;
case 32:
chan = 4;
fmt = GL_RGBA;
break;
default:
Exclamation("Unsupported texture BPP ("+FormatInt(pix.GetBPP())+")");
return false;
}
glGenTextures(1,&id);
glBindTexture(GL_TEXTURE_2D, id);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
gluBuild2DMipmaps(GL_TEXTURE_2D, chan, pix.GetWidth(), pix.GetHeight(), fmt, GL_UNSIGNED_BYTE, pix.Begin());
return true;
My GLCtrl is slightly modified. First I'm using GLee for easy access to extensions, and second, I have the 'wglMakeCurrent(NULL, NULL);' line commented in GLCtrl::WindowProc.
I also inserted 'wglMakeCurrent(hDC, hRC);' at the end of 'GLCtrl::OpenGL'.
At first I had some issues, but it turned out to be my min filter that was LINEAR_MIPMAP_LINEAR while I used glTexImage2D...
I hope this is of help.
[Updated on: Sat, 22 April 2006 12:12] Report message to a moderator
|
|
|
 |
|
opengl & tekstures
By: barpas on Thu, 23 March 2006 13:21
|
 |
|
Re: opengl & tekstures
By: unodgs on Fri, 24 March 2006 08:45
|
 |
|
Re: opengl & tekstures
By: fudadmin on Fri, 24 March 2006 22:53
|
 |
|
Re: opengl & tekstures
By: fudadmin on Fri, 24 March 2006 23:01
|
 |
|
Re: opengl & tekstures
By: mirek on Fri, 24 March 2006 23:19
|
 |
|
Re: opengl & tekstures
By: barpas on Sat, 25 March 2006 01:22
|
 |
|
Re: opengl & tekstures
|
 |
|
Re: opengl & tekstures
By: barpas on Wed, 12 April 2006 16:36
|
 |
|
Re: opengl & tekstures
By: fudadmin on Wed, 12 April 2006 16:55
|
 |
|
Re: opengl & tekstures
By: fudadmin on Wed, 12 April 2006 17:02
|
 |
|
Re: opengl & tekstures
|
 |
|
Re: opengl & tekstures
By: mirek on Mon, 01 May 2006 10:07
|
 |
|
Re: opengl & tekstures
|
Goto Forum:
Current Time: Fri Jul 18 06:35:44 CEST 2025
Total time taken to generate the page: 0.03791 seconds
|