Aily Posted January 5, 2012 Share Posted January 5, 2012 Hi Josh. Here have strange things. That's code to render to simple 2D texture, it works great Framework leadwerks.engine registerabstractpath AppDir Graphics 800,600 createworld cp=createpivot() cam=createcamera() cameraclearcolor cam,vec4(.5,.5,.5,1) entityparent cam,cp moveentity cam,vec3(0,1,-1) pointentity cam,cp c=createsphere() mat=creatematerial() setmaterialshader mat,loadshader("abstract::mesh.vert","abstract::mesh_diffuse.frag") tex=createtexture(256,256) setmaterialtexture mat,tex,0 paintentity c,mat tex_buffer=createbuffer(256,256,BUFFER_COLOR) setcolorbuffer tex_buffer,tex,0 setbuffer tex_buffer SetColor vec3(0) DrawRect 0,0,256,256 SetColor vec3(1) DrawRect 50,50,100,100 Repeat If KeyHit(key_escape) Or AppTerminate() End turnentity cp,vec3(0,.2,0) setbuffer backbuffer() renderworld Flip 1 Forever Here's the code to load cubemap from file, and just to check that mesh_cubemap.frag works: Framework leadwerks.engine registerabstractpath AppDir Graphics 800,600 createworld cp=createpivot() cam=createcamera() cameraclearcolor cam,vec4(.5,.5,.5,1) entityparent cam,cp moveentity cam,vec3(0,1,-1) pointentity cam,cp c=createsphere() mat=creatematerial() setmaterialshader mat,loadshader("abstract::mesh_cubemap.vert","abstract::mesh_cubemap.frag") tex=loadtexture("abstract::sunol_cubemap.dds") setmaterialtexture mat,tex,0 paintentity c,mat Repeat If KeyHit(key_escape) Or AppTerminate() End turnentity cp,vec3(0,.2,0) setbuffer backbuffer() renderworld Flip 1 Forever And this is code like above, but drawing to cubemap: Framework leadwerks.engine registerabstractpath AppDir Graphics 800,600 createworld cp=createpivot() cam=createcamera() cameraclearcolor cam,vec4(.5,.5,.5,1) entityparent cam,cp moveentity cam,vec3(0,1,-1) pointentity cam,cp c=createsphere() mat=creatematerial() setmaterialshader mat,loadshader("abstract::mesh_cubemap.vert","abstract::mesh_cubemap.frag") tex=createcubemap(256,256) setmaterialtexture mat,tex,0 paintentity c,mat tex_buffer_0=createbuffer(256,256,BUFFER_COLOR) tex_buffer_1=createbuffer(256,256,BUFFER_COLOR) tex_buffer_2=createbuffer(256,256,BUFFER_COLOR) tex_buffer_3=createbuffer(256,256,BUFFER_COLOR) tex_buffer_4=createbuffer(256,256,BUFFER_COLOR) tex_buffer_5=createbuffer(256,256,BUFFER_COLOR) setcolorbuffer tex_buffer_0,tex,0,0 setcolorbuffer tex_buffer_1,tex,0,1 setcolorbuffer tex_buffer_2,tex,0,2 setcolorbuffer tex_buffer_3,tex,0,3 setcolorbuffer tex_buffer_4,tex,0,4 setcolorbuffer tex_buffer_5,tex,0,5 setbuffer tex_buffer_0 SetColor vec3(0) DrawRect 0,0,256,256 SetColor vec3(1) DrawRect 50,50,100,100 setbuffer tex_buffer_1 SetColor vec3(0) DrawRect 0,0,256,256 SetColor vec3(1) DrawRect 50,50,100,100 setbuffer tex_buffer_2 SetColor vec3(0) DrawRect 0,0,256,256 SetColor vec3(1) DrawRect 50,50,100,100 setbuffer tex_buffer_3 SetColor vec3(0) DrawRect 0,0,256,256 SetColor vec3(1) DrawRect 50,50,100,100 setbuffer tex_buffer_4 SetColor vec3(0) DrawRect 0,0,256,256 SetColor vec3(1) DrawRect 50,50,100,100 setbuffer tex_buffer_5 SetColor vec3(0) DrawRect 0,0,256,256 SetColor vec3(1) DrawRect 50,50,100,100 Repeat If KeyHit(key_escape) Or AppTerminate() End turnentity cp,vec3(0,.2,0) setbuffer backbuffer() renderworld Flip 1 Forever As you can see - i'm using same technique as draw to 2D texture - assign it to buffer, But with cubemaps im assigning cubefaces to 6 buffers. Think this code must be work, but it didnt Maybe you can show the correct way to use render to cubemaps? Thanks. Quote "Better" is big enemy of "good" Link to comment Share on other sites More sharing options...
Josh Posted January 5, 2012 Share Posted January 5, 2012 I'm on my Mac right now and don't have an easy way of checking your texture, but if it doesn't have mipmaps, NVidia cards will render it pure black. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Aily Posted January 5, 2012 Author Share Posted January 5, 2012 I'm on my Mac right now and don't have an easy way of checking your texture, but if it doesn't have mipmaps, NVidia cards will render it pure black. Thanks for turbo reply Even if i use? textureCubeLod(LW_CUBEMAP,cubecoord,0) So then any way to build mipmaps after buffer render? (let it be so, let it be so....... ) Quote "Better" is big enemy of "good" Link to comment Share on other sites More sharing options...
macklebee Posted January 5, 2012 Share Posted January 5, 2012 Aily... i believe klepto did it and posted it in his blog... but he did it without using the LE inherent commands but rather raw opengl... http://www.leadwerks.com/werkspace/blog/16/entry-654-cubemaps-realtime-here-we-go/ which to me indicates there is something wrong with LE's implementation... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Aily Posted January 5, 2012 Author Share Posted January 5, 2012 Aily... i believe klepto did it and posted it in his blog... but he did it without using the LE inherent commands but rather raw opengl... http://www.leadwerks.com/werkspace/blog/16/entry-654-cubemaps-realtime-here-we-go/ which to me indicates there is something wrong with LE's implementation... Yeah, i saw thais, but im making this by LUA, and such method is impossible there, you know it yourself That's why ask Josh to fix this. Quote "Better" is big enemy of "good" Link to comment Share on other sites More sharing options...
macklebee Posted January 5, 2012 Share Posted January 5, 2012 oh yes... i know... and josh has been requested to look at this many times before... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.