Patrik Posted June 9, 2011 Share Posted June 9, 2011 Hello I'm having some trouble rendering text on my screen. Using the default font rendering DrawText() command I can get the text to show but when rendering the text on top of the content of the screen i get an blackbox around the the text (see picture) is it possible to render the text with an transparent background somehow? I've tried rendering it in my buffer and in the backbuffer. my buffer is currently configured as this CreateBuffer(GraphicsWidth(),GraphicsHeight(),BUFFER_COLOR|BUFFER_DEPTH|BUFFER_NORMAL); i've also implemented the FTGL font library in my attempts to get text rendering to work as I want. It supports several rendering styles Pixmap, polygon and texture rendering. When rendering as pixmaps it works as expected but it's way to slow. When rendering as Textures there is no performance issues. But for some reason the text gets rendered upside-down, very annoying (see picture). I've gathered as much as you can scale textures with a negative value to flip them using glScalef(1.0, -1.0, 1.0) but I can't get that to work either, maybe I need to switch the opengl matrix? My attempt to flip the text glPushMatrix(); glLoadIdentity(); glScalef(1.0, -1.0, 1.0); m_font->Render(text, -1, p); // renders the texture glPopMatrix(); I'd appreciate if some could point me in the right direction to help me solve these problems. Quote Link to comment Share on other sites More sharing options...
macklebee Posted June 10, 2011 Share Posted June 10, 2011 Use DrawText() with SetBlend(). SetBlend(1) DrawText("hello",0,50) SetBlend(0) as for the other fonts, i just use bitmap fonts created with fontstudio (which used to be posted here but was lost due to the forum data loss) Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Josh Posted June 10, 2011 Share Posted June 10, 2011 Call this: glSetMatrixMode(GL_MODELVIEW_MATRIX) Before your code and see if that helps. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Patrik Posted June 10, 2011 Author Share Posted June 10, 2011 Use DrawText() with SetBlend(). Aah of course , thanks! Call this:glSetMatrixMode(GL_MODELVIEW_MATRIX) Before your code and see if that helps. I tested that but no difference. My problem is that the scaling actually sort of works I can scale it from 1.0 -> 0.0 and it works as expected but I can't scale it to the negative side if I do the text disappears. I need to read up on opengl's transformations Quote Link to comment Share on other sites More sharing options...
Josh Posted June 10, 2011 Share Posted June 10, 2011 Reverse the polygon order or disable backface culling glDisable(GL_CULL_FACE); or glFrontFace(GL_FILL,GL_CLOCKWISE/COUNTERCLOCKWISE) //something like that, off the top of my head Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Patrik Posted June 13, 2011 Author Share Posted June 13, 2011 Ok, I got it to work. After scaling the text I just needed to change the y position to it's negative. Instead of position it at y = 400 I need to position it at y = -400. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.