I need help with stage3d

Greetings. I’m studing haxe and openfl. I have some problem with stage3d.How can i make shader for context3d?
for example,
_shaderProgram = _context3D.createProgram();
_shaderProgram.upload(s1, s2); where s1 and s2 - vertex and fragment shaders.
AGAL code is working fine when comiling on flash, but i need to use cpp compiler in my project
I’ve tried to find some information about creating shaders using hxsl, but all examples i found dont work.
Is there some step-by-step tutorial for creating shaders?

I believe the Stage3D compatibility layer expects AGAL shaders, which are then converted to GLSL automatically

testShader.upload(s1,s2);
when compiling on flash s1 and s2 must be ByteArray
when compiling on cpp s1 and s2 must be openfl.gl.GLShader
i don’t know how to create GLShader using agal code

Poking around, see if openfl.display3d._shaders.AGLSLShaderUtils helps, it has a compile and a createShader method, this might be AGAL -> GLSL conversion I was thinking of

hmmm. i have no ‘openfl.display3d._shaders’ package i’ll check my openfl version now. What version of openFl are you using?

Underscore directories are hidden from code completion, so you’ll have to work blind a little. Try taking a look in C:\HaxeToolkit\haxe\lib\openfl, or where you have OpenFL installed

compiling in flash - all works fine
compiling in cpp - nothing :slight_smile:

hah, i see i have another problem. change color of background to _context3d.clear(0,0,0) . on flash compiler it have black background, cpp compiler have white.