Commit graph

83 commits

Author SHA1 Message Date
Sam Lantinga
b6b1631cb5 Fixed calls to SDL_AddRenderDriver()
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404263
2009-12-04 08:45:08 +00:00
Sam Lantinga
8a9c9fccbb Adam Strzelecki to SDL
Currently SDL uses GL_RGB for internalFormat when GL_YCBCR_MESA is passed as format for glTextImage2D when using Linux Mesa's OpenGL. However this is wrong and makes glTextImage2D fail with invalid argument error. GL_YCBCR_MESA should be also internalFormat (not GL_RGB) there and this is what can be found googling various source codes using GL_YCBCR_MESA.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404235
2009-11-26 05:55:57 +00:00
Sam Lantinga
636dc1e63e Whoops, actually set the SDL error, don't just print the error.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404220
2009-11-22 06:34:45 +00:00
Sam Lantinga
e70cbce904 Added comment for pixel-perfect line workaround.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404216
2009-11-21 07:26:52 +00:00
Sam Lantinga
21fb49df82 Of COURSE that trick wouldn't work on all renderers. Fall back to something for now, hopefully figure out a better way to do this later.
If we have to, we can use vertical line and horizontal line textures for vertical and horizontal lines, and then create custom textures for diagonal lines and software render those.  It's terrible, but at least it would be pixel perfect.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404215
2009-11-21 07:22:59 +00:00
Sam Lantinga
0c8bb39322 This is terrible, but the OpenGL standard says that lines are half open, which means that one endpoint is not covered so adjoining lines don't overlap. It also doesn't define which end is open, and indeed Mac OS X and Linux differ. Mac OS X seems to leave the second endpoint open, but Linux uses the right-most endpoint for x major lines and the bottom-most endpoint for y major lines.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404214
2009-11-21 07:14:21 +00:00
Sam Lantinga
b10df318c7 Fixed the coordinates for pixel coverage in blits
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404213
2009-11-21 06:34:43 +00:00
Sam Lantinga
3110c4d9fb It's not the last pixel, it's the rightmost pixel, or if they're both the same x coordinate, the bottommost pixel.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404211
2009-11-21 06:19:34 +00:00
Sam Lantinga
335b459777 My first OpenGL shader! Momma will be so proud!
This shader implements the software renderer mask semantics where the source pixel is multiplied by the color and alpha modulation values and then any pixel with non-zero alpha is fully opaque.

The OpenGL renderer on Mac OS X now passes all the automated render tests! :)

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404209
2009-11-21 05:29:31 +00:00
Sam Lantinga
0c1f40faf7 Mike Gorchak to Sam
Hello Sam!

You have reverted back my patches for OpenGL renderer :)

To reproduce an issue, compare graphics output while running these tests:

testdraw2 --renderer opengl --blend mask --cyclealpha
and
testdraw2 --renderer software --blend mask --cyclealpha

You will see, that software renderer output is different from opengl renderer output.

Thanks!

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404199
2009-11-19 08:02:00 +00:00
Sam Lantinga
0f770140c0 Found a way to implement mask semantics in OpenGL
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404198
2009-11-19 05:33:41 +00:00
Sam Lantinga
556c82f866 Include the endpoint in the line we're drawing
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404196
2009-11-19 04:59:19 +00:00
Sam Lantinga
78855cf981 Adjust the vertices to be over the texel center.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404195
2009-11-19 04:33:35 +00:00
Sam Lantinga
a192c6e6bc Fixed GL_RenderReadPixels() - thanks Ryan!
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404188
2009-11-18 08:07:37 +00:00
Sam Lantinga
2d9880b962 First pass (untested) at RenderWritePixels()
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404187
2009-11-18 07:35:00 +00:00
Sam Lantinga
87442cb483 Trying to figure out why the OpenGL tests are failing...
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404184
2009-11-18 06:15:44 +00:00
Sam Lantinga
a3226cf7d3 Added missing return values
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404181
2009-11-17 06:50:29 +00:00
Sam Lantinga
0f620b7fe4 You can specify the format for pixel data in SDL_RenderReadPixels() and SDL_RenderWritePixels()
This code still doesn't quite work yet. :)

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404174
2009-11-16 07:13:07 +00:00
Sam Lantinga
08aadfdc9f Hmm, this isn't going to work, is it?
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404171
2009-11-15 08:01:34 +00:00
Sam Lantinga
960459ec63 Work in progress on OpenGL ReadPixels/WritePixels interface
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404169
2009-11-15 04:58:03 +00:00
Mike Gorchak
de6930e985 Fixed SDL_BLENDMODE_MASK for GL and GLES renderers, now blending works like in software renderer.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404074
2009-10-13 06:51:20 +00:00
Sam Lantinga
eb162e1725 -0.5 is causing trouble according to comments in bug #783
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403932
2009-09-28 15:32:58 +00:00
Sam Lantinga
4b968e37fc Removed outdated Atari support
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403828
2009-09-20 04:15:19 +00:00
Sam Lantinga
1d966b1f67 Fixed bug #783
Fixed coordinate positioning with OpenGL renderer, and added a test case

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403805
2009-09-19 05:12:26 +00:00
Sam Lantinga
3c3ba9eb95 Stefan Ullinger
Hi,

so here we go: GL_LINE_SMOOTH bad for business! ;)

