Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 


Submitted by Chris Miller, posted on April 25, 2002




Image Description, by Chris Miller



This is a screen grab of my latest coding demo, WebGL. Not your typical OpenGL demo, it combines OpenGL with Dynamic HTML, ASP, and CGI to show interactive 3d modeling in a browser window. You draw in the edit window, then click "Render Changes" to update the 3d display. The scene is rendered by OpenGL into an offscreen buffer. Then it is sent to stdout for display by the browser. I'm not sure if it works on every version of every browser, but i've tested it with IE 5.5 and Navigator 4.04.

Have a look at: http://www.cosmicbee.com/webgl.asp

I would love to see some critique, and hopefully squash a few bugs. Please excuse the rest of the site, as it is in development.

Here are some details...
  • Hand coded Dynamic HTML user interface. I used Dreamweaver to create page templates from my menu system.
  • C++ CGI application to render the scene with OpenGL. I'm using glReadPixels to grab the color buffer. This was interesting to write, because there is no user interface. The program simply outputs a JPG stream to stdout.
  • Uses the Intel JPG library to create the in-memory JPG stream.
  • Bilinear filtereing of the 3d image.
  • Parameter passing with POST to retain page state. The grid is encoded as hexdecimal strings which are passed to the CGI program via GET.
  • Possible enhancements...
  • Stack 15 of these 15 x 15 grids together to create a "cube" which is editable slice by slice.
  • Camera positioning
  • Custom positionable lights
  • Load and save of the grid using the browser.
  • Enlarged image rendering
  • And some bugs...
  • Floating palette doesn't drag on Netscape (working on it).
  • Chris Miller


    [prev]
    Image of the Day Gallery
    www.flipcode.com

    [next]

     
    Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
     
    Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
     
    Melraidin

    April 25, 2002, 12:19 PM

    Seems like a very innovative idea, but I couldn't really do anything except clear to one color within Mozilla

     
    Hoyle

    April 25, 2002, 12:26 PM

    Pretty cool and original idea . . . what is your final goal for this project?

    I only wish the OpenGL colors were a bit more vibrant, they don't match up with the original colors I selected, kinda muted.

     
    Chris McArthur

    April 25, 2002, 12:28 PM

    I am quite impressed, keep up the great work.

     
    Anthracks

    April 25, 2002, 12:54 PM

    For what it's worth, I just tested it with IE6 on XP Pro and it worked fine. The preview window seems to be pretty dark and gray though. But other than that, it works. Not the most exciting thing on earth, but from a purely technological point of view it's very cool :) Good job.

    Anthracks

     
    Punchey

    April 25, 2002, 01:01 PM

    This is pretty cool. So how are you using OpenGL? Is it running server-side?

     
    davepermen

    April 25, 2002, 01:18 PM

    thats damn funny:) could be expanded to some nice server-renderer, for example creating a nice level with some editor (3dsmax for example) walk around in it and then send the pos over to the server wich has some geforce4 so we can see how the perpixellighting would look (i think with a fast net connection it would even be faster than rendering;))

     
    Chris Miller

    April 25, 2002, 01:26 PM

    Yes, the OpenGL runs on the server.

     
    Chris Miller

    April 25, 2002, 01:31 PM

    My OpenGL lighting skills are relatively weak. There is a single light in the scene, but it does seem rather dim.

    Here is the code I use to create it...


    GLfloat g_ambientLight[] = { 0.7f, 0.7f, 0.7f, 1.0f };
    GLfloat g_diffuseLight[] = { 1.0f, 1.0f, 1.0f, 1.0f };
    GLfloat g_lightPos[] = {20.0f, 20.0f, 50.0f, 1.0f};

    glLightfv(GL_LIGHT0, GL_POSITION, g_lightPos);
    glEnable(GL_LIGHTING);
    glLightfv(GL_LIGHT0, GL_AMBIENT, g_ambientLight);
    glLightfv(GL_LIGHT0, GL_DIFFUSE, g_diffuseLight);
    glEnable(GL_LIGHT0);

    glClearColor(1.0f, 1.0f, 1.0f, 0.0f );
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);





    Any ideas? The image buffer is 24 bit, and the scaling code is well tested - so I don't think it's a precision problem.

     
    Melraidin

    April 25, 2002, 01:34 PM

    Just for interests sake, just tried it on IE 6. Works fine, although seems a bit sluggish when updating after choosing a color or whatever. Seems in Mozilla it doesn't respond to any clicks except on the 'Render Changes' button. Can't select a color, can't change the image, even though the little x's in the image seem to raise a tiny bit when the cursor's over them.

     
    Chris Miller

    April 25, 2002, 01:43 PM

    Honestly, I haven't tried mozilla. Since the UI is mostly JavaScript, its tricky making it work on everything. I'll have to check it out.

     
    MC BAXTON

    April 25, 2002, 01:45 PM

    So the sense of this program is ... ?

    To show what could be done with pc ? Its possible to build a house with monitors.. towers as well

    so you can just try it ... and forget it.
    Hey look how I am clever and innovative ... Useless ? who cares

    EOP (END OF POST)

     
    Punchey

    April 25, 2002, 01:47 PM

    I bet you're gettin' hammered now! :-)

     
    Kelson

    April 25, 2002, 02:01 PM

    Hehe, thats cool! I'd would like to suggest a fill or clear all function though. :)

     
    Insight

    April 25, 2002, 02:02 PM

    If anyone builds a house of monitors, please send a pic as IOTD! That would be remarkable.

    Good work on the demo, Chris. A lot of "useless" experiments over time led to some of the greatest ideas and inventions in our world... by creative people with open minds.

     
    DogE.D

    April 25, 2002, 02:04 PM

    That was uncalled for.
    If it wernt for ppl trying things we wouldn't even have pong!!!!
    I thought the IOTD was to show clever and innovative things you have done??
    Lets see some of the very perposfull and life changing things you have done??

    Ben Gosney.

     
    theAntiELVIS

    April 25, 2002, 02:14 PM

    Very cool tech demo.

    Do you think Baxton can actually do anything, besides dis everything that's posted here?

    Doubt it. A wannabe.

    -tAE-

     
    tsuraan

    April 25, 2002, 02:23 PM

    Wow. I would say not to feed the trolls, but I have to agree with you. I want to see a house built out of monitors too. Maybe baxton has some pics?

     
    MeatRoaf

    April 25, 2002, 02:25 PM

    I like it a lot. I think its easy enough to understand that kids might really like to play with this, especially if it could be possibly to implement rotation into the picture.
    nicely done, worked fine IE 6 WinME.

     
    KieranIsOK

    April 25, 2002, 02:28 PM

    What's wrong with using an activex control and rendering realtime gl into that? Or java3d?
    Is this using my 3d card to render the gl, or is your server rendering it and sending it as an image?
    I like the idea of using stdout, but it really isn't practical, is it?

     
    preynolds

    April 25, 2002, 02:35 PM

    Maybe you're too lazy to think about how this could be useful:

    How about doing image editing with no client CPU strain on any computer with DHTML compliant browser?

    Maybe a turn based game that works in a browser that is 3D but doesn't require an ActiveX control or plug-in?

    An online ordering system that allows infinite combinations of a product to be viewed immediately without static images?

    Just about any large data set that could be viewed from different perspectives (maps, satellite data, etc) could use this for any browser that can display a JPEG image.

    Honestly dude, I can't tell if you're a weirdo on purpose or you don't realize how annoying ALL of your posts are. Once again, you prove your own ignorance and short sightedness with a poorly thought out comment.

    No one here minds CONSTRUCTIVE criticism, but please stop wasting our time with your unproductive opinions. And with that said, I will never respond to your posts again. EOP.

     
    Chris Miller

    April 25, 2002, 02:36 PM

    An activex control would be better in some ways, in that it runs on the client - but I wanted to show that this could be done on the server. As part of my demo collection, I intend to build this as an activex control as well. Then, people can see for themselves the advantages and disadvantages. They would have to download a signed control, but the image would be updated in realtime.

     
    Chris Miller

    April 25, 2002, 02:39 PM

    Those are exactly the types of applications where this would be useful. Games would be very cool... I've been thinking of chess with an imagemap for each piece.

     
    ZEN

    April 25, 2002, 02:39 PM

    hmmm, fairly lame. interactive would be much better, could use a java active x control or generate VRML on the fly and it would render that, so you could spin the scene and such.

    but what is the purpose of this? dont see much use of this except as a waste of time, no web utility will ever take the place of a real program, they are just too damn slow right now.

     
    tsuraan

    April 25, 2002, 02:46 PM

    He's a troll. He seems to live off of ripping apart other people to get a reaction, which is probably why many of his posts just don't really make sense (like the one you replied to). I heard that the next version of this forum will have some filtering, so hopefully we can just block people like this and not worry about it anymore.

     
    tsuraan

    April 25, 2002, 02:49 PM

    If you're honestly wondering about uses, have a look at the responses prompted by baxton's troll. Someone (too lazy to go check name) thought up some interesting ideas.

     
    elJaco

    April 25, 2002, 02:53 PM

    Actually several web utilities already exist. I use to work with one regularly.

    For more info:
    http://www3.techsell.se/txl/smpage.fwx?page=209&MAIN_MENU_ITEM=31&selected=31

     
    Daxx909

    April 25, 2002, 03:02 PM

    MC BAXTON is a sick human being. We shouldn't hate him, we shouldn't make fun of him, we shouldn't treat him as a pariah or a net.idiot--above all, we shouldn't flame him. We should reach out to him as a brother, with love and compassion, and operate on his brain.

    (sorry, couldn't resist that one :))

     
    meico

    April 25, 2002, 03:26 PM

    KieranIsOK, ZEN, MC BAXTON,
    There are many cases where ideas like this are very useful and in some cases this would actually be much better than an ActiveX control, Java3D, or some other client side rendering...

    Just one example I can think of would be a 3D adventure game that was running on cell phones - something with the computational power of a gnat (well, actaully less than a gnat, but let's not get into that). This would allow you to serve out nicely rendered stills of a true 3D environment to a device that couldn't even store the geometry of a single room let alone actually render it.

    Ideas like this (or yet another terrain renderer) may not be amazingly useful unto themselves, but instead can with a little imagination can inspire or lead to greater things. That's why people post partially done code or interesting but useless things. It's also why a lot of people come here to read those posts.

     
    Sascrotch

    April 25, 2002, 03:28 PM

    Well...

    I think MC Baxton is funny....

    Maybe he's going to surprise us all one day by posting the ultimate IOTD.....

     
    ScrewLoose

    April 25, 2002, 03:34 PM

    This does not work in Opera 6.0, not that I was really expecting it to since pretty much nobody builds pages for it. But it looks neat with IE.

     
    This thread contains 102 messages.
    First Previous ( To view more messages, select a page: 0 1 2 3 ... out of 3) Next Last
     
     
    Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.