SDL Digest, Vol 23, Issue 8

For element arrays, I recommend using glBufferData() with a null pointer to allocate the VBO, then glMapBuffer() | memcpy() | glUnmapBuffer() to load the data. Note that the latter also allows you to update it (if you’re doing OpenGL 3.0, use glMapBufferRange() for updates). I’m even using the asmlib version of memcpy() and it works with writing to the mapped graphics memory (asmlib is a highly optimized library of a few standard library functions, see the excellent ).

As an unrelated question, most CAS-based lock-free queues I see around the Web are single reader and single writer. How does one do a multiple writer version? Win32 has interlockedPushEntrySList() but that uses a linked list, and I want an array ring buffer, and also to work on Linux (the only Linux implementation I’ve seen of this uses locks instead of interlocked instructions).> Date: Fri, 7 Nov 2008 09:48:25 +0100

From: Alberto Luaces
Subject: Re: [SDL] Newbie question - moving from Direct3D to
To: “A list for developers using the SDL library. (includes
Message-ID: <200811070948.25917.aluaces at>
Content-Type: text/plain;? charset=“iso-8859-1”

El Viernes 07 Noviembre 2008ES 00:03:48 Dmytro Bogovych escribi?:

Hi all!
There is a question about SDL/OpenGL.

I need to translate application from
Direct3D/DrawIndexedPrimitive engine
to SDL/OpenGL platform.
One of the important code is the implementation of quad rendering.
For example I have a sprite/texture object and should render
it to quad
region - something like

void RenderQuad(float x0, float y0, float x1, float y1, float
x2, float y2,
float x3, float y3)

where xn,yn - the 2D coordinates of quad.
The Direct3D implementation is based on DrawIndexedPrimitive.

May you point me the right way?
Thank you!

Hi Dmytro, I think it’s basically done the same. You first
define your vertex
array with glVertexPointer:

The same for the texture array (glTexCoordPointer):

Then you draw the primitive with glDrawArrays:

You could be also interested in glDrawElements if your mesh has
vertices, not the quad case, of course: