[RQt-devel] unable to draw glyphs using OpenGL

Tomas Sieger tomas.sieger at seznam.cz
Wed Oct 24 22:18:59 CEST 2012


I've tracked the problem down a little bit deeper.

I wanted to add some "use opengl" option to cranvas, but realized that
some cranvas plots using glyphs *do* work even if using opengl. I
found out that glyphs that specify stroke color as a vector of length
at least two (!) work:
     qdrawGlyph(painter,
qglyphCircle(r=5),5,5,stroke=rep('#FF0000FF',2)) # works
while those that specify stroke color as a single value do not:
     qdrawGlyph(painter,
qglyphCircle(r=5),5,5,stroke=rep('#FF0000FF',1)) # does not work
as well as those without an explicit stroke color:
     qdrawGlyph(painter, qglyphCircle(r=5),5,5) # does not work

The length of the stroke color argument really makes a difference. If
it is a vector of length >=2, stroke colors get passed to painters
explicitly. If it is a single value, it sets the default color in the
painter. In the first case, OpenGLPainter draws glyphs explicitly (and
the glyph gets rendered correctly). In the latter case, the
OpenGLPainter delegates the call to QtBasePainter::drawGlyphs (and the
glyph gets not rendered).

It makes me feel this might be a SW issue, not necessarily a HW one.

If it helps, there are some more details:
in the first case, QtBasePainter::rasterizeGlyph gets called by
OpenGLPainter with the following setting:
- pen: width 0, color r=255,g=255,b=255,a=255, brush color
r=255,g=255,b=255,a=255
- brush color r=0,g=0,b=0,a=255
- opacity 1
and the glyph gets rendered;
in the second case, QtBasePainter::rasterizeGlyph gets called by
QtBasePainter with the following setting:
- pen: width 0, color r=255,g=0,b=0,a=255, brush color r=255,g=0,b=0,a=255
- brush color r=0,g=0,b=0,a=255
- opacity 1
so the red color is there, but the glyph gets not rendered.

Unfortunately, I have no time to understand the code in detail, but I
would happily provide you with some more debug info, if it helps.

Tomas

On Tue, Oct 23, 2012 at 1:15 AM, Michael Lawrence
<lawrence.michael at gene.com> wrote:
> This is probably a hardware issue. Perhaps your card does not support point
> sprites. I'm guessing that cranvas used circles in the past. Perhaps an
> option could be added somewhere in the stack.
>
> On Mon, Oct 22, 2012 at 8:08 AM, Tomas Sieger <tomas.sieger at seznam.cz>
> wrote:
>>
>> Hi,
>>  I'm unable to draw glyphs when using OpenGL to render my scene:
>>
>> scene <- qscene()
>> layer <- qlayer(scene, function(layer, painter) {
>>     qdrawGlyph(painter, qglyphCircle(r=5),5,5) # doesn't work using OpenGL
>>     qdrawCircle(painter, 2, 2, r=3) # always works
>>     }, limits = qrect(0, 0, 10, 10))
>> view <- qplotView(scene)
>> print(view)
>>
>> however, when I turn OpenGL off, it works:
>>
>> scene <- qscene()
>> layer <- qlayer(scene, function(layer, painter) {
>>     qdrawGlyph(painter, qglyphCircle(r=5),5,5) # works if using SW driver
>>     qdrawCircle(painter, 2, 2, r=3) # always works
>>     }, limits = qrect(0, 0, 10, 10))
>> view <- qplotView(scene,opengl=FALSE)
>> print(view)
>>
>> Is it a known issue?
>> I'm running Qt 4.5.3.
>> My video is Intel Corporation Cantiga Integrated Graphics Controller.
>>
>> > sessionInfo()
>> R version 2.15.0 (2012-03-30)
>> Platform: i686-pc-linux-gnu (32-bit)
>>
>> locale:
>> [1] C
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> other attached packages:
>> [1] qtpaint_0.9.0  qtbase_1.0.6   colorout_0.9-9
>>
>> ---
>>
>> BTW cranvas 'qscatter' (which is based on glyphs currently - and
>> therefore is not working for me) worked for me some time ago (but I
>> don't know whether it was using glyphs at that time), but I can't tell
>> what of qtpaint/qtbase/cranvas/etc. I've upgraded, sorry :-(.
>>
>> Regards,
>>  Tomas
>> _______________________________________________
>> Qtinterfaces-devel mailing list
>> Qtinterfaces-devel at lists.r-forge.r-project.org
>>
>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/qtinterfaces-devel
>
>


More information about the Qtinterfaces-devel mailing list