Delete OpenGL ES 1.0 driver (#15067)

This commit is contained in:
sfan5 2024-08-28 20:44:42 +02:00 committed by GitHub
parent 1298d6c020
commit bf4d31227b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 11 additions and 3453 deletions

View File

@ -1851,8 +1851,7 @@ shader_path (Shader path) path
# The rendering back-end.
# Note: A restart is required after changing this!
# OpenGL is the default for desktop, and OGLES2 for Android.
# Shaders are supported by everything but OGLES1.
video_driver (Video driver) enum ,opengl,opengl3,ogles1,ogles2
video_driver (Video driver) enum ,opengl,opengl3,ogles2
# Distance in nodes at which transparency depth sorting is enabled
# Use this to limit the performance impact of transparency depth sorting

View File

@ -20,7 +20,6 @@ The following libraries are required to be installed:
Aside from standard search options (`ZLIB_INCLUDE_DIR`, `ZLIB_LIBRARY`, ...) the following options are available:
* `ENABLE_OPENGL` - Enable OpenGL driver
* `ENABLE_OPENGL3` (default: `OFF`) - Enable OpenGL 3+ driver
* `ENABLE_GLES1` - Enable OpenGL ES driver, legacy
* `ENABLE_GLES2` - Enable OpenGL ES 2+ driver
* `USE_SDL2` (default: platform-dependent, usually `ON`) - Use SDL2 instead of older native device code

View File

@ -24,9 +24,6 @@ enum E_DRIVER_TYPE
primitives. */
EDT_OPENGL,
//! OpenGL-ES 1.x driver, for embedded and mobile systems
EDT_OGLES1,
//! OpenGL-ES 2.x driver, for embedded and mobile systems
/** Supports shaders etc. */
EDT_OGLES2,

View File

@ -152,9 +152,6 @@ EGLConfig CEGLManager::chooseConfig(EConfigStyle confStyle)
// Find proper OpenGL BIT.
EGLint eglOpenGLBIT = 0;
switch (Params.DriverType) {
case EDT_OGLES1:
eglOpenGLBIT = EGL_OPENGL_ES_BIT;
break;
case EDT_OGLES2:
case EDT_WEBGL1:
eglOpenGLBIT = EGL_OPENGL_ES2_BIT;
@ -459,9 +456,6 @@ bool CEGLManager::generateContext()
EGLint OpenGLESVersion = 0;
switch (Params.DriverType) {
case EDT_OGLES1:
OpenGLESVersion = 1;
break;
case EDT_OGLES2:
case EDT_WEBGL1:
OpenGLESVersion = 2;

View File

@ -33,7 +33,7 @@
#include <X11/extensions/XInput2.h>
#endif
#if defined(_IRR_COMPILE_WITH_OGLES1_) || defined(_IRR_COMPILE_WITH_OGLES2_)
#if defined(_IRR_COMPILE_WITH_OGLES2_)
#include "CEGLManager.h"
#endif
@ -76,10 +76,6 @@ namespace video
IVideoDriver *createOpenGLDriver(const irr::SIrrlichtCreationParameters &params, io::IFileSystem *io, IContextManager *contextManager);
#endif
#ifdef _IRR_COMPILE_WITH_OGLES1_
IVideoDriver *createOGLES1Driver(const irr::SIrrlichtCreationParameters &params, io::IFileSystem *io, IContextManager *contextManager);
#endif
#ifdef _IRR_COMPILE_WITH_OGLES2_
IVideoDriver *createOGLES2Driver(const irr::SIrrlichtCreationParameters &params, io::IFileSystem *io, IContextManager *contextManager);
#endif
@ -554,22 +550,6 @@ void CIrrDeviceLinux::createDriver()
}
#else
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);
#endif
break;
case video::EDT_OGLES1:
#ifdef _IRR_COMPILE_WITH_OGLES1_
{
video::SExposedVideoData data;
data.OpenGLLinux.X11Window = XWindow;
data.OpenGLLinux.X11Display = XDisplay;
ContextManager = new video::CEGLManager();
ContextManager->initialize(CreationParams, data);
VideoDriver = video::createOGLES1Driver(CreationParams, FileSystem, ContextManager);
}
#else
os::Printer::log("No OpenGL-ES1 support compiled in.", ELL_ERROR);
#endif
break;
case video::EDT_OGLES2:

View File

@ -720,9 +720,8 @@ void CIrrDeviceMacOSX::createDriver()
#endif
break;
case video::EDT_OGLES1:
case video::EDT_OGLES2:
os::Printer::log("This driver is not available in OSX. Try OpenGL or Software renderer.", ELL_ERROR);
os::Printer::log("This driver is not available on OSX.", ELL_ERROR);
break;
case video::EDT_NULL:

View File

@ -594,18 +594,14 @@ bool CIrrDeviceSDL::createWindowWithContext()
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
break;
case video::EDT_OGLES1:
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
break;
case video::EDT_OGLES2:
case video::EDT_WEBGL1:
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
break;
default:;
default:
_IRR_DEBUG_BREAK_IF(1);
}
if (CreationParams.DriverDebug) {

View File

@ -29,7 +29,7 @@
#endif
#endif
#if defined(_IRR_COMPILE_WITH_OGLES1_) || defined(_IRR_COMPILE_WITH_OGLES2_)
#if defined(_IRR_COMPILE_WITH_OGLES2_)
#include "CEGLManager.h"
#endif
@ -45,10 +45,6 @@ namespace video
IVideoDriver *createOpenGLDriver(const irr::SIrrlichtCreationParameters &params, io::IFileSystem *io, IContextManager *contextManager);
#endif
#ifdef _IRR_COMPILE_WITH_OGLES1_
IVideoDriver *createOGLES1Driver(const irr::SIrrlichtCreationParameters &params, io::IFileSystem *io, IContextManager *contextManager);
#endif
#ifdef _IRR_COMPILE_WITH_OGLES2_
IVideoDriver *createOGLES2Driver(const irr::SIrrlichtCreationParameters &params, io::IFileSystem *io, IContextManager *contextManager);
#endif
@ -890,21 +886,6 @@ void CIrrDeviceWin32::createDriver()
os::Printer::log("Could not create OpenGL driver.", ELL_ERROR);
#else
os::Printer::log("OpenGL driver was not compiled in.", ELL_ERROR);
#endif
break;
case video::EDT_OGLES1:
#ifdef _IRR_COMPILE_WITH_OGLES1_
switchToFullScreen();
ContextManager = new video::CEGLManager();
ContextManager->initialize(CreationParams, video::SExposedVideoData(HWnd));
VideoDriver = video::createOGLES1Driver(CreationParams, FileSystem, ContextManager);
if (!VideoDriver)
os::Printer::log("Could not create OpenGL-ES1 driver.", ELL_ERROR);
#else
os::Printer::log("OpenGL-ES1 driver was not compiled in.", ELL_ERROR);
#endif
break;
case video::EDT_OGLES2:

View File

@ -130,12 +130,6 @@ else()
option(ENABLE_OPENGL "Enable OpenGL" TRUE)
endif()
if(USE_SDL2 OR EMSCRIPTEN OR APPLE)
set(ENABLE_GLES1 FALSE)
else()
option(ENABLE_GLES1 "Enable OpenGL ES" FALSE)
endif()
if(APPLE)
set(ENABLE_GLES2 FALSE)
set(ENABLE_WEBGL1 FALSE)
@ -172,14 +166,6 @@ if(ENABLE_OPENGL3)
endif()
endif()
if(ENABLE_GLES1)
add_definitions(-D_IRR_COMPILE_WITH_OGLES1_)
set(OPENGLES_DIRECT_LINK TRUE)
if(DEVICE MATCHES "^(WINDOWS|X11)$")
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_)
endif()
endif()
if(ENABLE_GLES2)
add_definitions(-D_IRR_COMPILE_WITH_OGLES2_)
if(DEVICE MATCHES "^(WINDOWS|X11)$" OR EMSCRIPTEN)
@ -204,7 +190,6 @@ endif()
message(STATUS "Device: ${DEVICE}")
message(STATUS "OpenGL: ${ENABLE_OPENGL}")
message(STATUS "OpenGL 3: ${ENABLE_OPENGL3}")
message(STATUS "OpenGL ES: ${ENABLE_GLES1}")
if (ENABLE_GLES2)
message(STATUS "OpenGL ES 2: ON (unified)")
else()
@ -220,13 +205,6 @@ find_package(ZLIB REQUIRED)
find_package(JPEG REQUIRED)
find_package(PNG REQUIRED)
if(ENABLE_GLES1)
# only tested on Android, probably works on Linux (is this needed anywhere else?)
find_library(OPENGLES_LIBRARY NAMES GLESv1_CM REQUIRED)
find_library(EGL_LIBRARY NAMES EGL REQUIRED)
message(STATUS "Found OpenGLES: ${OPENGLES_LIBRARY}")
endif()
if(ENABLE_GLES2)
find_package(OpenGLES2 REQUIRED)
endif()
@ -360,14 +338,6 @@ if(ENABLE_OPENGL)
)
endif()
if(ENABLE_GLES1)
set(IRRDRVROBJ
${IRRDRVROBJ}
COGLESDriver.cpp
COGLESExtensionHandler.cpp
)
endif()
# the unified drivers
if(ENABLE_OPENGL3 OR ENABLE_GLES2)
@ -509,7 +479,6 @@ target_link_libraries(IrrlichtMt PRIVATE
"$<$<BOOL:${USE_SDL2}>:SDL2::SDL2>"
"$<$<BOOL:${OPENGL_DIRECT_LINK}>:${OPENGL_LIBRARIES}>"
"$<$<BOOL:${OPENGLES_DIRECT_LINK}>:${OPENGLES_LIBRARY}>"
${EGL_LIBRARY}
# incl. transitive SDL2 dependencies for static linking

View File

@ -1,122 +0,0 @@
// Copyright (C) 2015 Patryk Nadrowski
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#pragma once
#ifdef _IRR_COMPILE_WITH_OGLES1_
#if defined(_IRR_COMPILE_WITH_IOS_DEVICE_)
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
#elif defined(_IRR_OGLES1_USE_KHRONOS_API_HEADERS_)
#include <khronos-api/GLES/gl.h>
#include <EGL/eglplatform.h>
typedef char GLchar;
#else // or only when defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_) ?
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <EGL/eglplatform.h>
#endif
#ifndef GL_BGRA
#define GL_BGRA 0x80E1;
#endif
// Blending definitions.
#if defined(GL_OES_blend_subtract)
#define GL_FUNC_ADD GL_FUNC_ADD_OES
#else
#define GL_FUNC_ADD 0
#endif
// FBO definitions.
#ifdef GL_OES_framebuffer_object
#define GL_NONE 0 // iOS has missing definition of GL_NONE_OES
#define GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
#define GL_DEPTH_COMPONENT16 GL_DEPTH_COMPONENT16_OES
#define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES
#define GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_OES
#define GL_STENCIL_ATTACHMENT GL_STENCIL_ATTACHMENT_OES
#define GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES
#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 1
#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 2
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES
#define GL_FRAMEBUFFER_UNSUPPORTED GL_FRAMEBUFFER_UNSUPPORTED_OES
#else
#define GL_NONE 0
#define GL_FRAMEBUFFER 0
#define GL_DEPTH_COMPONENT16 0
#define GL_COLOR_ATTACHMENT0 0
#define GL_DEPTH_ATTACHMENT 0
#define GL_STENCIL_ATTACHMENT 0
#define GL_FRAMEBUFFER_COMPLETE 0
#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 1
#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 2
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 3
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS 4
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 5
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 6
#define GL_FRAMEBUFFER_UNSUPPORTED 7
#endif
#define GL_DEPTH_COMPONENT 0x1902
// Texture definitions.
#ifdef GL_OES_texture_cube_map
#define GL_TEXTURE_CUBE_MAP GL_TEXTURE_CUBE_MAP_OES
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES
#else
#define GL_TEXTURE_CUBE_MAP 0
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0
#endif
// to check if this header is in the current compile unit (different GL implementation used different "GLCommon" headers in Irrlicht
#define IRR_COMPILE_GLES_COMMON
// macro used with COGLES1Driver
#define TEST_GL_ERROR(cls) (cls)->testGLError(__LINE__)
namespace irr
{
namespace video
{
// Forward declarations.
class COpenGLCoreFeature;
template <class TOpenGLDriver>
class COpenGLCoreTexture;
template <class TOpenGLDriver, class TOpenGLTexture>
class COpenGLCoreRenderTarget;
template <class TOpenGLDriver, class TOpenGLTexture>
class COpenGLCoreCacheHandler;
class COGLES1Driver;
typedef COpenGLCoreTexture<COGLES1Driver> COGLES1Texture;
typedef COpenGLCoreRenderTarget<COGLES1Driver, COGLES1Texture> COGLES1RenderTarget;
typedef COpenGLCoreCacheHandler<COGLES1Driver, COGLES1Texture> COGLES1CacheHandler;
}
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,317 +0,0 @@
// Copyright (C) 2002-20014 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
#pragma once
#include "SIrrCreationParameters.h"
#ifdef _IRR_COMPILE_WITH_OGLES1_
#include "CNullDriver.h"
#include "IMaterialRendererServices.h"
#include "EDriverFeatures.h"
#include "fast_atof.h"
#include "COGLESExtensionHandler.h"
#include "IContextManager.h"
#define TEST_GL_ERROR(cls) (cls)->testGLError(__LINE__)
namespace irr
{
namespace video
{
class COGLES1Driver : public CNullDriver, public IMaterialRendererServices, public COGLES1ExtensionHandler
{
friend class COpenGLCoreTexture<COGLES1Driver>;
public:
//! constructor
COGLES1Driver(const SIrrlichtCreationParameters &params, io::IFileSystem *io, IContextManager *contextManager);
//! destructor
virtual ~COGLES1Driver();
virtual bool beginScene(u16 clearFlag, SColor clearColor = SColor(255, 0, 0, 0), f32 clearDepth = 1.f, u8 clearStencil = 0,
const SExposedVideoData &videoData = SExposedVideoData(), core::rect<s32> *sourceRect = 0) override;
bool endScene() override;
//! sets transformation
void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4 &mat) override;
struct SHWBufferLink_opengl : public SHWBufferLink
{
SHWBufferLink_opengl(const scene::IMeshBuffer *_MeshBuffer) :
SHWBufferLink(_MeshBuffer), vbo_verticesID(0), vbo_indicesID(0) {}
GLuint vbo_verticesID; // tmp
GLuint vbo_indicesID; // tmp
GLuint vbo_verticesSize; // tmp
GLuint vbo_indicesSize; // tmp
};
bool updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer);
bool updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer);
//! updates hardware buffer if needed
bool updateHardwareBuffer(SHWBufferLink *HWBuffer) override;
//! Create hardware buffer from mesh
SHWBufferLink *createHardwareBuffer(const scene::IMeshBuffer *mb) override;
//! Delete hardware buffer (only some drivers can)
void deleteHardwareBuffer(SHWBufferLink *HWBuffer) override;
//! Draw hardware buffer
void drawHardwareBuffer(SHWBufferLink *HWBuffer) override;
IRenderTarget *addRenderTarget() override;
//! draws a vertex primitive list
virtual void drawVertexPrimitiveList(const void *vertices, u32 vertexCount,
const void *indexList, u32 primitiveCount,
E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType) override;
void drawVertexPrimitiveList2d3d(const void *vertices, u32 vertexCount, const void *indexList, u32 primitiveCount, E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType = EIT_16BIT, bool threed = true);
//! queries the features of the driver, returns true if feature is available
bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const override
{
// return FeatureEnabled[feature] && COGLES1ExtensionHandler::queryFeature(feature);
return COGLES1ExtensionHandler::queryFeature(feature);
}
//! Sets a material.
void setMaterial(const SMaterial &material) override;
virtual void draw2DImage(const video::ITexture *texture, const core::position2d<s32> &destPos,
const core::rect<s32> &sourceRect, const core::rect<s32> *clipRect = 0,
SColor color = SColor(255, 255, 255, 255), bool useAlphaChannelOfTexture = false) override;
virtual void draw2DImage(const video::ITexture *texture, const core::rect<s32> &destRect,
const core::rect<s32> &sourceRect, const core::rect<s32> *clipRect = 0,
const video::SColor *const colors = 0, bool useAlphaChannelOfTexture = false) override;
virtual void draw2DImage(const video::ITexture *texture, u32 layer, bool flip);
//! draws a set of 2d images, using a color and the alpha channel of the texture if desired.
virtual void draw2DImageBatch(const video::ITexture *texture,
const core::array<core::position2d<s32>> &positions,
const core::array<core::rect<s32>> &sourceRects,
const core::rect<s32> *clipRect = 0,
SColor color = SColor(255, 255, 255, 255),
bool useAlphaChannelOfTexture = false) override;
//! draw an 2d rectangle
virtual void draw2DRectangle(SColor color, const core::rect<s32> &pos,
const core::rect<s32> *clip = 0) override;
//! Draws an 2d rectangle with a gradient.
virtual void draw2DRectangle(const core::rect<s32> &pos,
SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown,
const core::rect<s32> *clip = 0) override;
//! Draws a 2d line.
virtual void draw2DLine(const core::position2d<s32> &start,
const core::position2d<s32> &end,
SColor color = SColor(255, 255, 255, 255)) override;
//! Draws a 3d line.
virtual void draw3DLine(const core::vector3df &start,
const core::vector3df &end,
SColor color = SColor(255, 255, 255, 255)) override;
//! Returns the name of the video driver.
const char *getName() const override;
//! Sets the dynamic ambient light color.
void setAmbientLight(const SColorf &color) override;
//! sets a viewport
void setViewPort(const core::rect<s32> &area) override;
//! Sets the fog mode.
virtual void setFog(SColor color, E_FOG_TYPE fogType, f32 start,
f32 end, f32 density, bool pixelFog, bool rangeFog) override;
//! Only used internally by the engine
void OnResize(const core::dimension2d<u32> &size) override;
//! Returns type of video driver
E_DRIVER_TYPE getDriverType() const override;
//! get color format of the current color buffer
ECOLOR_FORMAT getColorFormat() const override;
//! Returns the transformation set by setTransform
const core::matrix4 &getTransform(E_TRANSFORMATION_STATE state) const override;
//! Can be called by an IMaterialRenderer to make its work easier.
virtual void setBasicRenderStates(const SMaterial &material, const SMaterial &lastmaterial,
bool resetAllRenderstates) override;
//! Compare in SMaterial doesn't check texture parameters, so we should call this on each OnRender call.
virtual void setTextureRenderStates(const SMaterial &material, bool resetAllRenderstates);
//! Get a vertex shader constant index.
s32 getVertexShaderConstantID(const c8 *name) override;
//! Get a pixel shader constant index.
s32 getPixelShaderConstantID(const c8 *name) override;
//! Sets a constant for the vertex shader based on an index.
bool setVertexShaderConstant(s32 index, const f32 *floats, int count) override;
//! Int interface for the above.
bool setVertexShaderConstant(s32 index, const s32 *ints, int count) override;
//! Uint interface for the above.
bool setVertexShaderConstant(s32 index, const u32 *ints, int count) override;
//! Sets a constant for the pixel shader based on an index.
bool setPixelShaderConstant(s32 index, const f32 *floats, int count) override;
//! Int interface for the above.
bool setPixelShaderConstant(s32 index, const s32 *ints, int count) override;
//! Uint interface for the above.
bool setPixelShaderConstant(s32 index, const u32 *ints, int count) override;
//! Adds a new material renderer to the VideoDriver
virtual s32 addHighLevelShaderMaterial(const c8 *vertexShaderProgram, const c8 *vertexShaderEntryPointName,
E_VERTEX_SHADER_TYPE vsCompileTarget, const c8 *pixelShaderProgram, const c8 *pixelShaderEntryPointName,
E_PIXEL_SHADER_TYPE psCompileTarget, const c8 *geometryShaderProgram, const c8 *geometryShaderEntryPointName,
E_GEOMETRY_SHADER_TYPE gsCompileTarget, scene::E_PRIMITIVE_TYPE inType, scene::E_PRIMITIVE_TYPE outType,
u32 verticesOut, IShaderConstantSetCallBack *callback, E_MATERIAL_TYPE baseMaterial,
s32 userData) override;
//! Returns pointer to the IGPUProgrammingServices interface.
IGPUProgrammingServices *getGPUProgrammingServices() override;
//! Returns a pointer to the IVideoDriver interface.
IVideoDriver *getVideoDriver() override;
//! Returns the maximum amount of primitives
u32 getMaximalPrimitiveCount() const override;
virtual ITexture *addRenderTargetTexture(const core::dimension2d<u32> &size,
const io::path &name, const ECOLOR_FORMAT format = ECF_UNKNOWN) override;
//! Creates a render target texture for a cubemap
ITexture *addRenderTargetTextureCubemap(const irr::u32 sideLen,
const io::path &name, const ECOLOR_FORMAT format) override;
virtual bool setRenderTargetEx(IRenderTarget *target, u16 clearFlag, SColor clearColor = SColor(255, 0, 0, 0),
f32 clearDepth = 1.f, u8 clearStencil = 0) override;
void clearBuffers(u16 flag, SColor color = SColor(255, 0, 0, 0), f32 depth = 1.f, u8 stencil = 0) override;
//! Returns an image created from the last rendered frame.
IImage *createScreenShot(video::ECOLOR_FORMAT format = video::ECF_UNKNOWN, video::E_RENDER_TARGET target = video::ERT_FRAME_BUFFER) override;
//! checks if an OpenGL error has happened and prints it (+ some internal code which is usually the line number)
bool testGLError(int code = 0);
//! Returns the graphics card vendor name.
core::stringc getVendorInfo() override
{
return VendorName;
}
//! Get the maximal texture size for this driver
core::dimension2du getMaxTextureSize() const override;
void removeTexture(ITexture *texture) override;
//! Check if the driver supports creating textures with the given color format
bool queryTextureFormat(ECOLOR_FORMAT format) const override;
//! Used by some SceneNodes to check if a material should be rendered in the transparent render pass
bool needsTransparentRenderPass(const irr::video::SMaterial &material) const override;
//! Convert E_BLEND_FACTOR to OpenGL equivalent
GLenum getGLBlend(E_BLEND_FACTOR factor) const;
//! Get ZBuffer bits.
GLenum getZBufferBits() const;
bool getColorFormatParameters(ECOLOR_FORMAT format, GLint &internalFormat, GLenum &pixelFormat,
GLenum &pixelType, void (**converter)(const void *, s32, void *)) const;
COGLES1CacheHandler *getCacheHandler() const;
private:
//! inits the opengl-es driver
bool genericDriverInit(const core::dimension2d<u32> &screenSize, bool stencilBuffer);
ITexture *createDeviceDependentTexture(const io::path &name, IImage *image) override;
ITexture *createDeviceDependentTextureCubemap(const io::path &name, const std::vector<IImage*> &image) override;
//! creates a transposed matrix in supplied GLfloat array to pass to OGLES1
inline void getGLMatrix(GLfloat gl_matrix[16], const core::matrix4 &m);
inline void getGLTextureMatrix(GLfloat gl_matrix[16], const core::matrix4 &m);
//! Set GL pipeline to desired texture wrap modes of the material
void setWrapMode(const SMaterial &material);
//! Get OpenGL wrap enum from Irrlicht enum
GLint getTextureWrapMode(u8 clamp) const;
//! sets the needed renderstates
void setRenderStates3DMode();
//! sets the needed renderstates
void setRenderStates2DMode(bool alpha, bool texture, bool alphaChannel);
void createMaterialRenderers();
//! Assign a hardware light to the specified requested light, if any
//! free hardware lights exist.
//! \param[in] lightIndex: the index of the requesting light
void assignHardwareLight(u32 lightIndex);
//! Same as `CacheHandler->setViewport`, but also sets `ViewPort`
virtual void setViewPortRaw(u32 width, u32 height);
COGLES1CacheHandler *CacheHandler;
core::stringc Name;
core::matrix4 Matrices[ETS_COUNT];
core::array<u8> ColorBuffer;
//! enumeration for rendering modes such as 2d and 3d for minimizing the switching of renderStates.
enum E_RENDER_MODE
{
ERM_NONE = 0, // no render state has been set yet.
ERM_2D, // 2d drawing rendermode
ERM_3D // 3d rendering mode
};
E_RENDER_MODE CurrentRenderMode;
//! bool to make all renderstates reset if set to true.
bool ResetRenderStates;
bool Transformation3DChanged;
u8 AntiAlias;
SMaterial Material, LastMaterial;
core::stringc VendorName;
core::matrix4 TextureFlipMatrix;
//! Color buffer format
ECOLOR_FORMAT ColorFormat;
SIrrlichtCreationParameters Params;
IContextManager *ContextManager;
};
} // end namespace video
} // end namespace irr
#endif // _IRR_COMPILE_WITH_OGLES1_

