how to draw a rectangle with outline only using 'glRecti(...)' ?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

how to draw a rectangle with outline only using 'glRecti(...)' ?

george2008
Hi,

the rectangle can be drew using 'glRecti(...)', but the rectangle is filled by default.
how to draw a rectangle with outline only using 'glRecti(...)' ?

Thanks,
Reply | Threaded
Open this post in threaded view
|

Re: how to draw a rectangle with outline only using 'glRecti(...)' ?

elect
Hi george,

you shouldn't use deprecated OpenGL.

Take a look to this modern Hello Triangle
Reply | Threaded
Open this post in threaded view
|

Re: how to draw a rectangle with outline only using 'glRecti(...)' ?

gouessej
Administrator
In reply to this post by george2008
To draw a surface with outlined polygons,
            call
           
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
https://www.opengl.org/sdk/docs/man3/xhtml/glPolygonMode.xml

elect wrote
you shouldn't use deprecated OpenGL.
Actually, understanding the fixed pipeline is still very useful as there is still some hardware that doesn't support OpenGL 4.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: how to draw a rectangle with outline only using 'glRecti(...)' ?

elect
Which hw are you using and targetting, george?
Reply | Threaded
Open this post in threaded view
|

Re: how to draw a rectangle with outline only using 'glRecti(...)' ?

gouessej
Administrator
In reply to this post by george2008
By the way, glRect shouldn't be used, rather use GL_POLYGON and pass 4 vertices, it's more flexible, it's easier to maintain on the long term, especially to switch to VBOs or to use ImmModeSink in the meantime.
Julien Gouesse | Personal blog | Website