This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Blitting a surface on top of another (OpenGL)


Blitting a surface on top of another (OpenGL)

Postby Nacho84 » Jul 9, 2009 @ 7:22pm

Hi! I need to add detail to an existing 2D surface by blitting another surface on top of it. Up to this point, I haven't been using OpenGL and managed to get good results by calling the BltFast method from the destination surface.

I've now changed my code to make use of OpenGL (I'm working on Windows) but, unfortunately, the BltFast() method I use to compose the surface is returning E_LOCKFAILED and I don't know how to solve it.

I'm attaching a Visual Studio solution with a very simple example so that you can try it out and tell me what's missing. The call to BltFast that is failing is located in the line 194 of main.cpp

Many thanks!

--Nacho
Attachments
SurfIntoSurf.rar
(167.38 KiB) Downloaded 653 times
Nacho84
pm Member
 
Posts: 82
Joined: Dec 15, 2007 @ 12:00pm
Location: Buenos Aires, Argentina


Postby edge » Jul 14, 2009 @ 10:39am

EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby Nacho84 » Jul 20, 2009 @ 12:02am

Nacho84
pm Member
 
Posts: 82
Joined: Dec 15, 2007 @ 12:00pm
Location: Buenos Aires, Argentina


Postby edge » Jul 27, 2009 @ 12:49pm

Hi Nacho,

The rectangle isn't filled because the E_RGBX macro doesn't specify opacity information. The correct way is to use E_RGBA, for example: E_RGBA(255, 0, 0, 255) for a red color.

Unfortunately it isn't possible to draw rectangles and lines easily. At the moment, the best way to do this is to use an E3DSurface object containing your rectangle, or use OpenGL directly.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby Nacho84 » Aug 4, 2009 @ 2:25am

Hi edge,

Many thanks for your reply! The filled rectangle worked great. I'll see if I can implement the non-filled rectangle using OpenGL during the weekend.

--Nacho
Nacho84
pm Member
 
Posts: 82
Joined: Dec 15, 2007 @ 12:00pm
Location: Buenos Aires, Argentina


Postby Nacho84 » Aug 10, 2009 @ 3:07am

Nacho84
pm Member
 
Posts: 82
Joined: Dec 15, 2007 @ 12:00pm
Location: Buenos Aires, Argentina


Postby edge » Aug 11, 2009 @ 10:23am

Hi Nacho,

The lines are probably green because texturing is still enabled. Also, did you know you can't use glBegin/End calls on many mobile devices?

To fix this you need to call glDisable(GL_TEXTURE2D) and disable some OpenGL client states: texture coordinate, color and normal arrays.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron