Newbie question - moving from Direct3D to SDL/OpenGL

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,

what about using vertex arrays?

http://www.songho.ca/opengl/gl_vertexarray.html--
Paulo

On Fri, Nov 7, 2008 at 12:03 AM, Dmytro Bogovych wrote:

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!


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yes!
Thanks!
That’s what I need :)> ----- Original Message -----

From: Paulo Pinto
To: A list for developers using the SDL library. (includes SDL-announce)
Sent: Friday, November 07, 2008 1:59 PM
Subject: Re: [SDL] Newbie question - moving from Direct3D to SDL/OpenGL

Hi,

what about using vertex arrays?

http://www.songho.ca/opengl/gl_vertexarray.html


Paulo

On Fri, Nov 7, 2008 at 12:03 AM, Dmytro Bogovych wrote:

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!


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

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:

http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/vertexpointer.html

The same for the texture array (glTexCoordPointer):

http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texcoordpointer.html

Then you draw the primitive with glDrawArrays:

http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawarrays.html

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

http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawelements.html

Regards,

Alberto

Hi,

what about using vertex arrays?

http://www.songho.ca/opengl/gl_vertexarray.html--
Paulo

On Fri, Nov 7, 2008 at 12:03 AM, Dmytro Bogovych wrote:

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!


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Thanks!
I trying to integrate now it to application :)> ----- Original Message -----

From: aluaces@udc.es (Alberto Luaces Fernandez)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Friday, November 07, 2008 10:48 AM
Subject: Re: [SDL] Newbie question - moving from Direct3D to SDL/OpenGL

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:

http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/vertexpointer.html

The same for the texture array (glTexCoordPointer):

http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texcoordpointer.html

Then you draw the primitive with glDrawArrays:

http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawarrays.html

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

http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawelements.html

Regards,

Alberto


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org