I checked the code within SDL_renderer_gl.c / GL_CreateRenderer(..)
and have found the reason for blurred lines when using OpenGL.
I have attached 2 images here.
I don't know whether this has to be changed and I don't know if there
is an option to turn it off/on...just wanted to say that with GL_LINE_SMOOTH
enabled there is a difference when rendering with opengl compared to directx.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403803
2009-09-19 04:43:41 +00:00
Sam Lantinga
d036689ab0 Fixed issues building 64-bit Windows binary
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403783
2009-09-05 23:37:35 +00:00
Sam Lantinga
a2c7f4e1b4 Fixed OpenGL state issue reported by Dmytro Bogovych
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403503
2009-01-14 06:53:03 +00:00
Sam Lantinga
d123950aa3 Reverted Bob's indent checkin
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403475
2009-01-10 21:50:26 +00:00
Bob Pendleton
44fa7675c8 I ran a global "make indent" it modified the following files.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403473
2009-01-09 20:43:30 +00:00
Sam Lantinga
6611747b8f Removed unused variable
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403399
2008-12-31 08:05:21 +00:00
Sam Lantinga
599fb25b17 iPhone build compiles again (drawing routines need to be implemented)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403398
2008-12-31 07:56:56 +00:00
Sam Lantinga
3fc02a176b SetDrawColor() and SetDrawBlendMode() are optional
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403389
2008-12-30 07:14:11 +00:00
Sam Lantinga
2b206b6e63 Swapped functions to match the other renderer files
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403387
2008-12-30 04:22:24 +00:00
Sam Lantinga
63191e7a8b Significant performance boost with blend mode none
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403384
2008-12-29 19:48:01 +00:00
Sam Lantinga
c53a7c6ca2 Updated to build on Windows
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403380
2008-12-25 05:11:29 +00:00
Sam Lantinga
f055f6a189 Added RenderPiont() API
Merged the drawing tests into a single test program

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403363
2008-12-21 17:39:41 +00:00
Sam Lantinga
bb191f10ff Turn on line antialiasing (requires blending to be enabled)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403355
2008-12-20 18:40:30 +00:00
Sam Lantinga
9ba7210778 Date: Fri, 19 Dec 2008 20:17:35 +0100
From: Couriersud
Subject: Re: Aw: Experience using SDL1.3 in sdlmame/Proposal for api additions

> For consistency you'd probably want:
> SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a);
> SDL_SetRenderDrawBlendMode(SDL_BlendMode blendMode);
> SDL_RenderLine(int x1, int y1, int x2, int y2);
> SDL_RenderFill(SDL_Rect *rect);
>
> You probably also want to add API functions query the current state.
>

I have implemented the above api for the opengl, x11, directfb and
software renderers. I have also renamed *TEXTUREBLENDMODE* constants to
BLENDMODE*. The unix build compiles. The windows renderer still needs to
be updated, but I have no windows development machine at hand. Have a
look at the x11 renderer for a sample.

Vector games now run at 90% both on opengl and directfb in comparison to
sdlmame's own opengl renderer. The same applies to raster games.

The diff also includes

a) Changed XDrawRect to XFillRect in x11 renderer
b) A number of changes to fix blending and modulation issues in the
directfb renderer.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403346
2008-12-20 12:00:00 +00:00
Sam Lantinga
6e7ef5d5b1 A little cleanup for SDL snapshot release
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403319
2008-12-08 00:24:15 +00:00
Ryan C. Gordon
546fea4e11 Comment cleanup.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403309
2008-12-07 07:16:40 +00:00
Ryan C. Gordon
0096fd0e8d Don't hardcode RECT for fragment program texture targets.
Now we can generate what a given system needs when compiling the shader.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403308
2008-12-07 07:06:34 +00:00
Sam Lantinga
8b4a508fb4 Slight optimization of the shader, no need to scale into 0..255
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403307
2008-12-07 04:38:32 +00:00
Sam Lantinga
5908561ee3 Added official support for GL_APPLE_ycbcr_422 and GL_MESA_ycbcr_texture
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403306
2008-12-07 04:02:23 +00:00
Sam Lantinga
0fa8c80ca0 The YCbCr texture extension works now that bytes_per_pixel() returns the
correct value for YUV textures.  Yay!

I'm still cheering for Ryan's pixel shader instead, since once it works
different shaders can handle all the YUV formats.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403305
2008-12-06 18:37:06 +00:00
Sam Lantinga
f03cab2b46 Fixed the shader fragment problems using 2 byte YUV data in a 4 byte RGB
texture.  This is a total hack though.  Maybe we should be using a different
texture format?

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403304
2008-12-06 18:22:28 +00:00
Sam Lantinga
700f822150 The previous checkin fixes the crash, so at least we're not overrunning
the texture pixel data anymore...

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403301
2008-12-06 17:43:10 +00:00
Sam Lantinga
2eb5631950 Progress, maybe. :)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403300
2008-12-06 17:41:01 +00:00
Sam Lantinga
d929dca890 Rebind the context to the window area and update matrices when the window size changes
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403297
2008-12-06 05:23:35 +00:00
Ryan C. Gordon
b59986d747 Initial pixel shader support for YUV textures in the GL renderer.
This work is not complete yet!

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403296
2008-12-06 00:56:47 +00:00
Sam Lantinga
b19daa445d Whoops, can't call glOrtho() repeatedly
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403294
2008-12-05 07:00:58 +00:00