PDA

View Full Version : two things...



method5
03-28-2002, 04:48 PM
first... my when adding my textures to my tiles.. they are upside down and backwards???? i brought a screenshot into photoshop and had to turn 180 degrees and flip horizontaly to get it to look right...

to display my tiles i am using..


glBindTexture(GL_TEXTURE_2D, tiles[tile]);
glBegin(GL_QUADS);
glTexCoord2f(0.0f,0.0f);
glVertex2f(drawingx, drawingy);
glTexCoord2f(1.0f,0.0f);
glVertex2f(drawingx + 32, drawingy);
glTexCoord2f(1.0f,1.0f);
glVertex2f(drawingx + 32, drawingy + 32);
glTexCoord2f(0.0f,1.0f);
glVertex2f(drawingx,drawingy + 32);
glEnd();


any ideas?


also.. the textures I am loading.. (bitmaps) are being antialised... meaning blured a little. how do I stop that? i want sharp pixels..

method5
03-28-2002, 05:06 PM
nevermind about 2 http://www.opengl.org/discussion_boards/ubb/smile.gif just please help with the first thing.

Old GLman
03-28-2002, 05:10 PM
Hi. Bitmaps by default are stored "upside down." You can do what you did and save it upside down in Photoshop, or flip it using glPixelZoom()

Old GLman

method5
03-28-2002, 05:45 PM
where would i put this glPixelZoom(1.0,-1.0); ?

[This message has been edited by method5 (edited 03-28-2002).]

Old GLman
03-28-2002, 05:59 PM
Hi. After you have loaded the .bmp and before you make the call to glTexImage2d(), or glDrawPixels() etc... So:
glPixelZoom(-1.0f, 1.0f); // flip it horizontally baby!
glPixelZoom( 1.0f,-1.0f); // flip it right side up baby!

lol
Old GLman

[This message has been edited by Old GLman (edited 03-28-2002).]

method5
03-28-2002, 06:11 PM
ive tried it a few places.. and it doenst seem to be working.. do you have aim (kdghsu) or icq (21159213)? thank you http://www.opengl.org/discussion_boards/ubb/smile.gif

method5
03-28-2002, 06:12 PM
is there something you have to do it enable it first before you can use those?

Old GLman
03-28-2002, 06:30 PM
Hi. I know for a fact that glPixelZoom() can be used to flip .bmps, I have done it myself. It is probably working, but not positioned right. In other words it may just not be in view. Set the raster position with glRasterPos2f().
Let me know if you have any more problems.
Old GLman

[This message has been edited by Old GLman (edited 03-28-2002).]

method5
03-28-2002, 07:32 PM
it just dosent want to work for me.. anyone willing to take a look at my code.. if so please post your email

Old GLman
03-28-2002, 07:40 PM
Ok, ill aim you in one sec. We'll figure this out.

EDIT: Hey I cant help you if your not on aim or icq.. hehe

Old GLman

[This message has been edited by Old GLman (edited 03-28-2002).]

method5
03-29-2002, 07:47 AM
hrmm.. whats your screenname?

zeckensack
03-29-2002, 07:55 AM
Originally posted by method5:
[quote]
glBindTexture(GL_TEXTURE_2D, tiles[tile]);
glBegin(GL_QUADS);
glTexCoord2f(0.0f,0.0f);
glVertex2f(drawingx, drawingy);
glTexCoord2f(1.0f,0.0f);
glVertex2f(drawingx + 32, drawingy);
glTexCoord2f(1.0f,1.0f);
glVertex2f(drawingx + 32, drawingy + 32);
glTexCoord2f(0.0f,1.0f);
glVertex2f(drawingx,drawingy + 32);
glEnd();
Try this:

glBindTexture(GL_TEXTURE_2D, tiles[tile]);
glBegin(GL_QUADS);
glTexCoord2f(1.0f,1.0f);
glVertex2f(drawingx, drawingy);
glTexCoord2f(0.0f,1.0f);
glVertex2f(drawingx + 32, drawingy);
glTexCoord2f(0.0f,0.0f);
glVertex2f(drawingx + 32, drawingy + 32);
glTexCoord2f(1.0f,0.0f);
glVertex2f(drawingx,drawingy + 32);
glEnd();

As for the 'blurry' stuff, that's texture filtering. Add this to the loading code of the tile textures (do it for each tile!)


glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_NEAREST);

method5
03-29-2002, 08:44 AM
thanks! the blurring thing worked..but the other thing didnt// but i figured it out..

glBindTexture(GL_TEXTURE_2D, tiles[tile]);
glBegin(GL_QUADS);
glTexCoord2f(0.0f,1.0f); glVertex2f(drawingx, drawingy);
glTexCoord2f(0.0f,0.0f); glVertex2f(drawingx,drawingy+32);
glTexCoord2f(1.0f,0.0f); glVertex2f(drawingx + 32, drawingy + 32);
glTexCoord2f(1.0f,1.0f); glVertex2f(drawingx+32, drawingy);
glEnd();