C++ to GLSL

Post your questions, suggestions and experiences regarding to Image manipulation, 3d modeling and level editing for the Irrlicht engine here.
Post Reply
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

C++ to GLSL

Post by REDDemon »

Where can i find a good article that explains how to design a simple program in C++ and make the equivalent in GLSL? The problem is that in C++ i have the "new" for creating new objects. how can I do for example a tree without using "new"? (i know that there are limited variables in a shader, but i want to endup all those variables if necessary).
I'm trying to do that in glsl 1.0 / 1.2 so newer shading languages are not suitable for me. I know that there is no interest in video card vendors on supporting old languages, but i think somewhere there is someone that has worked on this problem.

I want also to query the variables on my graphics card how can i know how many floating points vectors or integer vectors can i use in a GLSL program?

I can't tell why i need it. But if i succed a opensource demo will be released.
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: C++ to GLSL

Post by serengeor »

REDDemon wrote:I can't tell why i need it.
I smell some secret project going on in your basement :D

I can't help you on this topic, I'm a complete noob at shaders 8)
Working on game: Marrbles (Currently stopped).
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Post by REDDemon »

that's not secret. :) just want to be sure something is possible also in practice terms since theorically everything works. fast reply anyway! :)

i'm looking at old C tutorials for making tree structures without "objects" but i have some lack about full potential of old GLSL.

I think I need to create an array of structs, but i think there will be obviously some limit to the size of the arrays especially with big structs.

anyway i'm searching on some general tutorial about how to translate from c++ to glsl but there are no tutorials :(
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

nespa
Posts: 167
Joined: Wed Feb 24, 2010 12:02 pm

Post by nespa »

hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Post by hendu »

No dynamic memory on the gpu. glxinfo -l will tell you your card's limits, if you're on linux.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Of course there's dynamic memory on the GPU. glTex2D will alloc the necessary array and assign it to the texture name. CUDA and OpenCL have similar calls, which are even called allocSomething.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Post by hendu »

I mean like "hey, the app told me I need an array of 1500 ints. I'll go and malloc/new/etc it". Last I checked gpus couldn't do dynamic allocation like that.

edit to clarify: graphics context. I don't know about GPGPU languages.
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Post by REDDemon »

thanks, never thinked about of using a texture as an array. can I access texture data without using 2D sampler?
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Post Reply