View File

@ -1,89 +0,0 @@
// Copyright (C) 2008 Christian Stehno
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
// 2017 modified by Michael Zeilfelder (unifying extension handlers)
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
#include "COGLESExtensionHandler.h"
#ifdef _IRR_COMPILE_WITH_OGLES1_
#include "irrString.h"
#include "SMaterial.h"
#include "fast_atof.h"
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
#include <EGL/egl.h>
#else
#include <GLES/egl.h>
#endif
namespace irr
{
namespace video
{
COGLES1ExtensionHandler::COGLES1ExtensionHandler() :
COGLESCoreExtensionHandler(),
MaxLights(0), pGlBlendEquationOES(0), pGlBlendFuncSeparateOES(0),
pGlBindFramebufferOES(0), pGlDeleteFramebuffersOES(0),
pGlGenFramebuffersOES(0), pGlCheckFramebufferStatusOES(0),
pGlFramebufferTexture2DOES(0), pGlGenerateMipmapOES(0)
{
}
void COGLES1ExtensionHandler::initExtensions()
{
getGLVersion();
if (Version >= 100)
os::Printer::log("OpenGL ES driver version is 1.1.", ELL_INFORMATION);
else
os::Printer::log("OpenGL ES driver version is 1.0.", ELL_WARNING);
getGLExtensions();
GLint val = 0;
glGetIntegerv(GL_MAX_LIGHTS, &val);
MaxLights = static_cast<u8>(val);
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &val);
Feature.MaxTextureUnits = static_cast<u8>(val);
#ifdef GL_EXT_texture_filter_anisotropic
if (FeatureAvailable[IRR_GL_EXT_texture_filter_anisotropic]) {
glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &val);
MaxAnisotropy = static_cast<u8>(val);
}
#endif
#ifdef GL_MAX_ELEMENTS_INDICES
glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &val);
MaxIndices = val;
#endif
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &val);
MaxTextureSize = static_cast<u32>(val);
#ifdef GL_EXT_texture_lod_bias
if (FeatureAvailable[IRR_GL_EXT_texture_lod_bias])
glGetFloatv(GL_MAX_TEXTURE_LOD_BIAS_EXT, &MaxTextureLODBias);
#endif
glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, DimAliasedLine);
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, DimAliasedPoint);
Feature.MaxTextureUnits = core::min_(Feature.MaxTextureUnits, static_cast<u8>(MATERIAL_MAX_TEXTURES));
Feature.ColorAttachment = 1;
pGlBlendEquationOES = (PFNGLBLENDEQUATIONOESPROC)eglGetProcAddress("glBlendEquationOES");
pGlBlendFuncSeparateOES = (PFNGLBLENDFUNCSEPARATEOESPROC)eglGetProcAddress("glBlendFuncSeparateOES");
pGlBindFramebufferOES = (PFNGLBINDFRAMEBUFFEROESPROC)eglGetProcAddress("glBindFramebufferOES");
pGlDeleteFramebuffersOES = (PFNGLDELETEFRAMEBUFFERSOESPROC)eglGetProcAddress("glDeleteFramebuffersOES");
pGlGenFramebuffersOES = (PFNGLGENFRAMEBUFFERSOESPROC)eglGetProcAddress("glGenFramebuffersOES");
pGlCheckFramebufferStatusOES = (PFNGLCHECKFRAMEBUFFERSTATUSOESPROC)eglGetProcAddress("glCheckFramebufferStatusOES");
pGlFramebufferTexture2DOES = (PFNGLFRAMEBUFFERTEXTURE2DOESPROC)eglGetProcAddress("glFramebufferTexture2DOES");
pGlGenerateMipmapOES = (PFNGLGENERATEMIPMAPOESPROC)eglGetProcAddress("glGenerateMipmapOES");
}
} // end namespace video
} // end namespace irr
#endif // _IRR_COMPILE_WITH_OGLES2_

