I want to map a bmp file i-e “myimage.bmp” on a rectangular object.kindly gimme any tutorial or code sample. I ll be greatful to you for the favour.
Gautam converted a bunch of NeHe OpenGL tutorials to OpenGL|ES a few months ago.
Take a look at this thread.
I should add that those ports use UG and therefore likely only work with the Khronos Linux and Vincent implementations.
i tried to manipulate one of the tutorials from the redbook “texbind”, i did some thing like this … but still not working. plz solve this segment
It would help if you also say what happens with that piece of code. Except for this it seems ok to me :-
The width and height need to be image width and height, not 2x2 which IMHO is very small.
Also call the following in Display not reshape.
Also sometimes biSizeImage returns 0, that time you have to use width * height * 3 for memory allocation.
But it would help if we have an idea of what exactly is not working and what exactly is happening with this code.
<BLOCKQUOTE><font size=“1” face=“Arial, Verdana, Helvetica, sans-serif”>quote:</font><HR>Originally posted by bentlegen:
[b]I should add that those ports use UG and therefore likely only work with the Khronos Linux and Vincent implementations.
Although they have only been tested on linux using UG implementation the rendering part can be easily copied from that to any other implementation
[ January 06, 2005: Message edited by: gautam ]
this code is trying to map “mybmp” on a triangle. Now its working a little bit. but the problem is that when i give it a plain bmp i-e of one color only, like red, or grey or yellow, it works, but when i give it any multicolored bmp, only its first color is displayed on whole triangle, for e.g if a bmp is divided into yellow and green color of equal size, only 1st color is displayed. how to solve this???
Just a guess, but it’s likely that you’re not specifying the proper height/width of the texture to glTexImage2D, and that the few colors that are getting through are being clamped throughout the rest of your textured poly.
I agree with this, but how can i specify the width and height of the image in glTexImage2D() ???i tried by following way but by doing so nothing appears on screen
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,bitmapInfoHeader.biWidth, bitmapInfoHeader.biHeight, 0, GL_RGB, GL_UNSIGNED_BYTE,bitmapData);
[ January 06, 2005: Message edited by: qasim1981 ]
Hi. Are the dimensions of the bitmap power-of-two ? OpenGL ES only supports power-of-two textures (256x256, 128x64, …).
[ January 07, 2005: Message edited by: Jani Vaarala ]
Yes, i also tried with power of 2 , 2,4,8,16,32,64,128,256, but no use
Do you have texture filter modes enabled that require mipmapping? If you do and not all mipmap levels are specified with decreasing power-of-two sizes (see gl spec for “texture completeness”), rendering is done as if texturing was disabled.
thankyou guys for all ur support. This code worked 100% as it as, the only problem was with the resolution of bitmap, now its working fine. Thankyou once again .
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.