SDL+OpenGL

I try to use the SDL_GL_GetProcAddress(), for using OpenGL extension,
It don’t work, but it work with wglGetProcAddress() ?

I believe this is fixed in current CVS.

m.On Tue, Sep 19, 2000 at 06:51:11PM +0200, DUHAMEL Patrice wrote:

I try to use the SDL_GL_GetProcAddress(), for using OpenGL extension,
It don’t work, but it work with wglGetProcAddress() ?


Programmer “Ha ha.” “Ha ha.” "What are you laughing at?"
Loki Software "Just the horror of being alive."
http://lokigames.com/~briareos/ - Tony Millionaire

Hi i was wondering if there was a way to request a 32 bit depth buffer for
OpenGL through SDL.

Thanks!
Atrix

nevermind, i found out how, thanks> ----- Original Message -----

From: @atrix2 (atrix2)
To:
Sent: Sunday, April 27, 2003 6:46 PM
Subject: [SDL] SDL+OpenGL

Hi i was wondering if there was a way to request a 32 bit depth buffer for
OpenGL through SDL.

Thanks!
Atrix


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Atrix Wolfe wrote:

Hi i was wondering if there was a way to request a 32 bit depth buffer for
OpenGL through SDL.

SDL_CreateRGBSurface()?

Gib

SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 32);

before you SDL_SetVideoMode()

Gib Bogle writes:> Atrix Wolfe wrote:

Hi i was wondering if there was a way to request a 32 bit depth buffer for
OpenGL through SDL.

SDL_CreateRGBSurface()?

Gib


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


sdl

Hi,

I’m rendering text with SDL_ttf to an SDL_Surface and converting this
surface to a OpenGL texture.

When I render the texture the screen, the text appears a bit blurred. If
I compare the output of SDL_ttf to the texture rendered on the screen I
can see that there really is a difference.

My SDL_Surface -> OpenGL texture does only it it’s supposed to do, no
processing of the pixels is done.

I’ve read that a pixel’s center in OpenGL is off by +0.5 in both axes.
If that’s my problem, how can I avoid it? By making sure every vertex
coordinate is off by +0.5 when I render a texture?

Thanks,

Andre

I’m rendering text with SDL_ttf to an SDL_Surface and converting
this surface to a OpenGL texture.
When I render the texture the screen, the text appears a bit
blurred. If I compare the output of SDL_ttf to the texture rendered
on the screen I can see that there really is a difference.
My SDL_Surface -> OpenGL texture does only it it’s supposed to do,
no processing of the pixels is done.
I’ve read that a pixel’s center in OpenGL is off by +0.5 in both
axes. If that’s my problem, how can I avoid it? By making sure every
vertex coordinate is off by +0.5 when I render a texture?

That’s right. Absolutely true is you set viewport to (0, 0, width,
height) and this is way it works in SDL.
So if you got pixel at (x, y) in OpenGL it will begin at (x, y) and
end at (x+1, y+1). That’s why you need to always render some textures
into rectanular triangle span (x, y, x+texture_width, y
+texture_height) and this should guarantee you perfect pixel mapping,
and this what you get when using destination RECT
(x,y,texture_width,texture_height) with SDL_RenderCopy.

There was once a nasty fix to viewport setting in SVN 1.3 (SDL) that
broke pixel accuracy but it was rolled back, so make sure you got
latest SVN and you use RECT(x,y,texture_width,texture_height) as
destination rect and NULL for source rect.

I am sure there’s no problem with SDL, so either you got:
(1) buggy revision of SDL 1.3 (see above)
(2) you don’t use RECT(x,y,texture_width,texture_height) as dest
(3) you changed/customized texture pixel position by your own with
glSetXXX

I am using here SDL 1.3 & SDL_ttf with OpenGL and I can tell you
everything is rendered OK on my side.

Regards,–
Adam Strzelecki | nanoant.com

I’m rendering text with SDL_ttf to an SDL_Surface and converting
this surface to a OpenGL texture.
When I render the texture the screen, the text appears a bit
blurred. If I compare the output of SDL_ttf to the texture rendered
on the screen I can see that there really is a difference.
My SDL_Surface -> OpenGL texture does only it it’s supposed to do,
no processing of the pixels is done.
I’ve read that a pixel’s center in OpenGL is off by +0.5 in both
axes. If that’s my problem, how can I avoid it? By making sure every
vertex coordinate is off by +0.5 when I render a texture?

That’s right. Absolutely true is you set viewport to (0, 0, width,
height) and this is way it works in SDL.
So if you got pixel at (x, y) in OpenGL it will begin at (x, y) and
end at (x+1, y+1). That’s why you need to always render some textures
into rectanular triangle span (x, y, x+texture_width, y
+texture_height) and this should guarantee you perfect pixel mapping,
and this what you get when using destination RECT
(x,y,texture_width,texture_height) with SDL_RenderCopy.

There was once a nasty fix to viewport setting in SVN 1.3 (SDL) that
broke pixel accuracy but it was rolled back, so make sure you got
latest SVN and you use RECT(x,y,texture_width,texture_height) as
destination rect and NULL for source rect.

I am sure there’s no problem with SDL, so either you got:
(1) buggy revision of SDL 1.3 (see above)
(2) you don’t use RECT(x,y,texture_width,texture_height) as dest
(3) you changed/customized texture pixel position by your own with
glSetXXX

I am using here SDL 1.3 & SDL_ttf with OpenGL and I can tell you
everything is rendered OK on my side.

I’m actually using SDL 1.2 and issuing OpenGL commands myself.

I’m using float for everything, so maybe I have to switch to integers and
add 0.5f to the vertex coordinates when rendering the quads.

Thanks for the answer.> Regards,


Adam Strzelecki | nanoant.com


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


Mensagem enviada pelo Microlink Webmail 12.7.8p3

I’m actually using SDL 1.2 and issuing OpenGL commands myself.

I’m using float for everything, so maybe I have to switch to
integers and
add 0.5f to the vertex coordinates when rendering the quads.

Aha… then you should use glViewport( 0, 0, screen_width,
screen_height );

And when rendering texture at (x,y) render GL_QUADS of:

(x,y,0.0f) (x+texture_width,y,0.0f) (x+texture_width,y+texture_height,
0.0f) (x,y+texture_height,0.0f)

with tex coords (0,0) (texture_width,0) (texture_width,texture_height)
(0,texture_height)

Adding here or anywhere 0.5 is unnecessary.

Is it what you do ?

Regards,–
Adam

with tex coords (0,0) (texture_width,0)
(texture_width,texture_height) (0,texture_height)

Argh… here should be (0.0f,0.0f) (1.0f,0.0f) (1.0f,1.0f) (0.0f,
1.0f). sorry.

There’s short but good article here about that:
http://www.mindcontrol.org/~hplus/graphics/opengl-pixel-perfect.html--
Adam