View File

@ -1,189 +0,0 @@
// Copyright (C) 2008 Christian Stehno
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
#pragma once
#ifdef _IRR_COMPILE_WITH_OGLES1_
#include "EDriverFeatures.h"
#include "irrTypes.h"
#include "os.h"
#include "COGLESCommon.h"
#include "COGLESCoreExtensionHandler.h"
namespace irr
{
namespace video
{
class COGLES1ExtensionHandler : public COGLESCoreExtensionHandler
{
public:
COGLES1ExtensionHandler();
void initExtensions();
bool queryFeature(video::E_VIDEO_DRIVER_FEATURE feature) const
{
switch (feature) {
case EVDF_RENDER_TO_TARGET:
case EVDF_HARDWARE_TL:
case EVDF_MULTITEXTURE:
case EVDF_BILINEAR_FILTER:
case EVDF_MIP_MAP:
case EVDF_TEXTURE_NSQUARE:
case EVDF_STENCIL_BUFFER:
case EVDF_ALPHA_TO_COVERAGE:
case EVDF_COLOR_MASK:
case EVDF_POLYGON_OFFSET:
case EVDF_TEXTURE_MATRIX:
return true;
case EVDF_TEXTURE_NPOT:
return FeatureAvailable[IRR_GL_APPLE_texture_2D_limited_npot] || FeatureAvailable[IRR_GL_OES_texture_npot];
case EVDF_MIP_MAP_AUTO_UPDATE:
return Version > 100;
case EVDF_BLEND_OPERATIONS:
return FeatureAvailable[IRR_GL_OES_blend_subtract];
case EVDF_BLEND_SEPARATE:
return FeatureAvailable[IRR_GL_OES_blend_func_separate];
case EVDF_FRAMEBUFFER_OBJECT:
return FeatureAvailable[IRR_GL_OES_framebuffer_object];
case EVDF_VERTEX_BUFFER_OBJECT:
return Version > 100;
default:
return true;
};
}
inline void irrGlActiveTexture(GLenum texture)
{
glActiveTexture(texture);
}
inline void irrGlCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border,
GLsizei imageSize, const void *data)
{
glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
}
inline void irrGlCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
GLenum format, GLsizei imageSize, const void *data)
{
glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
}
inline void irrGlUseProgram(GLuint prog)
{
}
inline void irrGlBindFramebuffer(GLenum target, GLuint framebuffer)
{
if (pGlBindFramebufferOES)
pGlBindFramebufferOES(target, framebuffer);
}
inline void irrGlDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
{
if (pGlDeleteFramebuffersOES)
pGlDeleteFramebuffersOES(n, framebuffers);
}
inline void irrGlGenFramebuffers(GLsizei n, GLuint *framebuffers)
{
if (pGlGenFramebuffersOES)
pGlGenFramebuffersOES(n, framebuffers);
}
inline GLenum irrGlCheckFramebufferStatus(GLenum target)
{
if (pGlCheckFramebufferStatusOES)
return pGlCheckFramebufferStatusOES(target);
else
return 0;
}
inline void irrGlFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
{
if (pGlFramebufferTexture2DOES)
pGlFramebufferTexture2DOES(target, attachment, textarget, texture, level);
}
inline void irrGlGenerateMipmap(GLenum target)
{
if (pGlGenerateMipmapOES)
pGlGenerateMipmapOES(target);
}
inline void irrGlActiveStencilFace(GLenum face)
{
}
inline void irrGlDrawBuffer(GLenum mode)
{
}
inline void irrGlDrawBuffers(GLsizei n, const GLenum *bufs)
{
}
inline void irrGlBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
{
if (pGlBlendFuncSeparateOES)
pGlBlendFuncSeparateOES(srcRGB, dstRGB, srcAlpha, dstAlpha);
}
inline void irrGlBlendEquation(GLenum mode)
{
if (pGlBlendEquationOES)
pGlBlendEquationOES(mode);
}
inline void irrGlEnableIndexed(GLenum target, GLuint index)
{
}
inline void irrGlDisableIndexed(GLenum target, GLuint index)
{
}
inline void irrGlColorMaskIndexed(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
{
}
inline void irrGlBlendFuncIndexed(GLuint buf, GLenum src, GLenum dst)
{
}
inline void irrGlBlendFuncSeparateIndexed(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
{
}
inline void irrGlBlendEquationIndexed(GLuint buf, GLenum mode)
{
}
inline void irrGlBlendEquationSeparateIndexed(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
{
}
protected:
u8 MaxLights;
PFNGLBLENDEQUATIONOESPROC pGlBlendEquationOES;
PFNGLBLENDFUNCSEPARATEOESPROC pGlBlendFuncSeparateOES;
PFNGLBINDFRAMEBUFFEROESPROC pGlBindFramebufferOES;
PFNGLDELETEFRAMEBUFFERSOESPROC pGlDeleteFramebuffersOES;
PFNGLGENFRAMEBUFFERSOESPROC pGlGenFramebuffersOES;
PFNGLCHECKFRAMEBUFFERSTATUSOESPROC pGlCheckFramebufferStatusOES;
PFNGLFRAMEBUFFERTEXTURE2DOESPROC pGlFramebufferTexture2DOES;
PFNGLGENERATEMIPMAPOESPROC pGlGenerateMipmapOES;
};
}
}
#endif

View File

@ -1,286 +0,0 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#pragma once
#ifdef _IRR_COMPILE_WITH_OGLES1_
#include "COGLESDriver.h"
#include "IMaterialRenderer.h"
namespace irr
{
namespace video
{
//! Base class for all internal OGLES1 material renderers
class COGLES1MaterialRenderer : public IMaterialRenderer
{
public:
//! Constructor
COGLES1MaterialRenderer(video::COGLES1Driver *driver) :
Driver(driver)
{
}
protected:
video::COGLES1Driver *Driver;
};
//! Solid material renderer
class COGLES1MaterialRenderer_SOLID : public COGLES1MaterialRenderer
{
public:
COGLES1MaterialRenderer_SOLID(video::COGLES1Driver *d) :
COGLES1MaterialRenderer(d) {}
virtual void OnSetMaterial(const SMaterial &material, const SMaterial &lastMaterial,
bool resetAllRenderstates, IMaterialRendererServices *services)
{
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (resetAllRenderstates || (material.MaterialType != lastMaterial.MaterialType)) {
// thanks to Murphy, the following line removed some
// bugs with several OGLES1 implementations.
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
}
};
//! Generic Texture Blend
class COGLES1MaterialRenderer_ONETEXTURE_BLEND : public COGLES1MaterialRenderer
{
public:
COGLES1MaterialRenderer_ONETEXTURE_BLEND(video::COGLES1Driver *d) :
COGLES1MaterialRenderer(d) {}
virtual void OnSetMaterial(const SMaterial &material, const SMaterial &lastMaterial,
bool resetAllRenderstates, IMaterialRendererServices *services)
{
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
// if (material.MaterialType != lastMaterial.MaterialType ||
// material.MaterialTypeParam != lastMaterial.MaterialTypeParam ||
// resetAllRenderstates)
{
E_BLEND_FACTOR srcRGBFact, dstRGBFact, srcAlphaFact, dstAlphaFact;
E_MODULATE_FUNC modulate;
u32 alphaSource;
unpack_textureBlendFuncSeparate(srcRGBFact, dstRGBFact, srcAlphaFact, dstAlphaFact, modulate, alphaSource, material.MaterialTypeParam);
Driver->getCacheHandler()->setBlend(true);
if (Driver->queryFeature(EVDF_BLEND_SEPARATE)) {
Driver->getCacheHandler()->setBlendFuncSeparate(Driver->getGLBlend(srcRGBFact), Driver->getGLBlend(dstRGBFact),
Driver->getGLBlend(srcAlphaFact), Driver->getGLBlend(dstAlphaFact));
} else {
Driver->getCacheHandler()->setBlendFunc(Driver->getGLBlend(srcRGBFact), Driver->getGLBlend(dstRGBFact));
}
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS);
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE, (f32)modulate);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.f);
if (textureBlendFunc_hasAlpha(srcRGBFact) || textureBlendFunc_hasAlpha(dstRGBFact) ||
textureBlendFunc_hasAlpha(srcAlphaFact) || textureBlendFunc_hasAlpha(dstAlphaFact)) {
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PRIMARY_COLOR);
}
}
}
virtual void OnUnsetMaterial()
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE, 1.f);
glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS);
Driver->getCacheHandler()->setBlend(false);
glDisable(GL_ALPHA_TEST);
}
//! Returns if the material is transparent.
/** Is not always transparent, but mostly. */
virtual bool isTransparent() const
{
return true;
}
private:
u32 getGLBlend(E_BLEND_FACTOR factor) const
{
u32 r = 0;
switch (factor) {
case EBF_ZERO:
r = GL_ZERO;
break;
case EBF_ONE:
r = GL_ONE;
break;
case EBF_DST_COLOR:
r = GL_DST_COLOR;
break;
case EBF_ONE_MINUS_DST_COLOR:
r = GL_ONE_MINUS_DST_COLOR;
break;
case EBF_SRC_COLOR:
r = GL_SRC_COLOR;
break;
case EBF_ONE_MINUS_SRC_COLOR:
r = GL_ONE_MINUS_SRC_COLOR;
break;
case EBF_SRC_ALPHA:
r = GL_SRC_ALPHA;
break;
case EBF_ONE_MINUS_SRC_ALPHA:
r = GL_ONE_MINUS_SRC_ALPHA;
break;
case EBF_DST_ALPHA:
r = GL_DST_ALPHA;
break;
case EBF_ONE_MINUS_DST_ALPHA:
r = GL_ONE_MINUS_DST_ALPHA;
break;
case EBF_SRC_ALPHA_SATURATE:
r = GL_SRC_ALPHA_SATURATE;
break;
}
return r;
}
};
//! Transparent vertex alpha material renderer
class COGLES1MaterialRenderer_TRANSPARENT_VERTEX_ALPHA : public COGLES1MaterialRenderer
{
public:
COGLES1MaterialRenderer_TRANSPARENT_VERTEX_ALPHA(video::COGLES1Driver *d) :
COGLES1MaterialRenderer(d) {}
virtual void OnSetMaterial(const SMaterial &material, const SMaterial &lastMaterial,
bool resetAllRenderstates, IMaterialRendererServices *services)
{
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
Driver->getCacheHandler()->setBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
Driver->getCacheHandler()->setBlend(true);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) {
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PRIMARY_COLOR);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PRIMARY_COLOR);
glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_TEXTURE);
}
}
virtual void OnUnsetMaterial()
{
// default values
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_PREVIOUS);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS);
Driver->getCacheHandler()->setBlend(false);
}
//! Returns if the material is transparent.
virtual bool isTransparent() const
{
return true;
}
};
//! Transparent alpha channel material renderer
class COGLES1MaterialRenderer_TRANSPARENT_ALPHA_CHANNEL : public COGLES1MaterialRenderer
{
public:
COGLES1MaterialRenderer_TRANSPARENT_ALPHA_CHANNEL(video::COGLES1Driver *d) :
COGLES1MaterialRenderer(d) {}
virtual void OnSetMaterial(const SMaterial &material, const SMaterial &lastMaterial,
bool resetAllRenderstates, IMaterialRendererServices *services)
{
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
Driver->getCacheHandler()->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Driver->getCacheHandler()->setBlend(true);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates || material.MaterialTypeParam != lastMaterial.MaterialTypeParam) {
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, material.MaterialTypeParam);
}
}
virtual void OnUnsetMaterial()
{
glDisable(GL_ALPHA_TEST);
Driver->getCacheHandler()->setBlend(false);
}
//! Returns if the material is transparent.
virtual bool isTransparent() const
{
return true;
}
};
//! Transparent alpha channel material renderer
class COGLES1MaterialRenderer_TRANSPARENT_ALPHA_CHANNEL_REF : public COGLES1MaterialRenderer
{
public:
COGLES1MaterialRenderer_TRANSPARENT_ALPHA_CHANNEL_REF(video::COGLES1Driver *d) :
COGLES1MaterialRenderer(d) {}
virtual void OnSetMaterial(const SMaterial &material, const SMaterial &lastMaterial,
bool resetAllRenderstates, IMaterialRendererServices *services)
{
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) {
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.5f);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
}
virtual void OnUnsetMaterial()
{
glDisable(GL_ALPHA_TEST);
}
//! Returns if the material is transparent.
virtual bool isTransparent() const
{
return false; // this material is not really transparent because it does no blending.
}
};
} // end namespace video
} // end namespace irr
#endif

