Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Shader question

Registered User
2022-09-26 19:19:06

I am playing around with CC and shaders and have some questions..

With DirectX i can mix textures in shader..(example)
//3 textures pass to the shader..
sampler2D tx0;
sampler2D tx1;
sampler2D tx2;
//Mix them (just for testing no real use for it)
float4 col1 = tex2D( tx0, TexCoord );
float4 col2 = tex2D( tx1, TexCoord );
float4 col3 = tex2D( tx2, TexCoord );
Output.RGBColor = (col1+col2+col3) - pulse ;
//works as "expected"..

//problem here..
with OpenGL:
//2 textures
uniform sampler2D tx0;
uniform sampler2D tx1;

vec4 col1 = texture2D(tx0 vec2(gl_TexCoord[0]));
vec4 col2 = texture2D(tx1, vec2(gl_TexCoord[0]));

gl_FragColor = col1+col2;

//Has no effect..

I prefer to use opengl for shaders thats y i ask -what am i doing wrong here.

I use same scenenode with 3 textures that i have added with irrEdit options with DX version i see that textures are used and mixed.. with GL i see only one texture and no mix with second one (no effect at all -no errors).

2022-09-26 22:42:41

Hi @Sven,

unfortunatly I've also failed accessing more than one texture with OpenGL shader programming so far. When I asked Niko for support about it his reply sad that CopperCube would probably not be ready for this at the moment (I guess because of CC's outdated OpenGL version support requiring OpenGL commands outside CopperCube's javascript and vertex/pixel shader coding scope to load different textures?).

I still wish we could also have those cool texture shader stuff with OpenGL the DirectX shader programming has to offer - like just_in_case demonstrated in an amazing way with his works in this field- simply because OpenGL gives me more performance, more stability and overall less graphical issues with my CC projects.

Maybe someone can find a way some day ...

2022-09-28 19:37:30

Unfortunately I don't know much about openGL shaders, but I think it is possible to use multiple textures in openGL shaders as well, As the inbuilt materials like Normal Maps do work in openGL and they need 2 Textures in order to work.

However in GLSL for webGL you can use multiple textures, I already have blend two textures together shader on my website that works for the webGL as well as windows DirectX, you can check that out if openGL GLSL uses the same syntax and all.

Registered User
2022-09-29 10:23:00

WebGL is different.
I have some ancient opengl shaders that i made years ago for my freebasic project thats why i was hoping i can reuse them but i will try to learn dx shaders and convert them to work with dx.

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "In?ernational" (you are not logged in)




Possible Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]



Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact