Page 1 of 1

OpenGL and 2D-only rendering

PostPosted: Oct 6, 2010 @ 2:53am
by totoch

I am currently moving on from the Software Rendering delivered with EdgeLib to use OpenGL for my project.
I used the code delivered with the samples to define EGL_USEGL, included GL/GL.h (I tried using both the implementation of OpenGL for Windows in Microsoft SDKs and NVidia's OpenGL SDK, both give the same results).
i also #pragma commented plugingl.lib and opengl.lib.
All has been set with Visual Studio and the code to include and use OpenGL properly in my project.
Also, I modified my code to UploadTexture() all the surfaces created with ecd->dsp (ClassEDisplay).
I also used Perspective2D before rendering, I blit using ecd->dsp (not the ecd->dsp->buffer anymore).
Well, everything renders well as usual, but I really am not sure my program is using OpenGL rendering instead of Edgelib's internal software rendering. Here is why :
- I tried modifying the values given to Perspective2D instead of the screen's real mensurations, even with funky values. Doesn't change anything.
- More importantly, SetShading(EFX_COLORKEY | EFX_OPACITY, opacity); or any other flavor of SetShading doesn't change anything to the rendering I always used to have. I need to do that, because when rendering RGBA surfaces with BltFast, I can't give an opacity to it.
- All the other OpenGL functions like glClear, etc. don't affect nothing.

My questions are :
- Is there any way to make sure it is OpenGL that used instead of EdgeLib's internal renderer ? To know what is actually real renderer my program uses ?
- Is there any way to flip RGBA surfaces (that, as far as I'm concerned, can only be blitted with the BltFast method) now that I use OpenGL ?

More importantly, I would like to know if you could be nice enough to make us a little tutorial about using OpenGL for the 2D-only games, treating of E2DSurface(RGBA) Loading and Blitting ? I think it would benefit a lot people and would be greatly appreciated.

Thank you in advance for the answer, and maybe the tutorial. That would be great!

Re: OpenGL and 2D-only rendering

PostPosted: Oct 7, 2010 @ 8:10pm
by edge
Dear Totoch,

1) To see if OpenGL is really enabled, try glClearColor and glClear (and remove the other calls) in OnNextFrame.
2) You can use display->BltFx for flipping and rotating RGBA surfaces.

Can you also try to run one of the EDGELIB OpenGL samples and build them directly from the project which is delivered with the SDK?

BTW, expanding/updating the tutorials is on our "to do" list.


Re: OpenGL and 2D-only rendering

PostPosted: Oct 8, 2010 @ 4:05am
by totoch
I managed to fix it, using your advice.
I don't know why but removing the call to include "resource.h" fixed it... Well, I don't even use icons so I guess it's not really indispensable for me.

Thank you ! And impatient to see the new tutorials !