View File

@ -84,12 +84,12 @@ class COpenGLCoreCacheHandler
if (curTextureType != prevTextureType) {
GL.BindTexture(prevTextureType, 0);
#if (defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON))
#if defined(IRR_COMPILE_GL_COMMON)
GL.Disable(prevTextureType);
GL.Enable(curTextureType);
#endif
}
#if (defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON))
#if defined(IRR_COMPILE_GL_COMMON)
else if (!prevTexture)
GL.Enable(curTextureType);
#endif
@ -109,7 +109,7 @@ class COpenGLCoreCacheHandler
GL.BindTexture(prevTextureType, 0);
#if (defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON))
#if defined(IRR_COMPILE_GL_COMMON)
GL.Disable(prevTextureType);
#endif
}
@ -222,7 +222,7 @@ public:
Driver->irrGlActiveTexture(ActiveTexture);
#if (defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON))
#if defined(IRR_COMPILE_GL_COMMON)
GL.Disable(GL_TEXTURE_2D);
#endif

View File

@ -296,8 +296,7 @@ public:
delete[] tmpBuffer;
}
#elif (defined(IRR_COMPILE_GLES2_COMMON) || defined(IRR_COMPILE_GLES_COMMON))
// TODO: on ES2 we can likely also work with glCopyTexImage2D instead of rendering which should be faster.
#elif defined(IRR_COMPILE_GLES2_COMMON)
COpenGLCoreTexture *tmpTexture = new COpenGLCoreTexture("OGL_CORE_LOCK_TEXTURE", Size, ETT_2D, ColorFormat, Driver);
GLuint tmpFBO = 0;

