Hi all!
I have few questions:
I was walking in Rice code and I've seen a part of code that seems useless, I would like to have your advise:
http://pastebin.com/pQiTdwzg
is ClearDeviceObjects() useful?
Second:
in src/OGLRender.cpp:101, there is dirty code to find the clamp to edge extention.
As GL_CLAMP_TO_EDGE is part of OpenGL 1.2 I suggest to don't have all this test and set just this:
OGLXUVFlagMaps[TEXTURE_UV_FLAG_CLAMP].realFlag = GL_CLAMP_TO_EDGE;
So, we don't need m_bSupportClampToEdge anymore.
Same for GL_MIRRORED_REPEAT which is in OpenGL 1.4. I suggest just use:
OGLXUVFlagMaps[TEXTURE_UV_FLAG_MIRROR].realFlag = GL_MIRRORED_REPEAT;
If we do this, a part of the code (few lines) could be merges between OGLES and OGL.
I just wonder if this is truly what we want. I mean, GL_CLAMP and GL_CLAMP_TO_EDGE are two different way to deal with texture.
Can someone confirm GL_CLAMP is used in any way and
OGLXUVFlagMaps[TEXTURE_UV_FLAG_CLAMP].realFlag is used only when we want
a clamp to the edges? I can't get that...
Same for OGLXUVFlagMaps[TEXTURE_UV_FLAG_MIRROR].realFlag = GL_MIRRORED_REPEAT.
Do we really use it when we want mirrored repeat and nothing else?
If this both flags are now not dynamic (like it was before), is there a valid reason to keep this structure:
UVFlagMap OGLXUVFlagMaps[] =
{
{TEXTURE_UV_FLAG_WRAP, GL_REPEAT},
{TEXTURE_UV_FLAG_MIRROR, GL_MIRRORED_REPEAT_ARB},
{TEXTURE_UV_FLAG_CLAMP, GL_CLAMP},
};
I was looking in the UVFlagMap structure:
typedef struct
{
TextureUVFlag N64flag;
uint32 realFlag;
} UVFlagMap;
N64flag doesn't seems to be used anywhere. and only realFlag seems to be used.
So if we decide there is not multiple possibilities, could we choose to remove this system?
I just try to understand. :)
Another point. There is a lot of work do define functions in OGLExtentions.h and cpp.
A convinient way would be to define GL_GLEXT_PROTOTYPES just before:
#include <SDL_opengl.h>
This way, SDL would include almost every gl function declared in OGLExtentions.
Is there a good reason to not define GL_GLEXT_PROTOTYPES?
A start of an (interesting) answer here:
http://stackoverflow.com/questions/17524794/defining-gl-glext-prototypes-vs-getting-function-pointers
http://stackoverflow.com/questions/7532110/vertex-buffer-objects-with-sdl
OGLExtentions.h and cpp still include SDL_opengl.h instead of osal_opengl.h.
Is this normal?
Same, reading this in OGLExtentions.h:
/* The function pointer types are defined here because as of 2009 some OpenGL drivers under Linux do 'incorrect' things which
mess up the SDL_opengl.h header, resulting in no function pointer typedefs at all, and thus compilation errors.
*/
Make me think the commentor wasn't aware of GL_GLEXT_PROTOTYPES. From
the SDL_opengl.h, the only thing to do to have function pointers is use
GL_GLEXT_PROTOTYPES before.
If we do it well, OGLExtentions.cpp shouldn't be necessary anymore.
I can do all of this in few commits and send a push request if you want.
Thanks in advance! :)
Rice (and certainly others) need a lot of cleanup but this look possible (from my investigations).
A first step would be to remove anything extensions related if the extentions is now in OGL 2 and more.
I've dig a little in OGLFragmentShaders and it is really obsolete. It
rely on a very old shader approach. Seems to be hard to update but maybe
possible.
For now, I'm slowly replacing old stuff (pgl*, ARB, etc...) by new one
(and so, decrease code size) and everything seems to work fine.