3D Bash with SDL

I am currently searching for a possibility to access a bash in sql.
I have compared the sdl-terminal library, sdl-console and the antweakbar library.
These are the only libraries I could find. the problem is:

antweakbar is line based. Tough the use is very easy, it is not usefull to create something like a 3D bash.

sdl-terminal and sdl-console are both used for a terminal emolation, but both have not the capability for an interface to a linux shell.
Futhermore, both do not support copy/past of text in the console.

My perfect solution would be a library to create a quad in 3d with a console on it. (with selectable text)

Does anyone know something that could at least come close to these requirements?
(I mean, a lot of people must have dreamed of a 3D world where you can push around your shells :slight_smile:

Thanks in advance

newgen

I am currently searching for a possibility to access a bash in sql.

while… interesting… i do ponder a question – why not just use one of
the 3d unixy desktop window managers ?

-willOn Thu, Dec 3, 2009 at 4:34 PM, newgen wrote:

" I am currently searching for a possibility to access a bash in sql. "

sql was a typo. I meant SDL.

So the question is: why not use something like “compiz” or 5dwm?
Because I am developing an application to visualize network data in 3d. This include maps of networks in 3d as well as visualisation of single hosts with file structure or services.
Ony main functionality is the direct access to the systems on the map: for example a shell floating over the visualized system. The shell has an ssh executed to connect to the system.
I don’t want to invent something new, which already exists. I want to visualize data.
but as I work for a security company, I want also full access to raw data. This means direct access at least to a shell.
The final thought is to interpret the commands and the response given on the shell and visualize the gained information of a set of commandos.

A simple example would be to select a system in my SDL/3d World. This selection triggers currently some windows on hud, providing me with informations I already gathered.
Now I want to simply rightclick on the system an select “shell”. This would use a lot of predefined data (like routes, ports, account , type of connection (tunnel?))

Switching here from my sdl window to a terminal on my xserver would mean to loose the ability to include the information from the selection.

If you have another idea to solve this, I would be pleased to think about the realisation.

Just fork the shell with the arguments you want and communicate with
it via pipes. To be able to see the shell, well that is a little
harder, but you can create a simple terminal program that is really
just part of your SDL application. It would just be another window, or
you can use alpha blending to draw it on top of the rest of your
display. It would send what ever you type off to the instance of bash
you started and it would also show your input text as you type it. It
would also show the output from bash in the same way it shows your
input text. And, you could easily extend it so that you can select
text in your window and send it to your main program. Fun project, I
did something like that back in '88.

Bob PendletonOn Fri, Dec 4, 2009 at 2:56 PM, newgen wrote:

" I am currently searching for a possibility to access a bash in sql. "

sql was a typo. I meant SDL.

So the question is: why not use something like “compiz” or 5dwm?
Because I am developing an application to visualize network data in 3d. This
include maps of networks in 3d as well as visualisation of single hosts with
file structure or services.
Ony main functionality is the direct access to the systems on the map: for
example a shell floating over the visualized system. The shell has an ssh
executed to connect to the system.
I don’t want to invent something new, which already exists. I want to
visualize data.
but as I work for a security company, I want also full access to raw data.
This means direct access at least to a shell.
The final thought is to interpret the commands and the response given on the
shell and visualize the gained information of a set of commandos.

A simple example would be to select a system in my SDL/3d World. This
selection triggers currently some windows on hud, providing me with
informations I already gathered.
Now I want to simply rightclick on the system an select “shell”. This would
use a lot of predefined data (like routes, ports, account , type of
connection (tunnel?))

Switching here from my sdl window to a terminal on my xserver would mean to
loose the ability to include the information from the selection.

If you have another idea to solve this, I would be pleased to think about
the realisation.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


±----------------------------------------------------------

I don’t think that’s the part he’s having a hard time overcoming.
Probably the terminal emulation and the mouse cursor projection are
the parts that will be most difficult for him.On Fri, Dec 4, 2009 at 6:42 PM, Bob Pendleton wrote:

Just fork the shell with the arguments you want and communicate with
it via pipes. To be able to see the shell, well that is a little
harder, but you can create a simple terminal program that is really
just part of your SDL application. It would just be another window, or
you can use alpha blending to draw it on top of the rest of your
display. It would send what ever you type off to the instance of bash
you started and it would also show your input text as you type it. It
would also show the output from bash in the same way it shows your
input text. And, you could easily extend it so that you can select
text in your window and send it to your main program. Fun project, I
did something like that back in '88.

Bob Pendleton

On Fri, Dec 4, 2009 at 2:56 PM, newgen wrote:

" I am currently searching for a possibility to access a bash in sql. "

sql was a typo. I meant SDL.

So the question is: why not use something like “compiz” or 5dwm?
Because I am developing an application to visualize network data in 3d. This
include maps of networks in 3d as well as visualisation of single hosts with
file structure or services.
Ony main functionality is the direct access to the systems on the map: for
example a shell floating over the visualized system. The shell has an ssh
executed to connect to the system.
I don’t want to invent something new, which already exists. I want to
visualize data.
but as I work for a security company, I want also full access to raw data.
This means direct access at least to a shell.
The final thought is to interpret the commands and the response given on the
shell and visualize the gained information of a set of commandos.

A simple example would be to select a system in my SDL/3d World. This
selection triggers currently some windows on hud, providing me with
informations I already gathered.
Now I want to simply rightclick on the system an select “shell”. This would
use a lot of predefined data (like routes, ports, account , type of
connection (tunnel?))

Switching here from my sdl window to a terminal on my xserver would mean to
loose the ability to include the information from the selection.

If you have another idea to solve this, I would be pleased to think about
the realisation.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


±----------------------------------------------------------


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


http://codebad.com/

I already have found some sample codes where someone projected a terminal emulation on every side of a 3d cube. The problem is that the fonts are
mostly rendered (for example bitmaps) and are therefore not selectable.
The other point is that I would need to use some pipe to connect the 3d rendered quad with the shell (which might be accessable through popen or similar.)

If I somehow manage to create a full shell on a 3d quad, I would still have big problems selecting text.

My current approach would be to just render the input/output on the quad in 3d space.
If I would need to select text, I would have to create some alpha blending sdl-console and copy the data to the buffer of the newly created window.
This approach would reduce the problems of mouse cursor projection for selection, which already drives me nuts if i try to select an object in 3d.
(Currently, selecting works, the selection point is not on the object if I change my camera position/perspective)

Code:

void Cameraclass::sdl_mousedw(int x, int y, int but)
{
printf("\nMouse button %d pressed at %d %d\n", but, x, y);
if (but == SDL_BUTTON_LEFT)
gl_select(x,screenheight-y); //Important: gl (0,0) ist bottom left but window coords (0,0) are top left so we have to change this!
}

void Cameraclass::gl_select(int x, int y)
{
GLuint buff[64] = {0};
GLint hits, view[4];
// This choose the buffer where we store the values for the selection data
glSelectBuffer(64, buff);
// This retrieves info about the viewport
glGetIntegerv(GL_VIEWPORT, view);
// Switching in selecton mode
glRenderMode(GL_SELECT);
// Clearing the names’ stack
// This stack contains all the info about the objects
glInitNames();
// Now fill the stack with one element (or glLoadName will generate an error)
glPushName(0);
// Now modify the viewing volume, restricting selection area around the cursor
//glMatrixMode(GL_MODELVIEW); // working
glMatrixMode(GL_PROJECTION); // working
glLoadIdentity();
glPushMatrix();
// restrict the draw to an area around the cursor
gluPickMatrix(x, y, 4.0, 4.0, view);
gluPerspective(60, (float)view[2]/(float)view[3], 0.0001, 1000.0); // orig
// Draw the objects onto the screen
// draw only the names in the stack, and fill the array
DrawTargets();
glMatrixMode(GL_PROJECTION); // mod
// Do you remeber? We do pushMatrix in PROJECTION mode
glPopMatrix();
// get number of objects drawed in that area
// and return to render mode
hits = glRenderMode(GL_RENDER);
// Print a list of the objects
list_hits(hits, buff);
// uncomment this to show the whole buffer
// gl_selall(hits, buff);
glMatrixMode(GL_MODELVIEW);
}

I already have found some sample codes where someone projected a terminal
emulation on every side of a 3d cube. The problem is that the fonts are
mostly rendered (for example bitmaps) and are therefore not selectable.

What do you mean by this?

The other point is that I would need to use some pipe to connect the 3d
rendered quad with the shell (which might be accessable through popen or
similar.)

Right. Well, I wrongfully assumed this was not a challenge for you. In any
case, here’s how you do it, which is more or less what Bob Pendleton
suggested: You want p2open(). It’s not available under GNU/Linux for some
reason, and you’ll need a different implementation for Windows, but the
p2open() implementation from OpenSolaris’ libc worked for me with very
little modification:

http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libgen/common/p2open.c

If I somehow manage to create a full shell on a 3d quad, I would still have
big problems selecting text.

My current approach would be to just render the input/output on the quad in
3d space.
If I would need to select text, I would have to create some alpha blending
sdl-console and copy the data to the buffer of the newly created window.

I don’t really understand what you’re saying here.

This approach would reduce the problems of mouse cursor projection for
selection, which already drives me nuts if i try to select an object in 3d.
(Currently, selecting works, the selection point is not on the object if I
change my camera position/perspective)

You shouldn’t be doing it the way you are doing it. What is your highest
maths education? You only need to employ “raycasting” algorithms on your
scene to determine what element of your 3D scene the user is indicating with
the cursor, or for that matter, which 2D element of a 2D surface inserted
into a 3D scene.On Sat, Dec 5, 2009 at 12:28 PM, newgen wrote:


http://codebad.com/

I already have found some sample codes where someone projected a terminal emulation …

What do you mean by this?

http://schueler.freepage.de/newgen/SDL_terminal-1.1.3.tar.gz

This is a sample source where someone created a shell-like programm and rendered the output on a 3d cube.
The problem is that in most examples I have found, the font is rendered as bitmap or similar. I understood that the fonts are therefore
handled like some texture or 3d object, not like real text.

If I somehow manage to create a full shell on a 3d quad, I would still have big problems selecting text.

My current approach would be to just render the input/output on the quad in 3d space.
If I would need to select text, I would have to create some alpha blending sdl-console and copy the data to the buffer of the newly created window.

I don’t really understand what you’re saying here.

It was just an idea to display the output from the bash to a something like the 3d cube on the sample source above.
If I would need to modify the text, I could oben a new real window and modify the text in there. The window would be limited to 2d, which would make selection much easier.

You only need to employ “raycasting” algorithms on your scene to determine what element of your 3D scene the user is indicating with the cursor, or for that matter, which 2D element of a 2D surface inserted into a 3D scene.

Ok, at this point I think I should take a good book and read a bit more about the difference between “raycasting” in sdl, because my mathematical skills have become very bad since I left university :frowning:

Well, thank you very much for the p2open.c . I will try to integrate it into the sample source above. If I am successfull, I wil try to implement both in the main program.

The problem is that in most examples I have found, the font is rendered
as bitmap or similar. I understood that the fonts are therefore
handled like some texture or 3d object, not like real text.

Defined “handled.” I really don’t understand! It seems, now, like you don’t
want there to be a graphical counterpart to your text data, like that will
somehow stop you from doing something with the text that the graphics
originate from.

It was just an idea to display the output from the bash to a something like
the 3d cube on the sample source above.
If I would need to modify the text, I could oben a new real window and
modify the text in there. The window would be limited to 2d, which would
make selection much easier.

I thought you said this was going to be cool!

Ok, at this point I think I should take a good book and read a bit more

about the difference between “raycasting” in sdl, because my mathematical
skills have become very bad since I left university [image: Sad]

You won’t necessarily learn about raycasting in a book about SDL, as they
aren’t really related:

Well, thank you very much for the p2open.c . I will try to integrate it
into the sample source above. If I am successfull, I wil try to implement
both in the main program.

Good luck!On Sun, Dec 6, 2009 at 11:20 AM, newgen wrote:


http://codebad.com/

Sorry, my job kept me busy in the last few days.

I thought you said this was going to be cool!

It would be a solution, but drawing 2 windows just to have tha ability to select text in the one window seems extremly uneffective.

You won’t necessarily learn about raycasting in a book about SDL, as they aren’t really related:

For the selection thing, I just figured out that raycasting us unnecessary. Therefore, my question would be:
would it be possible (with raycasting) to select with a cursor text, which is rendered on a texture? Because thats what I already implemented with the source given above.
(Not to mention that the creater of the source was a little insane about the Makefile, or used a framework to create this mess of a Makefile)

Regarding the p2open.c: this seems quite complicated to integrate it without using several additional libraries. A friend had a better Idea:
How about using an interpreter like ruby as shell. The Metasploit framework uses it and it makes the whole framework a fully dynamic application.
The main problem just remains: who to connect my new sdl/c++ 3dwindow with a bash/ruby interpreter (with the SDL_terminal given above, to make the access to the 3d window easier…)