forked from organicmaps/organicmaps
added conversions from general defines to OpenGL specific defines.
This commit is contained in:
parent
25e5d82be1
commit
b0b5c08c71
4 changed files with 100 additions and 9 deletions
|
@ -4,6 +4,19 @@ namespace graphics
|
|||
{
|
||||
static const int maxDepth = 20000;
|
||||
|
||||
enum EShaderType
|
||||
{
|
||||
EVertexShader,
|
||||
EFragmentShader
|
||||
};
|
||||
|
||||
enum EDataType
|
||||
{
|
||||
EFloat,
|
||||
EUnsigned,
|
||||
EInteger
|
||||
};
|
||||
|
||||
enum EPrimitives
|
||||
{
|
||||
ETriangles,
|
||||
|
@ -17,6 +30,11 @@ namespace graphics
|
|||
EProjection
|
||||
};
|
||||
|
||||
enum EDepthFunc
|
||||
{
|
||||
ELessEqual
|
||||
};
|
||||
|
||||
enum EPosition
|
||||
{
|
||||
EPosCenter = 0x00,
|
||||
|
|
|
@ -20,12 +20,12 @@ SOURCES += \
|
|||
opengl/base_texture.cpp \
|
||||
opengl/managed_texture.cpp \
|
||||
opengl/renderer.cpp \
|
||||
opengl/rendercontext.cpp \
|
||||
opengl/vertex.cpp \
|
||||
opengl/clipper.cpp \
|
||||
opengl/geometry_renderer.cpp \
|
||||
opengl/defines_conv.cpp \
|
||||
opengl/gl_render_context.cpp \
|
||||
opengl/storage.cpp \
|
||||
opengl/utils.cpp \
|
||||
blitter.cpp \
|
||||
resource_manager.cpp \
|
||||
skin.cpp \
|
||||
|
@ -81,7 +81,7 @@ HEADERS += \
|
|||
opengl/geometry_renderer.hpp \
|
||||
opengl/data_traits.hpp \
|
||||
opengl/storage.hpp \
|
||||
opengl/utils.hpp \
|
||||
opengl/defines_conv.hpp \
|
||||
blitter.hpp \
|
||||
resource_manager.hpp \
|
||||
skin.hpp \
|
||||
|
@ -126,11 +126,9 @@ HEADERS += \
|
|||
win32* {
|
||||
SOURCES += opengl/opengl_win32.cpp
|
||||
} else: android*|iphone* {
|
||||
HEADERS += opengl/opengl_glsl_impl.hpp
|
||||
SOURCES += opengl/opengl_glsl_es2.cpp \
|
||||
opengl/opengl_glsl_impl.cpp
|
||||
HEADERS +=
|
||||
SOURCES += opengl/opengl_es2.cpp
|
||||
} else {
|
||||
HEADERS += opengl/opengl_glsl_impl.hpp
|
||||
SOURCES += opengl/opengl_glsl_ext.cpp \
|
||||
opengl/opengl_glsl_impl.cpp
|
||||
HEADERS +=
|
||||
SOURCES += opengl/opengl_ext.cpp
|
||||
}
|
||||
|
|
61
graphics/opengl/defines_conv.cpp
Normal file
61
graphics/opengl/defines_conv.cpp
Normal file
|
@ -0,0 +1,61 @@
|
|||
#include "defines_conv.hpp"
|
||||
|
||||
namespace graphics
|
||||
{
|
||||
namespace gl
|
||||
{
|
||||
void convert(EDataType from, GLenum & to)
|
||||
{
|
||||
switch (from)
|
||||
{
|
||||
case EFloat:
|
||||
to = GL_FLOAT;
|
||||
break;
|
||||
case EUnsigned:
|
||||
to = GL_UNSIGNED_INT;
|
||||
break;
|
||||
case EInteger:
|
||||
to = GL_INT;
|
||||
break;
|
||||
default:
|
||||
LOG(LERROR, ("Unknown EDataType specified: ", from));
|
||||
to = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void convert(EShaderType from, GLenum & to)
|
||||
{
|
||||
switch (from)
|
||||
{
|
||||
case EVertexShader:
|
||||
to = GL_VERTEX_SHADER;
|
||||
break;
|
||||
case EFragmentShader:
|
||||
to = GL_FRAGMENT_SHADER;
|
||||
break;
|
||||
default:
|
||||
LOG(LERROR, ("Unknown EShaderType specified: ", from));
|
||||
to = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void convert(EPrimitives from, GLenum & to)
|
||||
{
|
||||
switch (from)
|
||||
{
|
||||
case ETriangles:
|
||||
to = GL_TRIANGLES;
|
||||
break;
|
||||
case ETrianglesFan:
|
||||
to = GL_TRIANGLE_FAN;
|
||||
break;
|
||||
case ETrianglesStrip:
|
||||
to = GL_TRIANGLE_STRIP;
|
||||
break;
|
||||
default:
|
||||
LOG(LERROR, ("Unknown EPrimitives specified: ", from));
|
||||
to = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
14
graphics/opengl/defines_conv.hpp
Normal file
14
graphics/opengl/defines_conv.hpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include "../defines.hpp"
|
||||
#include "opengl.hpp"
|
||||
|
||||
namespace graphics
|
||||
{
|
||||
namespace gl
|
||||
{
|
||||
void convert(EDataType from, GLenum & to);
|
||||
void convert(EShaderType from, GLenum & to);
|
||||
void convert(EPrimitives from, GLenum & to);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue