Confused!
hey great site. the tutorials are awesome and helped me a lot with this 2d driving sim im making. but i do have some problems
when i use the glPrint function found in lesson 21 on top of a textured quad, the texture seems to go all crazy.
i modified lesson 21 to draw text over the rectangular textures and the same thing happens...is there a problem using this print function over other textures? or am i forgetting to do something?
if there is a problem, i tried using bitmap fonts from lesson 13, but my current projection matrix (i think thats wat its called) is set to ortho. when i use the new glPrint function, nothing shows up. all the tutorials seem to use the gluPerspective mode and i need to use Ortho. am i forgetting any additional settings here?
thanks for all the help
What coordinates are you using for the text ? You might want to try translating the text 1.0 away from the camera as it might be too close or behind it. Also, what size do you use in ortho mode? You might have placed the text outside the screen.
For the texture problem, post a screenshot
.
For the texture problem, post a screenshot

I had simular trouble a while back.
In the gluperspective mode 0,0 is in the centre of the screen in ortho it is top left, make sure that you glprint function is modified for that.
And what pengiun said about the z axis way also be true, you can set glortho tolerance of the z axis in the last parameter.
I actually gave up doing text as shown in the tutorials and started using SDL which you can get from libsdl.org.
You can get a wrap for it called sdl_ttf also at the same site which basically allows you to put text straight on to bitmaps.
In the gluperspective mode 0,0 is in the centre of the screen in ortho it is top left, make sure that you glprint function is modified for that.
And what pengiun said about the z axis way also be true, you can set glortho tolerance of the z axis in the last parameter.
I actually gave up doing text as shown in the tutorials and started using SDL which you can get from libsdl.org.
You can get a wrap for it called sdl_ttf also at the same site which basically allows you to put text straight on to bitmaps.
thanks for all ur input
i have it set up like this: glOrtho(0.0f,width,height,0.0f,-1.0f,1.0f); where height and width is 1024x768
rite now i dont have GL_DEPTH_TEST enabled, but i thought that when u do that i dont have to worry about z and just layer stuff on top of each other because this is supposed to be all 2d.
i think i am using the command correctly because there arent any coordinates that glPrint receives. however lookin at the code inside teh glPrint function, theres glTranslatef(-length/2,0.0f,0.0f);// Center Our Text On The Screen and i am using glTranslated can the difference between doubles and floats be enough to make it go off the screen?
i have screenshots but i dont know how to post them...do i have to link from a website or something?
i have it set up like this: glOrtho(0.0f,width,height,0.0f,-1.0f,1.0f); where height and width is 1024x768
rite now i dont have GL_DEPTH_TEST enabled, but i thought that when u do that i dont have to worry about z and just layer stuff on top of each other because this is supposed to be all 2d.
i think i am using the command correctly because there arent any coordinates that glPrint receives. however lookin at the code inside teh glPrint function, theres glTranslatef(-length/2,0.0f,0.0f);// Center Our Text On The Screen and i am using glTranslated can the difference between doubles and floats be enough to make it go off the screen?
i have screenshots but i dont know how to post them...do i have to link from a website or something?
Translate the text away from the camera like this:
glTranslatef(-length/2,0.0f,-1.0f);
And, disabling depth test means data will always be drawn whatever the depth is, however, the data will first be clipped against the viewing frustum. So if you tell OpenGL to draw something that''s behind the camera, it won''t happen.
glTranslatef(-length/2,0.0f,-1.0f);
And, disabling depth test means data will always be drawn whatever the depth is, however, the data will first be clipped against the viewing frustum. So if you tell OpenGL to draw something that''s behind the camera, it won''t happen.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement