COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### glutBitmapCharacter - partial letters

• Email
• Follow

Hi,

I use glutBitmapCharacter() to realize a TextEntry Widget. I solve the
problem on text strings which are longer than the Widgets width by
displaying only the active scrolled part of the text. But a problem is
that I could only display a full letter or not. So how could I display
an partial letter? Could I render the font somewhere else in a not on
screen region and then copy only a part of this letters in a texture
somewhere?

Or any other ideas how to solve this.

regards
Andreas

 0

See related articles to this posting

Andreas Volz wrote:
> I use glutBitmapCharacter() to realize a TextEntry Widget. I solve the
> problem on text strings which are longer than the Widgets width by
> displaying only the active scrolled part of the text. But a problem is
> that I could only display a full letter or not. So how could I display
> an partial letter? Could I render the font somewhere else in a not on
> screen region and then copy only a part of this letters in a texture
> somewhere?
>
> Or any other ideas how to solve this.

Enable GL_SCISSOR_TEST, than change clipping region with glScissor.

w.

 0

Am Sat, 6 May 2006 19:07:52 +0000 (UTC) schrieb Wojciech Muła:

> Andreas Volz wrote:
> > I use glutBitmapCharacter() to realize a TextEntry Widget. I solve
> > the problem on text strings which are longer than the Widgets width
> > by displaying only the active scrolled part of the text. But a
> > problem is that I could only display a full letter or not. So how
> > could I display an partial letter? Could I render the font
> > somewhere else in a not on screen region and then copy only a part
> > of this letters in a texture somewhere?
> >
> > Or any other ideas how to solve this.
>
> Enable GL_SCISSOR_TEST, than change clipping region with glScissor.

The idea does work, but I've a little problem with it. I use GLUT and
it seems GLUT has a mirrored y-axis. Because of this reason I do this
before I draw my overlay widgets:

// invert the y axis, down is positive (GLUT has different Y than openGL)
glScalef (1, -1, 1);
// move the origin from the bottom left corner
// to the upper left corner (GLUT has different Y than openGL)
glTranslatef (0, -h, 0);

This works for most OpenGL draw commands, but not glScissor. So mirror
the y-axis I would need each time the window height. But the problem is
that it's a little hard to access the windows height from inside the widgets
draw routine. Any ideas? Is there a GLUT version of glScissor with its own
axis?

regards
Andreas

 0

Andreas Volz wrote:
> The idea does work, but I've a little problem with it. I use GLUT and
> it seems GLUT has a mirrored y-axis.

Do you use glOrtho/gluOrtho2D?  Maybe you called one of these functions
with wrong parameters.

w.

 0

Am Sun, 7 May 2006 11:35:42 +0000 (UTC) schrieb Wojciech Muła:

> Andreas Volz wrote:
> > The idea does work, but I've a little problem with it. I use GLUT
> > and it seems GLUT has a mirrored y-axis.
>
> Do you use glOrtho/gluOrtho2D?  Maybe you called one of these
> functions with wrong parameters.

I use this function before drawing widgets:

//Set orthographic projection before draw the widgets
void cgutils::enableOrthographicProjection ()
{
//Get the actual windows size
int w;
int h;
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
w = viewport[2];
h = viewport[3];

// switch to projection mode
disableLightingDeepTest ();
glMatrixMode (GL_PROJECTION);
// save projection matrix
glPushMatrix ();
// reset matrix
// set a 2D orthographic projection
glOrtho (0, w, 0, h, -2, 1);
// invert the y axis, down is positive (GLUT has different Y than
openGL) glScalef (1, -1, 1);
// move the origin from the bottom left corner
// to the upper left corner (GLUT has different Y than openGL)
glTranslatef (0, -h, 0);
glMatrixMode (GL_MODELVIEW);
}

and this after drawing all widgets:

//Restore the projection after drawed the widget
void cgutils::disableOrthographicProjection ()
{
glMatrixMode (GL_PROJECTION);
glPopMatrix ();
enableLightingDeepTest ();
}

But don't ask me about details. I didn't write this both functions myself.
Someone else wrote this part of the library. Is there a problem?

regards
Andreas

 0

Andreas Volz wrote:
>> Do you use glOrtho/gluOrtho2D?  Maybe you called one of these
>> functions with wrong parameters.
>
> I use this function before drawing widgets:
> [...]
>   // set a 2D orthographic projection
>   glOrtho (0, w, 0, h, -2, 1);
>   // invert the y axis, down is positive (GLUT has different Y than
> openGL) glScalef (1, -1, 1);
>   // move the origin from the bottom left corner
>   // to the upper left corner (GLUT has different Y than openGL)
>   glTranslatef (0, -h, 0);

It looks good.  However it is strange, that GLUT swaps y-axis. I also
use GLUT (under Linux&Window) and draw simple GUI, and have never such
problem.  What happen when you comment both glScalef and glTranslate?

http://www.opengl.org/resources/faq/technical/transformations.htm

w.

 0

Wojciech Mu?a wrote:
> Andreas Volz wrote:
>> The idea does work, but I've a little problem with it. I use GLUT and
>> it seems GLUT has a mirrored y-axis.
>
> Do you use glOrtho/gluOrtho2D?  Maybe you called one of these functions
> with wrong parameters.
>

glScissor() isn't altered by the projection matrix.

--
<\___/>
/ O O \
\_____/  FTB.    For email, remove my socks.

In science it often happens that scientists say, 'You know
that's a really good argument; my position is mistaken,'
and then they actually change their minds and you never
hear that old view from them again.  They really do it.
It doesn't happen as often as it should, because scientists
are human and change is sometimes painful.  But it happens
every day.  I cannot recall the last time something like
that happened in politics or religion.

- Carl Sagan, 1987 CSICOP keynote address


 0

Am Sun, 7 May 2006 13:10:00 +0000 (UTC) schrieb Wojciech Muła:

> Andreas Volz wrote:
> >> Do you use glOrtho/gluOrtho2D?  Maybe you called one of these
> >> functions with wrong parameters.
> >
> > I use this function before drawing widgets:
> > [...]
> >   // set a 2D orthographic projection
> >   glOrtho (0, w, 0, h, -2, 1);
> >   // invert the y axis, down is positive (GLUT has different Y than
> > openGL) glScalef (1, -1, 1);
> >   // move the origin from the bottom left corner
> >   // to the upper left corner (GLUT has different Y than openGL)
> >   glTranslatef (0, -h, 0);
>
> It looks good.  However it is strange, that GLUT swaps y-axis. I also
> use GLUT (under Linux&Window) and draw simple GUI, and have never such
> problem.  What happen when you comment both glScalef and glTranslate?

Perhaps I found my problem. I assumed that the OpenGL 2D origin is
upper left, but it is lower left. It seems this is an common pitfall:

http://www.opengl.org/resources/features/KilgardTechniques/oglpitfall/
-> 12. OpenGL's Lower Left Origin

All other widgets in our toolkit have upper left as orgin, this is the
reason why to rotate the y-axis. But I don't understand why the font is
rendered at the correct position with the same coordinates as the
glScissor. See how I draw the font:

void cgutils::drawString (const Point& inPoint, void *font, const
string& str, const Color& c) {
glColor3f (c.red (), c.green (), c.blue ());
glRasterPos2f (inPoint.getX(), inPoint.getY());

for (string::const_iterator str_it = str.begin ();
str_it != str.end ();
str_it++)
{
char ch = *str_it;

glutBitmapCharacter(font, ch);
}
}

I assume glRasterPos2f() has the same 2D coordinate system as
glScissor(). Is this correct. So what is the problem?

I could easy solve it with glGetIntegerv(GL_VIEWPORT, viewport) and
mirroring the y-axis. But I think this is only a workaround.

regards
Andreas

 0

Andreas Volz wrote:
>
> I assume glRasterPos2f() has the same 2D coordinate system as
> glScissor(). Is this correct. So what is the problem?
>

No.

RasterPos transforms the coordinate by the viewing
matrices. glScissor does not.

--
<\___/>
/ O O \
\_____/  FTB.    For email, remove my socks.

In science it often happens that scientists say, 'You know
that's a really good argument; my position is mistaken,'
and then they actually change their minds and you never
hear that old view from them again.  They really do it.
It doesn't happen as often as it should, because scientists
are human and change is sometimes painful.  But it happens
every day.  I cannot recall the last time something like
that happened in politics or religion.

- Carl Sagan, 1987 CSICOP keynote address


 0

8 Replies
399 Views

Similar Articles

12/7/2013 12:51:51 PM
page loaded in 77472 ms. (0)

Similar Artilces:

Model 150 performance
I am looking at a model 150 to perform basic programming tasks and program compiles. Anyone have one/worked on one that could confirm performance? I just want to know if it is peppy or dog slow. TIA, Tony Tony Pack wrote: > I am looking at a model 150 to perform basic programming tasks and > program compiles. Anyone have one/worked on one that could confirm > performance? I just want to know if it is peppy or dog slow. > TIA, > Tony http://www.midrangesys.com/products/AS400/150.htm As a single user/programmer it will be fine. IPLing can take a while if you haven't

need help with query #5
Hi, I have a table with composite key: ID1 and ID2 and it also has a priority field. I want to get all the information for all records with the minimum priority group by ID2. How can I achieve that? Thanks. Donna Post table structures, sample data and the result you want Madhivanan specifically when I do the following, I lose id2: select min(priority) as priority, id1 from table t group by id1 I want it to return id1, id2, priority where it is the min(priority) group by id1 Try this Select T1.id1,T1.id2,T2.priority from tablet T1 inner join (select min(priority) as priority, id

Symbolic matrix #2
Hello! I want to create a symbolic matrix of a given size (e.g. 5x7) or variable size (e.g. nxn, n is a symbolic variable). How can I do it without to asign every single entry? Thanks in advance! Philipp S. wrote: > Hello! > I want to create a symbolic matrix of a given size (e.g. 5x7) or > variable size (e.g. nxn, n is a symbolic variable). > How can I do it without to asign every single entry? > Thanks in advance! Use the SYM function -- although keep in mind it will only generate a matrix of zeros, it won't fill it with elements like x12 for the (1,2) element of the sym

Vodafone Smart review
Vodafone Smart review http://natigtas7ab.blogspot.com/2012/10/vodafone-smart-review.html

array of array? #2
Hi, there, I wonder, if that is possible to have a array of arrays, for example A(1)=a1(1:N,1:M); A(2)=a2(1:N,1:M); A(3)=a3(1:N,1:M); � If no such thing, is there any simple method to do the same things as dimension A(i,j,k) in Fortran? Could any one please input anything? Thanks hnliuhy wrote: > > > Hi, there, > I wonder, if that is possible to have a array of arrays, for > example > A(1)=a1(1:N,1:M); > A(2)=a2(1:N,1:M); > A(3)=a3(1:N,1:M); > � > > If no such thing, is there any simple method to do the same things > as > dimension > A(i,j,k) in Fo

Alias problems with Capital Letters
, sendmail (or something) didn't like the fact that my users had or started with (I'm not sure) capital letters. So the virtuser mapping jschmoe@reps.clientdomain.com BJ5101 did not want to work. After hours of checking everything else I tried recreating that user as bj5101 and changing the table. No problem. Just to be sure, I know that *nix is case sensative and was using correct case the whole time. I didn't know however that the caps would cause a problem like this. I hope my mistake and the ensuing post helps someone else learn from my mistake. Take care, Danny Dorsey On Thu, 06 May 2004 12:33:26 -0700 Danny Dorsey wrote: > Problem! None of the aliases work. All mail sent there bounces back > 550 5.5.1 so such user. OK Let's check > > As it turns out, sendmail (or something) didn't like the fact that my > users had or started with (I'm not sure) capital letters. So the > virtuser mapping jschmoe@reps.clientdomain.com BJ5101 did not > want to work. After hours of checking everything else I tried > recreating that user as bj5101 and changing the table. No problem. > Just to be sure, I know that *nix is case

Greek Letters #2
How can i insert some greek letters in sprintf, disp or title? something like: title('then lambda = 0') but lambda being shown as a greek letter when its displayed. Matlab uses a lot of the same syntax as Latex, if you are familiar with that. For example, in the title command, try title('the \lambda = 0'); In general, a backslash followed by a Greek letter spelled out in English will usually give you what you want. ---Albert Tio Ziruela wrote: > How can i insert some greek letters in sprintf, disp or title? > > something like: > title('then lambda = 0') > but lambda being shown as a greek letter when its displayed.

Partial SNAFUs
Having some fun setting up SSH. Looking for URLs, hints, tips, and legitimate (but informative) chortlings. P1 = Client machine P2 = Server machine # P2 /etc/ssh/sshd_config Port 22 Protocol 2 ListenAddress 192.168.1.2 AllowUsers username@192.168.1.? PermitRootLogin no HostKey /etc/ssh/ssh_host_dsa_key PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys RhostsRSAAuthentication no HostbasedAuthentication no IgnoreRhosts yes PasswordAuthentication no PermitEmptyPasswords no ChallengeResponseAuthentication no AllowTcpForwarding yes X11Forwarding yes X11DisplayOffset 10 X

Help with Partial Reconfiguration on Spartan3
Dear all, I am trying to perform a module based partial reconfiguration on a Spartan3 XC3S400 (on a 3SxLC board by MEMEC). I am using ISE 8.2.01i_PR_07b (sp1 with Early Access Patch) I already was able to perform a difference based partial reconfiguration without any problem, but when trying to perform a module based reconfiguration, when I download via JTAG the partial bitstream it seems that the device reconfigure itself totally: in fact, the static part which only switch on and off a led stops running. I created the bitstream from the ISE using these command lines: 1) the total bitstream using <bitgen -w top.ncd top.bit> 2) the partial ones using <bitgen -g ActiveReconfig:Yes -d -w partial.ncd partial.bit> In the implementing phase I use the following additional options: for the TRANSLATE phase <-u -aul> for the MAP phase <-u> Moreover when implementing the partial module synthesis I deasserted the option "Add input-output buffers" Is there someone else I should try? I tried also to create the bitstream using the pearl script (PR_verifydesign and PR_assemble) from the PR patch but I obtained some errors. For instance, when I try to merge

Solaris 10, SSH is not letting me in...
So I set up a Solaris 10 box yesterday and found some issues that maybe you all can shed some light on... First off, uname -a: SunOS mybox 5.10 Generic sun4u sparc SUNW,UltraAX-i2 After the install I couldn't get into the multi-user-server milestone until I created /etc/resolve.conf. I'm a bit new to Solaris, version 10 especially, so feel free to throw links at me or flame, but is this normal behavior? Next question, after getting multi-user-server milestone I've been able to get SSH running but cannot seem to login. It appears as if my username is being forwarded via ker