PDA

View Full Version : Gen Texture alternative?



Andy Gilbert
04-23-2010, 05:08 AM
Hi, im trying to learn shadows and im trying my hand at shadow mapping. Now i know this is not ideal but im not using C++ im using lua and unfortunatly the current lua library im using doesnt support Gentextures. So therfore i cant gen a texture to write depth buffer data to.

Is there a way i can store the depth buffer data somwhere else to use? Such as an array or a buffer? I can genbuffers?

Thanks
Andy

Fugitive
04-23-2010, 05:47 AM
All glGenTextures does is give you a set of unique numbers (names) for your textures so you dont use the same name for several textures by mistake.

As long as your numbering is unique, you can generate your own numbers.

Andy Gilbert
04-23-2010, 05:30 PM
Hi Ok, sorry i dont seem (at the moment) to be able to save the depth buffer to a texture?

is there anywhere else i can store and access the depth buffer data as you would when storing it to a texture?

Thanks
Andy

kowal
04-23-2010, 05:44 PM
I have never used Lua, but (like in every other language) it should be possible to call C functions from it.
You can write simple 'wrapper' library in C (which contains calls to whatever You need).

Alfonse Reinheart
04-23-2010, 06:11 PM
Now i know this is not ideal but im not using C++ im using lua and unfortunatly the current lua library im using doesnt support Gentextures. So therfore i cant gen a texture to write depth buffer data to.

Um, if your Lua library doesn't expose something as simple as glGenTextures, you need to find a better Lua OpenGL library.

Andy Gilbert
04-24-2010, 03:17 AM
Well it uses the popular luaGl, but aparently there is a known problem with glTexSubImage in LuaGL.

IS there no way of writing the data else where then? to a buffer or anything?

Can i use glTexImage?

Thanks
Andy

Alfonse Reinheart
04-24-2010, 03:38 AM
it uses the popular luaGl

Popular? LuaGL hasn't been updated since 2004. I'd hate to see what counts as "unpopular" ;)

Andy Gilbert
04-24-2010, 03:48 AM
ok, without sounding arsey, but im not upto scratch in C++ so im learning openGL using lua, so.... do you have an answer to my reasnoble question or are you just going try and mock everything i say?

Oh and just to add, it uses luaGL but has expanded this to cover most of the OpenGL specification through 2.0.

If you know... please explain an answer.

Thanks

Andy

Alfonse Reinheart
04-24-2010, 06:05 PM
ok, without sounding arsey, but im not upto scratch in C++ so im learning openGL using lua, so.... do you have an answer to my reasnoble question or are you just going try and mock everything i say?

I'm not mocking what you're saying. I'm pointing out that you're using an old, antiquated tool. It is clearly missing vital functionality, like glGenTextures and apparently glTexSubImage.

This is simply not a good tool to use for OpenGL development. It would be great if it was, but it simply is not.

Fugitive
04-25-2010, 07:10 AM
Why is it that you cannot save your depth-map to a texture? Does it give an error? What error? Are you able to read depth values at all? Are you using shaders?

If you let us know a bit about what you are trying to do, perhaps we could help better.

Kind regards,
Fugi

Andy Gilbert
04-25-2010, 11:26 AM
Ok, im trying to do shadows, dont want to do planar shadows, so i thought ide have a go at shadow mapping or stencil shadow volumes. Both i belive neeed to save the depth buffer data to a texture?

Anyway, i have been trying to do shadow mapping method, which as im sure you know, requires one pass to read the depth buffer to a texture? I apparently cannot do that, it would work so i enquired about why and got told it unfortunatly isnt working but he hopes to get it working. So...as i have done quite alot of work so far using lua and openGL i dont want to move away from it quite yet, so i wondered if there is another way of read the depth buffer to somwhere and as apposed to a texture in memory?

This is currently all being done in the standard pipeline. I have basic knowldge of shaders by which i mean, from what ive learnt on the forums, so per pixel lights ETC.

But as far as i know, the ay to do the same shadow mapping using shaders still requires the depth buffer to be saved to a texture to pass to the shader? So i dont think shaders can over come the problem, unless you kind knowledgable people know how and would like to explain :)

Thanks
Andy

Fugitive
04-25-2010, 03:12 PM
So you mean to say that its the library implementation (LuaGL) that doesnt allow reading a depth buffer to texture?

Andy Gilbert
04-25-2010, 03:29 PM
Well, what i am using a library that is luaGL and then all the extras functions upto version 2.

When i enquired about the copytexture bug, he confirmed them and said that there was an original bug in luaGL, he is trying to fix it.

So unfortunatly all i know is, its not currently available.

Is there a work around? Or any other shadowing methods that i could try?

Thanks
Andy