Example of the border around the screen a la quake, doom plus a request for help
Greetings all,
A common question I see on here a lot is how to do the border around the screen that holds the stuff like the health percentage and whatever. Thanks to the help of several posters on here I finally got something like it to work. The code should be right here:
http://home.att.net/~tennisman2/TryingToCombine.zip
(It's VC++ 6.0 code)
Basically you combine ortho mode and perspective mode, and you fiddle a little with depth testing to get it to either always be on top or always be in the back. I haven't completely figured out all the math but I'm working on it! When I have time I'll try to whip up a sample that has a bitmap divided into two triangles where the upper left triangle is a solid color and the rest is transparent (so that your border doesn't have to be solid blocks).
Now my request for help - I'm putting text on the screen in ortho mode as well, but it's ignoring the color I specify with glColor3f - any idea what I might be doing wrong? It's always appearing on the screen as brown. In another more complex app where I'm having the same problem it's always appearing black.
Thanks as always
Joe
[edited by - DalTXColtsFan on April 13, 2003 3:36:28 PM]
Love means nothing to a tennis player
My nothing-to-write-home-about OpenGL webpage. (please pardon the popups!)
check you don''t have lighting/foggin enabled when drawing the text
| - Project-X - my mega project.. getting warmer
- | - adDeath - an ad blocker I made - | - email me - |
| - Project-X - my mega project.. getting warmer

glEnable(GL_TEXTURE_2D); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glBindTexture(GL_TEXTURE_2D, textures[1]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, bitmapData->sizeX, bitmapData->sizeY, GL_RGB, GL_UNSIGNED_BYTE, bitmapData->data);
No blending at all is being used.
Rip - I''m not using lighting at all. Anything else it could be?
Thanks
glBindTexture(GL_TEXTURE_2D, textures[1]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, bitmapData->sizeX, bitmapData->sizeY, GL_RGB, GL_UNSIGNED_BYTE, bitmapData->data);
No blending at all is being used.
Rip - I''m not using lighting at all. Anything else it could be?
Thanks
Love means nothing to a tennis player
My nothing-to-write-home-about OpenGL webpage. (please pardon the popups!)
According to the Red Book it''s the MAG texture filter you can''t use GL_LINEAR_MIPMAP_LINEAR with, not the MIN filter. GL_TEXTURE_MAG_FILTER must be GL_NEAREST or GL_LINEAR.
Enigma
Enigma
April 15, 2003 04:25 AM
quote:
Original post by James Trotter
You can''t use GL_LINEAR_MIMAP_LINEAR for your min texture filter.
buahahah
Why exactly can't you use GL_LINEAR_MIPMAP_LINEAR for your MAG filter? Works fine for me. Why not just us glViewport to restrict the portion of the screen being rendered to the part not covered by the health bar, render the scene, then use glViewport again to restrict the portion of the screen being rendered to the part that is covered by the health bar and then render the bar. I don't think (never tried it) that you will have to worry about depth testing anymore.
EDIT:
About the text, try inserting this line just before you draw the text:
glBindTexture(GL_TEXTURE_2D, 0);
This SHOULD (the way I understand it) clear the texture buffer, which may be obscuring the color of the text you are rendering. If it doesn't, then I'm not sure what's going on.
(Stolen from Programmer One)
UNIX is an operating system, OS/2 is half an operating system, Windows is a shell, and DOS is a boot partition virus
[edited by - Dragon88 on April 15, 2003 8:47:41 PM]
EDIT:
About the text, try inserting this line just before you draw the text:
glBindTexture(GL_TEXTURE_2D, 0);
This SHOULD (the way I understand it) clear the texture buffer, which may be obscuring the color of the text you are rendering. If it doesn't, then I'm not sure what's going on.
(Stolen from Programmer One)
UNIX is an operating system, OS/2 is half an operating system, Windows is a shell, and DOS is a boot partition virus
[edited by - Dragon88 on April 15, 2003 8:47:41 PM]
Thanks for the reply Dragon - hey Marvin Harrison is #88 - you know, the guy who obliterated the NFL record for catches in one season despite being the only receiver worth the snot he scrapes off his shoes on the whole team! :D
I tried disabling texturing completely and it still ignores the color I specify for the text
.
About your viewport thing, wouldn''t that restrict you to a rectangular border? Sometimes it looks cool for the viewscreen to be almost octagonal, where there are triangles in the four corners.
Joe
I tried disabling texturing completely and it still ignores the color I specify for the text

About your viewport thing, wouldn''t that restrict you to a rectangular border? Sometimes it looks cool for the viewscreen to be almost octagonal, where there are triangles in the four corners.
Joe
Love means nothing to a tennis player
My nothing-to-write-home-about OpenGL webpage. (please pardon the popups!)
I got a suggestion from someone on www.opengl.org''s forum that I try setting the color before setting the raster position and that seems to be working. FYI!
Love means nothing to a tennis player
My nothing-to-write-home-about OpenGL webpage. (please pardon the popups!)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement