qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org, Anthony Liguori <aliguori@amazon.com>
Subject: Re: [Qemu-devel] [RfC PATCH 2/3] sdl2: add support for display rendering using opengl.
Date: Thu, 15 Jan 2015 11:49:20 -0500	[thread overview]
Message-ID: <54B7EF90.9060204@redhat.com> (raw)
In-Reply-To: <1421066808.8695.31.camel@nilsson.home.kraxel.org>

On 2015-01-12 at 07:46, Gerd Hoffmann wrote:
>    Hi,
>
>>>>> +    glBegin(GL_QUADS);
>>>>> +    glTexCoord2f(0, 1);  glVertex3f(-1, -1, 0);
>>>>> +    glTexCoord2f(0, 0);  glVertex3f(-1, 1, 0);
>>>>> +    glTexCoord2f(1, 0);  glVertex3f(1, 1, 0);
>>>>> +    glTexCoord2f(1, 1);  glVertex3f(1, -1, 0);
>>>>> +    glEnd();
>>>> I've been trained to hate direct mode, but it should be fine for just
>>>> this quad.
>>> --verbose please.  Guess for longer sequences it would be much more
>>> efficient to compile this into a shader program?
>> Well, again, I'm used to OpenGL 3/4 Core now which doesn't have the
>> immediate mode any more. [ ... ]
>> [ ... ] and maybe for some
>> reason there are people which want to use qemu with OpenGL acceleration
>> on a pre OpenGL 2 machine.
> For virtio-gpu we'll need OPENGL 3 anyway, so I don't feel like caring
> too much about old opengl versions.  How would the opengl 3/4 version of
> the above would look like?

Regarding OpenGL 3/4 Core, you'd need some shaders and a buffer for the 
vertex data.

So, regarding the vertex buffers, you'd have to create a buffer with 
glGenBuffers(), bind it to GL_ARRAY_BUFFER with glBindBuffer() and fill 
it with glBufferData(). Then, for every (vertex) attribute your vertex 
shader has, you call glVertexAttribPointer() (after 
glEnableVertexArray()) to specify the part of the buffer to be used for 
that attribute. You can receive the ID required for 
glVertexAttribPointer() by using glGetAttribLocation() on the linked 
shader program.

It's probably best to just go for the OpenGL 1 (or 3/4 Compatibility) 
version for now and I'll see to a patch to make it 3/4 Core later on. 
Then we can decide what to do and don't have to decide now.

Max

>>>> Using glTexSubImage2D() would give us the advantage of being able to
>>>> perform partial updates on the texture; but it seems to fit pretty bad
>>>> into the existing code. To make it fit, I'd call glTexSubImage2D()
>>>> directly in sdl2_gl_update() and just draw the quad here.
>>> Yes, that should work.
> Done, also factoring this into helper functions so gtk can use this too
> some day, new series sent out, please have a look.
>
> thanks,
>    Gerd
>
>

  parent reply	other threads:[~2015-01-15 16:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-11 11:05 [Qemu-devel] [RfC PATCH 0/3] sdl2: add opengl rendering support Gerd Hoffmann
2014-12-11 11:05 ` [Qemu-devel] [RfC PATCH 1/3] configure: opengl overhaul Gerd Hoffmann
2014-12-15 16:46   ` Michael Walle
2014-12-16  9:37     ` Gerd Hoffmann
2014-12-11 11:05 ` [Qemu-devel] [RfC PATCH 2/3] sdl2: add support for display rendering using opengl Gerd Hoffmann
2014-12-11 15:57   ` Max Reitz
2014-12-12 11:04     ` Gerd Hoffmann
2014-12-12 13:34       ` Max Reitz
2015-01-12 12:46         ` Gerd Hoffmann
2015-01-15 11:15           ` Gerd Hoffmann
2015-01-15 12:17             ` Paolo Bonzini
2015-01-15 12:23               ` Peter Maydell
2015-01-15 14:30                 ` Gerd Hoffmann
2015-01-15 16:49           ` Max Reitz [this message]
2014-12-11 11:05 ` [Qemu-devel] [RfC PATCH 3/3] sdl2: move SDL_* includes to sdl2.h Gerd Hoffmann
2014-12-11 12:32 ` [Qemu-devel] [RfC PATCH 0/3] sdl2: add opengl rendering support Daniel P. Berrange
2014-12-11 15:29   ` Gerd Hoffmann
2014-12-11 15:46     ` Daniel P. Berrange
2014-12-11 15:54       ` Gerd Hoffmann
2014-12-11 13:28 ` Paolo Bonzini
2014-12-11 15:40   ` Gerd Hoffmann
2014-12-11 17:25     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54B7EF90.9060204@redhat.com \
    --to=mreitz@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).