Added GLES2 support

This commit is contained in:
n00b
2024-11-10 19:05:55 -05:00
parent f7b6e8e609
commit bffa478064
5 changed files with 386 additions and 268 deletions

View File

@@ -4448,7 +4448,12 @@ int main(int argc, char * argv[])
#ifdef RC_WEB
rc_filename = "main.cbc";
#endif
#endif
//ogles2 test
rc_intern_dirChange("/home/n00b/projects/rcbasic_alpha3/test_project");
rc_filename = "main.cbc";
//---------------
if(rcbasic_load(rc_filename))
{

View File

@@ -269,7 +269,11 @@ bool rc_windowOpenEx(std::string title, int x, int y, int w, int h, uint32_t win
SIrrlichtCreationParameters irr_creation_params;
irr_creation_params.DeviceType = EIDT_SDL;
#if defined(RC_DRIVER_GLES2)
irr_creation_params.DriverType = video::EDT_OGLES2;
#else
irr_creation_params.DriverType = video::EDT_OPENGL;
#endif // defined
irr_creation_params.WindowId = rc_window;
irr_creation_params.WindowSize = dimension2d<u32>((u32)w, (u32)h);
irr_creation_params.Bits = 16;
@@ -279,6 +283,7 @@ bool rc_windowOpenEx(std::string title, int x, int y, int w, int h, uint32_t win
irr_creation_params.EventReceiver = 0;
irr_creation_params.WindowPosition = position2d<s32>(x, y);
irr_creation_params.AntiAlias = AntiAlias;
irr_creation_params.OGLES2ShaderPath = "media/Shaders/";
device = createDeviceEx(irr_creation_params);
@@ -299,12 +304,16 @@ bool rc_windowOpenEx(std::string title, int x, int y, int w, int h, uint32_t win
rc_font.clear();
rc_canvas_obj back_buffer;
//std::cout << std::endl << "back start" << std::endl;
back_buffer.texture = VideoDriver->addRenderTargetTexture(irr::core::dimension2d<irr::u32>((irr::u32)w, (irr::u32)h), "rt", ECF_A8R8G8B8);
//std::cout << "back_buffer done" << std::endl << std::endl;
back_buffer.dimension.Width = w;
back_buffer.dimension.Height = h;
back_buffer.viewport.position.set(0,0);
back_buffer.viewport.dimension.set(w,h);
//std::cout << std::endl << "tgt start" << std::endl;
VideoDriver->setRenderTarget(back_buffer.texture, true, true);
//std::cout << "tgt done" << std::endl << std::endl;
rc_canvas.push_back(back_buffer);
rc_physics3D.world = createIrrBulletWorld(device, true, false);
@@ -3477,7 +3486,13 @@ bool rc_update()
drawSprites(canvas_id);
}
#if defined(RC_DRIVER_GLES2)
irr::core::vector2d<irr::s32> c_pos( dest.UpperLeftCorner.X, dest.UpperLeftCorner.Y + dest.getHeight() );
irr::core::position2d<irr::s32> rot_point(src.getWidth()/2, src.getHeight()/2);
draw2DImage(VideoDriver, rc_canvas[canvas_id].texture, src, c_pos, rot_point, 0, irr::core::vector2df(1, -1), true, color, screenSize);
#else
draw2DImage2(VideoDriver, rc_canvas[canvas_id].texture, src, dest, irr::core::position2d<irr::s32>(0, 0), 0, true, color, screenSize);
#endif // defined
//drawSprites(canvas_id);
//draw2DImage2(VideoDriver, rc_canvas[canvas_id].sprite_layer, src, dest, irr::core::vector2d<irr::s32>(0, 0), 0, true, color, screenSize);
@@ -3493,6 +3508,12 @@ bool rc_update()
VideoDriver->setRenderTarget(0);
//VideoDriver->beginScene(true, true);
VideoDriver->draw2DImage(rc_canvas[0].texture, irr::core::vector2d<irr::s32>(0,0));
//debug
//VideoDriver->draw2DImage(rc_image[0].image, irr::core::rect<irr::s32>(0,0,100,100), irr::core::rect<irr::s32>(0,0,100,100));
//VideoDriver->draw2DRectangle(irr::video::SColor(255,2555,0,0), irr::core::rect<irr::s32>(0,0,100,100));
//end debug
//device->getGUIEnvironment()->drawAll();
VideoDriver->endScene();

View File

@@ -10,16 +10,21 @@
#ifdef RC_WEB
#define RC_LINUX
#define RC_DRIVER_GLES2
#endif
#ifdef RC_ANDROID
#define RC_MOBILE
#define RC_DRIVER_GLES2
#endif
#ifdef RC_IOS
#define RC_MOBILE
#endif
//FOR DEBUG PURPOSES
#define RC_DRIVER_GLES2
#define RC_PI 3.14159265359
inline double rc_util_radians(double degrees)

File diff suppressed because it is too large Load Diff

View File

@@ -2,54 +2,19 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<File name="camera.h" open="1" top="0" tabpos="22" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="gui_freetype_font.h" open="0" top="0" tabpos="23" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
<Cursor1 position="183" topLine="0" />
</Cursor>
</File>
<File name="rc_net.h" open="1" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_matrix.h" open="0" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1339" topLine="12" />
<Cursor1 position="116" topLine="0" />
</Cursor>
</File>
<File name="rc_stdlib.h" open="1" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_camera.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="20548" topLine="882" />
</Cursor>
</File>
<File name="rc_defines.h" open="1" top="0" tabpos="16" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="113947" topLine="1753" />
</Cursor>
</File>
<File name="main.cpp" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="396" topLine="8" />
</Cursor>
</File>
<File name="gui_freetype_font.cpp" open="1" top="0" tabpos="24" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4946" topLine="0" />
</Cursor>
</File>
<File name="rc_video.h" open="1" top="0" tabpos="21" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="rc_audio.h" open="1" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6531" topLine="311" />
</Cursor>
</File>
<File name="rc_media.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="17752" topLine="630" />
</Cursor>
</File>
<File name="rc_gfx.h" open="1" top="1" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="91126" topLine="3193" />
<Cursor1 position="4302" topLine="183" />
</Cursor>
</File>
<File name="../../irrBullet/src/irrBulletWorld.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@@ -57,34 +22,64 @@
<Cursor1 position="2750" topLine="75" />
</Cursor>
</File>
<File name="rc_gfx_core.h" open="1" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_geometry.h" open="0" top="0" tabpos="20" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="80" topLine="0" />
</Cursor>
</File>
<File name="rc_geometry.h" open="1" top="0" tabpos="20" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="20919" topLine="653" />
</Cursor>
</File>
<File name="rc_matrix.h" open="1" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="16042" topLine="586" />
</Cursor>
</File>
<File name="gui_freetype_font.h" open="1" top="0" tabpos="23" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="183" topLine="0" />
<Cursor1 position="20919" topLine="652" />
</Cursor>
</File>
<File name="rc_func130_cases.h" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="52186" topLine="1376" />
<Cursor1 position="14136" topLine="420" />
</Cursor>
</File>
<File name="rc_os_defines.h" open="1" top="0" tabpos="19" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_net.h" open="0" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="67" topLine="0" />
<Cursor1 position="1339" topLine="12" />
</Cursor>
</File>
<File name="rc_video.h" open="0" top="0" tabpos="21" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="rc_audio.h" open="0" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6531" topLine="311" />
</Cursor>
</File>
<File name="rc_gfx.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="49" topLine="0" />
</Cursor>
</File>
<File name="rc_defines.h" open="0" top="0" tabpos="16" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="113947" topLine="2998" />
</Cursor>
</File>
<File name="../../irrBullet/src/irrBulletcommon.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="924" topLine="6" />
</Cursor>
</File>
<File name="rc_actor_physics.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="16377" topLine="669" />
</Cursor>
</File>
<File name="rc_spritelib.h" open="1" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="19022" topLine="794" />
</Cursor>
</File>
<File name="main.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="773" topLine="18" />
</Cursor>
</File>
<File name="gui_freetype_font.cpp" open="0" top="0" tabpos="24" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4946" topLine="0" />
</Cursor>
</File>
<File name="../../irrBullet/src/irrBullet.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@@ -92,19 +87,69 @@
<Cursor1 position="0" topLine="7" />
</Cursor>
</File>
<File name="rc_test.h" open="1" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_gfx_core.h" open="1" top="1" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="30340" topLine="874" />
</Cursor>
</File>
<File name="rc_joints.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="24058" topLine="423" />
</Cursor>
</File>
<File name="rc_tilemap.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="243" topLine="0" />
</Cursor>
</File>
<File name="camera.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="261" topLine="0" />
</Cursor>
</File>
<File name="rc_gfx_android.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="74774" topLine="2729" />
</Cursor>
</File>
<File name="rc_gfx_desktop.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="9519" topLine="308" />
</Cursor>
</File>
<File name="rc_sprite2D.h" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1444" topLine="0" />
</Cursor>
</File>
<File name="rc_test.h" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="115" topLine="0" />
</Cursor>
</File>
<File name="rc_gfx3D.h" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_gfx3D.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="74" topLine="0" />
<Cursor1 position="583" topLine="10" />
</Cursor>
</File>
<File name="rc_sprite2D.h" open="1" top="0" tabpos="17" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_stdlib.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="501" topLine="0" />
<Cursor1 position="24553" topLine="1081" />
</Cursor>
</File>
<File name="rc_constraint.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="36605" topLine="1010" />
</Cursor>
</File>
<File name="rc_os_defines.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="208" topLine="0" />
</Cursor>
</File>
<File name="rc_media.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="17752" topLine="630" />
</Cursor>
</File>
</CodeBlocks_layout_file>