Hi!
I draw text with the following routine, but glColor and glRasterPos are
being ignored:
glColor3f(r, g, b); // text is always red
glRasterPos2f(x, y); // text is always at same position
glPushAttrib(GL_LIST_BIT);
glListBase(fonts[index].listBase - 32);
glCallLists(strlen(text), GL_UNSIGNED_BYTE, text);
glPopAttrib();
The lower left corner of the text is always at the center of the
viewport and the color is always red.
Am I missing something?
Thanks, Ingo
|
|
0
|
|
|
|
Reply
|
Ingo
|
8/12/2003 3:25:32 PM |
|
Unless the display lists that render each character have compiled
glRasterPos and glColor calls, it may work.
Other considered issues are :
- position : the modelview matrix's scale factor is too small compared to x
and y arguments (for instance the modelview matrix is identity and
x=y=0.00001)
- color : either texturing or lighting is enabled, and texturing and/or
lighting is not configured to take color into account (GL_REPLACE in case
of texturing, no COLOR_MATERIAL in case of lighting).
Vincent
Ingo Schulz wrote:
> Hi!
>
> I draw text with the following routine, but glColor and glRasterPos are
> being ignored:
>
> glColor3f(r, g, b); // text is always red
> glRasterPos2f(x, y); // text is always at same position
> glPushAttrib(GL_LIST_BIT);
> glListBase(fonts[index].listBase - 32);
> glCallLists(strlen(text), GL_UNSIGNED_BYTE, text);
> glPopAttrib();
>
> The lower left corner of the text is always at the center of the
> viewport and the color is always red.
>
> Am I missing something?
>
> Thanks, Ingo
|
|
0
|
|
|
|
Reply
|
Vincent
|
8/12/2003 5:10:15 PM
|
|
Ingo Schulz wrote:
>
> glColor3f(r, g, b); // text is always red
> glRasterPos2f(x, y); // text is always at same position
> glPushAttrib(GL_LIST_BIT);
> glListBase(fonts[index].listBase - 32);
> glCallLists(strlen(text), GL_UNSIGNED_BYTE, text);
> glPopAttrib();
>
> The lower left corner of the text is always at the center of the
> viewport and the color is always red.
>
> Am I missing something?
>
What's your view and projection matrices?
glRasterPos() transforms the coordinate using the
modelview and projection matrices. If the result
is invalid the the function will be ignored, also
the color won't be sent down the pipeline (color
is only sent down when a valid vertex is sent).
--
<\___/> For email, remove my socks.
/ O O \
\_____/ FTB. Why isn't there mouse-flavored cat food?
|
|
0
|
|
|
|
Reply
|
fungus
|
8/12/2003 6:12:56 PM
|
|
fungus schrieb:
> What's your view and projection matrices?
Camera is at 0,0,0 pointing to 0,0,-1
Viewport is 1005 x 1005 pixels
I'm using my own Camera class that worked without problems on another
project. But here I'm getting these matrices:
model view:
0 0 0 0
0 0 0 0
0 0 1 0
0 0 -1 1
projection:
2.414 0 0 0
0 2.414 0 0
0 0 -1.02 -1
0 0 -0.2 0
> glRasterPos() transforms the coordinate using the
> modelview and projection matrices. If the result
> is invalid the the function will be ignored, also
> the color won't be sent down the pipeline (color
> is only sent down when a valid vertex is sent).
glGet says that the current raster position is valid.
Ingo
|
|
0
|
|
|
|
Reply
|
Ingo
|
8/13/2003 11:20:05 AM
|
|
Vincent DAVID schrieb:
> Unless the display lists that render each character have compiled
> glRasterPos and glColor calls, it may work.
> Other considered issues are :
> - position : the modelview matrix's scale factor is too small compared to x
> and y arguments (for instance the modelview matrix is identity and
> x=y=0.00001)
See reply to fungus.
> - color : either texturing or lighting is enabled, and texturing and/or
> lighting is not configured to take color into account (GL_REPLACE in case
> of texturing, no COLOR_MATERIAL in case of lighting).
Texturing and lighting are disabled and text is still red.
|
|
0
|
|
|
|
Reply
|
Ingo
|
8/13/2003 11:20:07 AM
|
|
Ingo Schulz wrote:
>
> I'm using my own Camera class that worked without problems on another
> project. But here I'm getting these matrices:
>
> model view:
> 0 0 0 0
> 0 0 0 0
> 0 0 1 0
> 0 0 -1 1
>
That doesn't look very valid to me...
--
<\___/> For email, remove my socks.
/ O O \
\_____/ FTB. Why isn't there mouse-flavored cat food?
|
|
0
|
|
|
|
Reply
|
fungus
|
8/13/2003 11:55:57 AM
|
|
you probably set up view like this:
glOrtho(-width/2, width/2, -height/2, height/2, NearClip, FarClip);
where width and height are your windows width and height. This makes
center of the window (0,0,0). So if you draw text at 0,0,0 that would
come up in center.
Try
glOrtho(0, width, 0, height, NearClip, FarClip);
which will set lower left corner to (0,0,0)
eymre
|
|
0
|
|
|
|
Reply
|
burhanemre
|
8/13/2003 2:55:39 PM
|
|
> I'm using my own Camera class that worked without problems on another
> project. But here I'm getting these matrices:
>
> model view:
> 0 0 0 0
> 0 0 0 0
> 0 0 1 0
> 0 0 -1 1
That explains why the text corner is always at the center of the screen.
Because the 2x2 upper-left part of the matrix is zero, every x and y
coordinate in object-space (sent to glVertex or glRasterPos) will output
a zero-valued x and y coordinates in eye-space.
Vincent
|
|
0
|
|
|
|
Reply
|
Vincent
|
8/13/2003 4:47:16 PM
|
|
fungus wrote:
> glRasterPos() transforms the coordinate using the
> modelview and projection matrices. If the result
> is invalid the the function will be ignored, also
> the color won't be sent down the pipeline (color
> is only sent down when a valid vertex is sent).
The pedant here again.
If the given coordinate is *clipped* by any clip plane, including the
user defined clip planes, the current raster position is marked as
"invalid". The function will not be "ignored".
|
|
0
|
|
|
|
Reply
|
Andy
|
8/13/2003 10:53:58 PM
|
|
|
8 Replies
275 Views
(page loaded in 0.098 seconds)
Similiar Articles: Raster Color - comp.graphics.api.openglHello, I've got a problem where the raster color gets ... if inside of the lists you are calling are any glColor ... exact details but I think you have to make sure glRasterPos ... OpenGL "Gotchas" - Mesa Home PageThe sequence of glRasterPos(), glColor(), glBitmap() doesn't result in the desired bitmap color Call glColor() before glRasterPos(). Texture Mapping Problems glRasterPos - opengl - Mofeel Groups1. glrasterpos() crash with new nvidia drivers. 2. Problem with glRasterPos and glColor. 3. glRasterPos/glDrawPixel use info Hi, Am new to this and am in the process ... 7/23/2012 5:56:06 AM
|