List of pixel formats for render target in GeeXLab

Started by coolkid87, December 04, 2016, 11:28:25 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

coolkid87

Hello, this is my first post in this forum. I started using GeeXLab a few days back and I've a question.
Where can I get all the format codes for pixel formats accepted by gh_render_target.create_ex()? Some pixel formats are listed in scripting API reference, but if I want to use some pixel formats other than the listed ones e.g. RG16UI what code I put in? Are all the pixel formats listed in OpenGL docs supported?
Have a nice day. :)

JeGX

Currently, all pixel formats supported for the render targets are:


PF_U8_RGB = 1
PF_U8_BGR = 2
PF_U8_RGBA = 3
PF_U8_BGRA = 4

PF_F32_RGB = 5
PF_F32_RGBA = 6

PF_F32_R = 7

PF_F16_RGB = 8
PF_F16_RGBA = 9
PF_F16_R = 10


Let me know what pixel formats you need (like RG16UI) and I will try to update GeeXLab (Windows version) asap.




JeGX

I updated the GeeXLab core DLLs with new pixels formats for the render targets:

PF_UI32_R = 13
PF_UI32_RG = 14
PF_UI32_RGBA = 15
PF_I32_R = 16
PF_I32_RG = 17
PF_I32_RGBA = 18
PF_UI16_R = 19
PF_UI16_RG = 20
PF_UI16_RGBA = 21
PF_I16_R = 22
PF_I16_RG = 23
PF_I16_RGBA = 24
PF_UI8_R = 25
PF_UI8_RG = 26
PF_UI8_RGBA = 27
PF_I8_R = 28
PF_I8_RG = 29
PF_I8_RGBA = 30


You can downloads the DLLs from this link: http://www.geeks3d.com/dl/show/1000

Just copy these DLLs in GeeXLab folder. These DLLs work with GeeXLab 0.13.0 for Windows.

I didn't test these new PFs so let me know.

coolkid87

#3
Hello JeGx, thanks for the reply and I appreciate the effort you've put to incorporate the format into the tool right away :) . I'm currently storing pixel index in texture, that's why I needed 16bit format support since the texture can be as big as 2kx2k. But unfortunately I'm working with a GNU/Linux build of GeeXLab. In general I'm having trouble to access a texture bound with a render target created with gh_render_target.create_ex()(1 sample and no linear filtering) but they're working fine with gh_render_target.create().
I'm using the code such as below

-- init --
local PF_U8_RGBA = 3;
render_tex_tgt = gh_render_target.create_ex(winW, winH, PF_U8_RGBA, 0, 1)
render_tex_color = gh_texture.create_2d(winW, winH)
-- frame --
gh_render_target.bind(render_tex_tgt)
local col_tex_unit = 0
gh_texture.bind(render_tex_color, col_tex_unit)
gh_texture.activate_rt_color(render_tex_tgt, col_tex_unit)


I'm yet to find a way to use the gh_texture.activate_rt_color() method with MRT render target created with gh_render_target.create_v2(). So it's possible that I'm using the methods in wrong way altogether.

In a few days I'll have access to a Windows PC, I'll let you know about the results I've got after testing it on that platform.
Cheers.

JeGX

Quote from: coolkid87 on December 05, 2016, 05:17:34 PM
But unfortunately I'm working with a GNU/Linux build of GeeXLab.

I will try to compile the DLLs for Linux asap.


If you only need to store data in the render target, no need to bind the render target texture. The shader will automatically write on the render target texture. You have to bind the render target texture later when you will read it in a shader:


-- init --
local PF_U8_RGBA = 3;
render_tex_tgt = gh_render_target.create_ex(winW, winH, PF_U8_RGBA, 0, 1)


-- frame --
-- Render some stuff in the render target
--
gh_render_target.bind(render_tex_tgt)
gh_gpu_program.bind(rt_gpu_prog)
draw_quad()
gh_render_target.unbind(render_tex_tgt)


-- Now read from the render target texture
--
gh_gpu_program.bind(gpu_prog2)
local col_tex_unit = 0
gh_texture.activate_rt_color(render_tex_tgt, col_tex_unit)
draw_quad()


The reference guide is not up to date. There is another function that binds a particular render target texture when you create a render target with several color targets.