View File

@ -100,10 +100,6 @@ extern "C" IRRLICHT_API bool IRRCALLCONV isDriverSupported(E_DRIVER_TYPE driver)
case EDT_OPENGL:
return true;
#endif
#ifdef _IRR_COMPILE_WITH_OGLES1_
case EDT_OGLES1:
return true;
#endif
#ifdef _IRR_COMPILE_WITH_OGLES2_
case EDT_OGLES2:
return true;

View File

@ -418,7 +418,6 @@ std::vector<video::E_DRIVER_TYPE> RenderingEngine::getSupportedVideoDrivers()
video::EDT_OPENGL,
video::EDT_OPENGL3,
video::EDT_OGLES2,
video::EDT_OGLES1,
video::EDT_NULL,
};
std::vector<video::E_DRIVER_TYPE> drivers;
@ -454,7 +453,6 @@ const VideoDriverInfo &RenderingEngine::getVideoDriverInfo(irr::video::E_DRIVER_
{(int)video::EDT_NULL, {"null", "NULL Driver"}},
{(int)video::EDT_OPENGL, {"opengl", "OpenGL"}},
{(int)video::EDT_OPENGL3, {"opengl3", "OpenGL 3+"}},
{(int)video::EDT_OGLES1, {"ogles1", "OpenGL ES1"}},
{(int)video::EDT_OGLES2, {"ogles2", "OpenGL ES2"}},
};
return driver_info_map.at((int)type);