• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
JavaCoolDude

OpenGL
OpenGL GUI anyone? Updated on 11/17/05

207 posts in this topic

First page content Updated.

Thanks for the help guys, I included the zlib license in version 0.7 of my GUI which is now available in the first page, check it out. [smile]
0

Share this post


Link to post
Share on other sites
Hi,

I tryed to port your code to Linux, as you sugest, just creating a makefile, but the compiler don't like some lines of your code. The errors I found until now are:

g++ -O3 -c TextureUtils.cpp
TextureUtils.cpp: In member function `bool Texture::createNormalizingCube(const
char*, unsigned int, bool)':
TextureUtils.cpp:799: error: syntax error before `char'
TextureUtils.cpp:800: error: syntax error before `char'
TextureUtils.cpp:801: error: syntax error before `char'
TextureUtils.cpp:821: error: syntax error before `char'
TextureUtils.cpp:822: error: syntax error before `char'
TextureUtils.cpp:823: error: syntax error before `char'
TextureUtils.cpp:843: error: syntax error before `char'
TextureUtils.cpp:844: error: syntax error before `char'
TextureUtils.cpp:845: error: syntax error before `char'
TextureUtils.cpp:866: error: syntax error before `char'
TextureUtils.cpp:867: error: syntax error before `char'
TextureUtils.cpp:868: error: syntax error before `char'
TextureUtils.cpp:889: error: syntax error before `char'
TextureUtils.cpp:890: error: syntax error before `char'
TextureUtils.cpp:891: error: syntax error before `char'
TextureUtils.cpp:912: error: syntax error before `char'
TextureUtils.cpp:913: error: syntax error before `char'
TextureUtils.cpp:914: error: syntax error before `char'
make: *** [TextureUtils.o] Error 1

AND

g++ -O3 -c GUIUtils.cpp
GUIUtils.cpp: In member function `virtual void
GUITextBox::checkKeyboardEvents(KeyEvent, int)':
GUIUtils.cpp:2187: warning: converting to non-pointer type `char' from NULL
GUIUtils.cpp:2188: warning: converting to non-pointer type `char' from NULL
GUIUtils.cpp: In member function `virtual const Tuple4i&
GUITextBox::getWindowBounds()':
GUIUtils.cpp:2316: warning: converting to non-pointer type `char' from NULL
GUIUtils.cpp: In member function `virtual void
GUIComboBox::actionPerformed(GUIEvent&)':
GUIUtils.cpp:3299: error: no matching function for call to `GUIEventListener::
actionPerformed(GUIEvent)'
../Events/GUIEventListener.h:10: error: candidates are: virtual void
GUIEventListener::actionPerformed(GUIEvent&)
GUIUtils.cpp: In member function `const char* GUIComboBox::getSelectedItem()
const':
GUIUtils.cpp:3444: error: passing `const String' as `this' argument of `
String::operator const char*()' discards qualifiers
GUIUtils.cpp: In member function `const char* GUIComboBox::getItem(unsigned
int) const':
GUIUtils.cpp:3449: error: passing `const String' as `this' argument of `
String::operator const char*()' discards qualifiers
GUIUtils.cpp:3489:2: warning: no newline at end of file
make: *** [GUIUtils.o] Error 1

I could try to "fix" it if I have more time to study your code. But maybe you could just look at the error messages and quickly find what are the problems.

Best Regards,

ALopes.
0

Share this post


Link to post
Share on other sites
A quick and dirty port to Linux using scons build system. Just type
scons in the directory and scons in the example directory. It should
work.

Just some syntaxical fixes, i don't have any Windows, so i can't check if it works with this OS

Download here !


[Edited by - Evadream on July 7, 2005 2:08:35 AM]
0

Share this post


Link to post
Share on other sites
Sorry for the lack of updates, lately I've been very busy (pulling 12-14 hours long shifts :-/).
Abraham Lopez got in touch with my via email and it seems that he's got a new port to Linux up and running, I'll be posting a link to it later tonight (if I ever go back to my place :-/).
Peace
0

Share this post


Link to post
Share on other sites
Nice work! Keep up the good work, and keep posting updates to this!
0

Share this post


Link to post
Share on other sites
Thank you all for your precious feedback [smile]
I updated the main post with new stuff, go fetch it [wink]
0

Share this post


Link to post
Share on other sites
Hey, glad to see the great work, might actually use it for my current project thanks to your awesome decision to use the Zlib license (which I definitely recommend to the rest of the developers on this website).

My question is, why did you write your own XML parser? There are great, license compatible libraries out there that are already complete and ready to use. I grabbed a copy of your code and I'm currently in the process of porting it to TinyXML, a great, small, Zlib licensed core XML parser. It has an impressively small footprint, and is very fast.

If you'd like my port to TinyXML, I can commit it back, just ask. I'm trying to register to the site currently, but something in their ASP broke (don't ask me, I gave up web developing a bit ago). If you'd like to contact me, you can reach me at awalton@gmail.com.

Thanks again for the good work!

Andrew
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
My question is, why did you write your own XML parser? There are great, license compatible libraries out there that are already complete and ready to use. I grabbed a copy of your code and I'm currently in the process of porting it to TinyXML, a great, small, Zlib licensed core XML parser. It has an impressively small footprint, and is very fast.


Hey, I'd LOVE to see this ported to TinyXml. I use TinyXml in my game so having to compile another XML parser in with it doesn't seem to appealing to me :-/ I've also modified TinyXML to read from PHYSICS_FS instead of the normal file access means, this allows me to load my XML from Zip files and all that jazz.

This project has certainly come on a long way since I last checked it out. I'd recommend that you guys get a SF.net project sorted out to allow others to join and contribute.

I'm going to download this tonight and try to see how well it integrates within my game (4E4 entry). I'm at a stage now where a GUI will be useful, if only for health bars and menu screens (but I do have other plans [wink]). The TinyXML based version is something I'd love to see in the future.

EDIT: I've just taken a cursory glance and fear that too many of the supporting systems will conflict with my architecture [sad]. Things such as having a global Logger, for example and having textures stored differently will unfortunately mean I can't use it straight from the box. Things such as keyboard input, mouse input and textures are all handled very specifically to this project; it'd be useful for people like me to be able to hook up some form of 'coupling' class to an abstract interface used by your GUI... My texture classes may not be like yours, but using a proxy class and an interface I'd probably be able to make them behave like them, for example.

With a bit of work, this will go a long way :)

Keep it up!

[Edited by - evolutional on July 13, 2005 6:51:26 AM]
0

Share this post


Link to post
Share on other sites
Well, it does suck this won't work for you, but where my project was a baby when I ran into this, it's absolutely great for me!

Porting to TinyXML is going to take a lot of work, but it's going quickly. I'm going to add a global object to use as a go between the GUI toolkit and TinyXML so that it doesn't take very much code modification. You'll get what I mean when you see the code.

Also, there are other little things I disagree with in the code, but I'm going to bring them up here first before I go changing the whole world around just to fit my needs better. Why, for example, did you bother to write your own string class? Speed? The STL has an alright string class, and I tend to use it for most of my work (better than const char * splattered throughout the code, and having to constantly check sizes, use memcpy, etc, etc). I'm a big fan of doing things the proper OO way, verses the C++ way, so I guess it's a personal preference deal, but I digress.

I think it would also be possible to open up the log interface so that you can plug in your own global log interface if you like (for example, my game uses a flatfile to log instead of XML simply because a log reader doesn't need the metadata XML provides).

I'm very happy I ran into this project. :)

[edit uno] Question to JavaCoolDude:
What extensions in OpenGL required you to need GLee? I'm pretty new to OpenGL (having been a DirectX guy in my prior tiddling with graphics, though I'd never really cared for them before), and I'm unfamiliar with all of the function families, but I can't percieve linking such a fat library for just a few function calls. I also want to mention straight forward how much I really don't like the fact that all of OpenGL is still functional programming and how objects seem to be an afterthought; this was definitely something that DirectX got right, even if it was at the cost of performance initially. *shakes fist*

TinyXML port is going along nicely, though a lot of code refactoring has happened, and I'm not sure if you'll like it. We'll probably have to sort things out if we do ever decide to merge the two.

[Edited by - ciroknight on July 13, 2005 3:14:16 PM]
0

Share this post


Link to post
Share on other sites
Greetings fellow developers, glad to see some enthusiasm and brain storming going in here[smile]

My question is, why did you write your own XML parser? There are great, license compatible libraries out there that are already complete and ready to use. I grabbed a copy of your code and I'm currently in the process of porting it to TinyXML, a great, small, Zlib licensed core XML parser. It has an impressively small footprint, and is very fast.

My decision to write my own and "crappy" XML loader came from the fact that up until you guys have mentioned TinyXML, I've never ran across a samll XML parsing library that would not add 2 or 3 more megs to my rendering engine.
Porting my stuff (shall I say our stuff now [wink]) to TinyXML now that we're approaching the 1.0 release milestone seems like a wonderful suggestion, I'm all for it.

@evolutional:
Sup man, I think the problems lies in the lack of use of namespaces, something that could be easily fixed. I propose GLGUI:: or GUIUtils::, but again the group vote is more suitable for coming up with things like that.

@ciroknight:

I wrote my own String class because I wanted to perform things like adding a string and a scalar with a simple operator rather than resorting to another global function that would do that for me.
Plus, I'm the self-proclaimed champion of "reinvent the wheel, do it now" :D
GLee is there because I needed few extra GL tokens and functions for my texture class that have yet to make it to an official GL.h release.

I'm looking forward to see what your port over to tiny xml will look like, keep us all updated.
Peace.
0

Share this post


Link to post
Share on other sites
Hey JavaCoolDude. Really great stuff. We are already planning on using it for our university project.

If I have any spare time, I am going to see if I can make a nice gui editor for this wonderful program. I think that with a gui editor, it will become a really big thing.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by ciroknight
Also, there are other little things I disagree with in the code, but I'm going to bring them up here first before I go changing the whole world around just to fit my needs better. Why, for example, did you bother to write your own string class? Speed? The STL has an alright string class, and I tend to use it for most of my work (better than const char * splattered throughout the code, and having to constantly check sizes, use memcpy, etc, etc). I'm a big fan of doing things the proper OO way, verses the C++ way, so I guess it's a personal preference deal, but I digress.


JavaCoolDude, I think this is very important. Your project has the potential to become a big hit, but I think you need to try and use as many standardized things as possible. Using STL and TinyXML is a good start. If you use STL, then if other programmers want to help, they will be able to get comfortable really quickly.

Also I was wondering if .NET is an ok language to write the GUI editor in? I thought that once we get the .NET C++ one working, we can make the GUI editor using your GUI library itself.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by JavaCoolDude
@evolutional:
Sup man, I think the problems lies in the lack of use of namespaces, something that could be easily fixed. I propose GLGUI:: or GUIUtils::, but again the group vote is more suitable for coming up with things like that.


Nah, I don't think that will do it... The issue is that I have my own Texture classes and Managers, just as I have my own Keyboard/Mouse managers and system. To use the GUI as it stands I'd have to have TWO texture managers (one for the GUI, one for the game) and TWO input managers which work in a similar, yet different way.

However, if you customised your GUI to accept an interface class for things such as textures, texturemanagement, events, etc there is a good chance that I could hook up an adapter or bridge class to allow my system to work with yours (bridge might actually be more appropriate). I could hook up a special TextureManagerAdaptor class based off GUI::ITextureManager for my manager to interact with your GUI system.

Anyway, it's just an idea - I'll definitely take another look at this if I ever start afresh with another project though.

Keep up the good work!

[Edited by - evolutional on July 14, 2005 10:52:55 AM]
0

Share this post


Link to post
Share on other sites
Just realized, this is just like that new MS Windows Longhorn technology, Avalon thingy, where all your forms are created in XML. If you research the technology right, you might just be able to hack around with there gui editor, and have it spew out your XML format.
0

Share this post


Link to post
Share on other sites
I'm currently working on porting the whole project to using standard strings (which was the part I was really worried about) and TinyXML. It's also requiring me to juggle around the object model a little [instead of having all of the objects inheirit from a base class allowing for XML object access, all of the objects will have to request the data they want from a standard class]. Speed-wise I don't know if this will be a concern, and it is a step away from OO, but I think it'll help, and I'll probably code it both ways and see which works better for me.

I'm also developing on Linux, so it's kinda important to me that the GUI editor not be in .Net. I know Mono allows for running .Net code on Linux, but I've consistantly refused to use Mono simply because there are only a few programs that will depend on it, and it's a huge install set. I'd personally prefer Java, or even C++ to it, simply because of their portability, and Java's built in XML handling is exceptional.

Lastly, my version's gonna change a lot of things; I'd had to almost rewrite almost every XML object so that it better supports my coding model, which may or may not be a good thing. Instead of things like "<BGColor r="1" g="3" b="5">", I rearranged it to being "<Color type="bgcolor" r="1" g="3" b="5">", making use of tuples already included. I think it's easier to parse, and it allows for easier exclusions of incorrect versions ("type="panel-color" is not registered, skipping tag"). I really wish I didn't have to make all of these choices myself, but it's probably better that way because there'd probably be lots of flame wars about it.

Can we give it a name and wrap a namespace around everything? That way we can go ahead and start a SourceForge project and drum up some support. Just an idea.

Port's about 1/3 of the way done due to conflicting schedules (I'm a college student too) and finals rapidly approaching. I would say with time off for the new Harry Potter book on Saturday, and with finals on Thursday next week, it'll be pressing to get it done, but I'll do my best. I'm maintaining two versions (one is a rewrite of the entire XML subsystem, the other's just a quick replacement of the XML accessors with TinyXML accessors). The latter will be done first, of course, but I hope to have both available at about the same time.

w00t. Andrew.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by evolutional
However, if you customised your GUI to accept an interface class for things such as textures, texturemanagement, events, etc there is a good chance that I could hook up an adapter or bridge class to allow my system to work with yours (bridge might actually be more appropriate). I could hook up a special TextureManagerAdaptor class based off GUI::ITextureManager for my manager to interact with your GUI system.


This is more of what I am doing with TinyXML. The problem is, it'll fairly quickly get to the point the entire code is abstracted away, and you're left with an interface mashup, and no real code (which is why I'm maintaining two versions; one with it being a remodel, one being an adaptor). It's a good thing in object orientation, but it's not nessicarily the best in C++ (virtual functions are a bitch).

I really think we need more discussion on how we'd rewrap the object to be an interface (simply because Application Interfaces are the most important aspect to version compatibility). Of course, we could also just go balls to the wall and do it now, simply because we're pre-1.0 and not enough people are using it to need to maintain version compatibility.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by ciroknight
I'm currently working on porting the whole project to using standard strings (which was the part I was really worried about) and TinyXML. It's also requiring me to juggle around the object model a little [instead of having all of the objects inheirit from a base class allowing for XML object access, all of the objects will have to request the data they want from a standard class]. Speed-wise I don't know if this will be a concern, and it is a step away from OO, but I think it'll help, and I'll probably code it both ways and see which works better for me.

I'm also developing on Linux, so it's kinda important to me that the GUI editor not be in .Net. I know Mono allows for running .Net code on Linux, but I've consistantly refused to use Mono simply because there are only a few programs that will depend on it, and it's a huge install set. I'd personally prefer Java, or even C++ to it, simply because of their portability, and Java's built in XML handling is exceptional.

Lastly, my version's gonna change a lot of things; I'd had to almost rewrite almost every XML object so that it better supports my coding model, which may or may not be a good thing. Instead of things like "<BGColor r="1" g="3" b="5">", I rearranged it to being "<Color type="bgcolor" r="1" g="3" b="5">", making use of tuples already included. I think it's easier to parse, and it allows for easier exclusions of incorrect versions ("type="panel-color" is not registered, skipping tag"). I really wish I didn't have to make all of these choices myself, but it's probably better that way because there'd probably be lots of flame wars about it.

Can we give it a name and wrap a namespace around everything? That way we can go ahead and start a SourceForge project and drum up some support. Just an idea.

Port's about 1/3 of the way done due to conflicting schedules (I'm a college student too) and finals rapidly approaching. I would say with time off for the new Harry Potter book on Saturday, and with finals on Thursday next week, it'll be pressing to get it done, but I'll do my best. I'm maintaining two versions (one is a rewrite of the entire XML subsystem, the other's just a quick replacement of the XML accessors with TinyXML accessors). The latter will be done first, of course, but I hope to have both available at about the same time.

w00t. Andrew.


Ok. How about something like... wxWidgets or something?

The first version of the GUI won't be very useful. Probably just a tree structure you can view, and edit there properties. It sure beats typing out XML though.

Oh, something else I thought would be cool. We could have the GUI editor run like VB, where you can hit the play button, and you can see how your GUI would really look.

Hopefully, once the GUI editor, etc is good enough, we can make the GUI editor using the OpenGL GUI itself.
0

Share this post


Link to post
Share on other sites
wxWidgets is a great choice, as I would have suggested it. I have mild experience with it, as GraphThing (a program I'm currently modifying for my own use) uses it.

As for your idea to hit a button and see the GUI, that's actually quite what would happen; an abstract application can (and in a lot of ways, already is) built to allow for any number of GUI widgets to be made and rendered. Simply modify your XML file, and pass it to the application as a parameter ( ./SXMLGUITest path/sampleconf.xml ) and it'll load the GUI against a blank background. You can implement this by having the button action in the Application run the above system call.

As a matter of fact, once my port to TinyXML is up and running, it'll be possible to make an application to where after a change is made to the XML file, the program will reload it and start drawing the widgets immediately; on-the-fly GUI editing.

I really would like a consensus vote though before I go ahead and code both directions; I really like refactoring the code so that XML is entirely abstracted away inside of the code, but the current object model works, and is plenty fast (I think; I have nothing to base this against).

One last note; I just realized how dumb I've been this morning; the GUI has been running slow as crap for me (6 frames a second, WHAT?!) and it was because I was using MESA as a software renderer instead of passing everything through DRI on my system. Someone with similar specs to my system posted earlier how he was experiencing the same deal, and I assure you that this is why (if you are running Linux as I am).

Hope to see your GUI editor up and running soon!

(P.S. In Linux, this could end up being a whole 'nother window manager, with native OGL support and XML configurations, like Windows Avalon or (without the XML) Mac OS X's Aqua. I know Sagar was excited about this earlier too, but I'm just now starting to jump on board with that feeling. It still needs a few widgets (text boxes, a canvas, etc), but definitely do-able. We'll see once we get some more code generated.

One last request; evolutional: you said you wanted to abstract away the interface for texture manager and events, is there any way you can start work on that now? I'm going to try to get ahold of JavaCoolDude today and set up a sourceforge project so that we can have CVS access and such, hopefully to get everyone who's interested some code to work with. )
0

Share this post


Link to post
Share on other sites
Oh boy, plenty of things to read and even more awesome suggestions.
First off all we really need to come up with a decent name and namespace for the project before we go ahead and request some sourceforge space. In one of my private message sessions somebody already suggested OpenGUI. I personally think that suggestion is not bad at all but I would like to hear more from the community before we reach a final decision. SXML GUI is a temporary name, just in case some of you are still wondering about the meaning of S, it simply stands for shaders since in the version tied to my rendering engine, I have this widget called GUIMaterialSurface that supports multi-texturing and shaders as well.

@ciroknight:
I do like your proposal to modify the XML tags a bit, actually I believe it is more flexible and more compelling than my original approach. I would also suggest that the base class should not be too strict regarding case sensitivity.
I wouldn't worry too much about speed hits as long as things are sent around by reference.
I also dig the idea of having the GUI update on the fly as we change the XML configuration file, we really need to start compiling a list of the features that we wish for so we can check em off as we implement them.

Now about the editor:
I'm all for using Java to put together a beta version and then maybe later on port it to using this GUI package.
Speaking of Java, I already wrote the font exporter using that language and curiously enough I never bothered to putting it up for grabs.
Here's a link to it, make sure you save your fonts as TGA and not PNG since the compression algorithm of the latter tends to create severe artifacts around the font's char.
I would certainly wait for the TinyXML port to be up and ready before I start writing the editor, unless someone else volunteers for the said task.

Peace
0

Share this post


Link to post
Share on other sites
A way to deal away with case sensitivity is to either use toUpper or toLower on the string (both are in the <algorithm> header; used by transform ( string.begin(), string.end(), dest.begin(), (int(*)(int))tolower); ) but of course this requires the use of an STL string container ;).

JavaCoolDude, you've made this such a hard port... Lol, I hate to rag on you, but it's just so tedious because your XML accessors are embedded with your XML reader classes, so removing the XML parser pretty much requires me to touch every object.

The design path I've ratified (as of the end of today) is to add a class called XMLArbiter which hides TinyXML from the rest of the code by reading in all of the XML into container classes. To get the data, you'll need to use a set of functions that allow you to move back and forth within the internal iterators, return Tuples, etc, etc. This does require quite a monolithic class, but it's a very fast fix.

The way to abstract this monolith a bit would be to make it plugable: instead of IOXMLObject being inheirited and each object being in charge of knowing how to load the XML, we make XMLArbiter a very low level object and build an inheiritance tree above it (GuiPanelXMLArb, or something), but this gets very complicated ass you add widget types, and even though this class will be heavy, it'll be much cheaper than all of the virtual functions you'd have instead.

Another feature we need to add before the 1.0 Milestone is to enable GUI elements to toggle between hidden and visible. I think you've already started work on this with the Tabbed panels code, but I showed my friend the code today and his first comment was "Can you close the panels?". His next question was "Can you move the panels out of your way?" ;). Good comments came as well with the newest build ("It looks like Enlightenment 17, it's smooth. I love how it blends").

JavaCoolDude: I'm going to send you an email with a (suggested) API for the new object, and show you what I want to change exactly before I go through with it, and you end up hating it (hehe). I'm going to also send you a new format we can ratify the XML configuration on, hopefully; it's important for parsing reasons.

Work is steadily progressing. Hope to have the code to the community soon!

Btw, OpenGUI doesn't quite give us the bite; we need to indicated that it's a 3D environment or something. Windows has Avalon.. we could pun that; (Avalon means "Apple Island", which is just BEGGING to be made fun of; come on.. if you don't see that as funny you don't have a sense of humor, geek or non-geek). Avalon is also the site of the burial grounds of King Arthur.. Um, other names.. Babylon 3D Gui? CoolDudeGUI? Um.. geeze I'm not really good with names.
0

Share this post


Link to post
Share on other sites
ciroknight - I want to wait until you finish porting to release the GUI stuff. It is pretty simple right now. One thing I wanted to ask you is that is there any way wxWidgets would allow me to run OpenGL inside? Here is what I am talking about:

File/Tree Structure ------ Small space where GUI Editor continuously updates new GUI for display ----- Properties window

I want to stay as far from the code for good practice to make sure the XML format is strong enough. Some of my old projects had bad hacks to get around XML crap I couldn't do. The GUI editor should directly spew out XML, which the GL_GUI should read in perfectly.

JavaCoolDude, I was wondering if you were going to get a sourceforge page? It would be very convenient to upload projects there. Also, do you have an official name for this project?
0

Share this post


Link to post
Share on other sites
I think we should have a short, concise GUI name, or perhaps an acronym. The name is the thing that will draw the most attention.

One thing I thought of would be to name it GUI. Just GUI. It would be short, unconsciously leads towards standardization, and confuse people.

The C++ Standards Committee said that one day perhaps C++ will have a standard GUI. Oh, they are including an XML parser in the next version.
0

Share this post


Link to post
Share on other sites
WxWidgets does have an object to work with OpenGL, it's called WxGLCanvas; the API is very much like Windows MFCs. I'm not sure if it has the ability to run GLUT, though, since WxWidgets has its own message manager (as do most toolkits).

Um, as for a name, not a clue. GUI is too empty of a name and would be rejected by SourceForge, and I agree that it is very important to get a homepage and a public CVS server as soon as possible so we can start getting other people to come in.

As for the C++ standards committee, they're just slaves to the machine. They'll probably actually take code from either Xerces (another free XML parser) or TinyXML and include it as standard (of course, this will take some work; XML Namespaces are a huge issue, as are the million different parsing techniques you can use). I doubt if I'm alive the day that C++ gets a standard GUI, because even if they did code an entire free, crossplatform GUI toolkit (a hell of a lot of code), nobody would support it. Windows is quite too deeply embedded with Win32 (they're having a lot of resistance to Avalon and XAML as well), Linux/BSDs are too tied to X11 to give it up (even though it's a disaster), and Mac OS X has Aqua and the Cocoa API.

I think for now we should thank our good graces the C++ standards committee encorporated the STL; I'd be lost without it. I remember the good ol' days when I hand coded open ended containers in C; endless debug cycles, headaches, cursing, even destroyed a monitor. All of the old C functions with the letter "M" proceeding them should be stricken from the public view when working with C++ (no more evil Malloc and Memcpy debugging).

I apologize.. I should get back to work ;)
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • By Solid_Spy
      Hello, I have been working on SH Irradiance map rendering, and I have been using a GLSL pixel shader to render SH irradiance to 2D irradiance maps for my static objects. I already have it working with 9 3D textures so far for the first 9 SH functions.
      In my GLSL shader, I have to send in 9 SH Coefficient 3D Texures that use RGBA8 as a pixel format. RGB being used for the coefficients for red, green, and blue, and the A for checking if the voxel is in use (for the 3D texture solidification shader to prevent bleeding).
      My problem is, I want to knock this number of textures down to something like 4 or 5. Getting even lower would be a godsend. This is because I eventually plan on adding more SH Coefficient 3D Textures for other parts of the game map (such as inside rooms, as opposed to the outside), to circumvent irradiance probe bleeding between rooms separated by walls. I don't want to reach the 32 texture limit too soon. Also, I figure that it would be a LOT faster.
      Is there a way I could, say, store 2 sets of SH Coefficients for 2 SH functions inside a texture with RGBA16 pixels? If so, how would I extract them from inside GLSL? Let me know if you have any suggestions ^^.
    • By DaniDesu
      #include "MyEngine.h" int main() { MyEngine myEngine; myEngine.run(); return 0; } MyEngine.h
      #pragma once #include "MyWindow.h" #include "MyShaders.h" #include "MyShapes.h" class MyEngine { private: GLFWwindow * myWindowHandle; MyWindow * myWindow; public: MyEngine(); ~MyEngine(); void run(); }; MyEngine.cpp
      #include "MyEngine.h" MyEngine::MyEngine() { MyWindow myWindow(800, 600, "My Game Engine"); this->myWindow = &myWindow; myWindow.createWindow(); this->myWindowHandle = myWindow.getWindowHandle(); // Load all OpenGL function pointers for use gladLoadGLLoader((GLADloadproc)glfwGetProcAddress); } MyEngine::~MyEngine() { this->myWindow->destroyWindow(); } void MyEngine::run() { MyShaders myShaders("VertexShader.glsl", "FragmentShader.glsl"); MyShapes myShapes; GLuint vertexArrayObjectHandle; float coordinates[] = { 0.5f, 0.5f, 0.0f, 0.5f, -0.5f, 0.0f, -0.5f, 0.5f, 0.0f }; vertexArrayObjectHandle = myShapes.drawTriangle(coordinates); while (!glfwWindowShouldClose(this->myWindowHandle)) { glClearColor(0.5f, 0.5f, 0.5f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Draw something glUseProgram(myShaders.getShaderProgram()); glBindVertexArray(vertexArrayObjectHandle); glDrawArrays(GL_TRIANGLES, 0, 3); glfwSwapBuffers(this->myWindowHandle); glfwPollEvents(); } } MyShaders.h
      #pragma once #include <glad\glad.h> #include <GLFW\glfw3.h> #include "MyFileHandler.h" class MyShaders { private: const char * vertexShaderFileName; const char * fragmentShaderFileName; const char * vertexShaderCode; const char * fragmentShaderCode; GLuint vertexShaderHandle; GLuint fragmentShaderHandle; GLuint shaderProgram; void compileShaders(); public: MyShaders(const char * vertexShaderFileName, const char * fragmentShaderFileName); ~MyShaders(); GLuint getShaderProgram(); const char * getVertexShaderCode(); const char * getFragmentShaderCode(); }; MyShaders.cpp
      #include "MyShaders.h" MyShaders::MyShaders(const char * vertexShaderFileName, const char * fragmentShaderFileName) { this->vertexShaderFileName = vertexShaderFileName; this->fragmentShaderFileName = fragmentShaderFileName; // Load shaders from files MyFileHandler myVertexShaderFileHandler(this->vertexShaderFileName); this->vertexShaderCode = myVertexShaderFileHandler.readFile(); MyFileHandler myFragmentShaderFileHandler(this->fragmentShaderFileName); this->fragmentShaderCode = myFragmentShaderFileHandler.readFile(); // Compile shaders this->compileShaders(); } MyShaders::~MyShaders() { } void MyShaders::compileShaders() { this->vertexShaderHandle = glCreateShader(GL_VERTEX_SHADER); this->fragmentShaderHandle = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(this->vertexShaderHandle, 1, &(this->vertexShaderCode), NULL); glShaderSource(this->fragmentShaderHandle, 1, &(this->fragmentShaderCode), NULL); glCompileShader(this->vertexShaderHandle); glCompileShader(this->fragmentShaderHandle); this->shaderProgram = glCreateProgram(); glAttachShader(this->shaderProgram, this->vertexShaderHandle); glAttachShader(this->shaderProgram, this->fragmentShaderHandle); glLinkProgram(this->shaderProgram); return; } GLuint MyShaders::getShaderProgram() { return this->shaderProgram; } const char * MyShaders::getVertexShaderCode() { return this->vertexShaderCode; } const char * MyShaders::getFragmentShaderCode() { return this->fragmentShaderCode; } MyWindow.h
      #pragma once #include <glad\glad.h> #include <GLFW\glfw3.h> class MyWindow { private: GLFWwindow * windowHandle; int windowWidth; int windowHeight; const char * windowTitle; public: MyWindow(int windowWidth, int windowHeight, const char * windowTitle); ~MyWindow(); GLFWwindow * getWindowHandle(); void createWindow(); void MyWindow::destroyWindow(); }; MyWindow.cpp
      #include "MyWindow.h" MyWindow::MyWindow(int windowWidth, int windowHeight, const char * windowTitle) { this->windowHandle = NULL; this->windowWidth = windowWidth; this->windowWidth = windowWidth; this->windowHeight = windowHeight; this->windowTitle = windowTitle; glfwInit(); } MyWindow::~MyWindow() { } GLFWwindow * MyWindow::getWindowHandle() { return this->windowHandle; } void MyWindow::createWindow() { // Use OpenGL 3.3 and GLSL 3.3 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // Limit backwards compatibility glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // Prevent resizing window glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); // Create window this->windowHandle = glfwCreateWindow(this->windowWidth, this->windowHeight, this->windowTitle, NULL, NULL); glfwMakeContextCurrent(this->windowHandle); } void MyWindow::destroyWindow() { glfwTerminate(); } MyShapes.h
      #pragma once #include <glad\glad.h> #include <GLFW\glfw3.h> class MyShapes { public: MyShapes(); ~MyShapes(); GLuint & drawTriangle(float coordinates[]); }; MyShapes.cpp
      #include "MyShapes.h" MyShapes::MyShapes() { } MyShapes::~MyShapes() { } GLuint & MyShapes::drawTriangle(float coordinates[]) { GLuint vertexBufferObject{}; GLuint vertexArrayObject{}; // Create a VAO glGenVertexArrays(1, &vertexArrayObject); glBindVertexArray(vertexArrayObject); // Send vertices to the GPU glGenBuffers(1, &vertexBufferObject); glBindBuffer(GL_ARRAY_BUFFER, vertexBufferObject); glBufferData(GL_ARRAY_BUFFER, sizeof(coordinates), coordinates, GL_STATIC_DRAW); // Dertermine the interpretation of the array buffer glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3*sizeof(float), (void *)0); glEnableVertexAttribArray(0); // Unbind the buffers glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); return vertexArrayObject; } MyFileHandler.h
      #pragma once #include <cstdio> #include <cstdlib> class MyFileHandler { private: const char * fileName; unsigned long fileSize; void setFileSize(); public: MyFileHandler(const char * fileName); ~MyFileHandler(); unsigned long getFileSize(); const char * readFile(); }; MyFileHandler.cpp
      #include "MyFileHandler.h" MyFileHandler::MyFileHandler(const char * fileName) { this->fileName = fileName; this->setFileSize(); } MyFileHandler::~MyFileHandler() { } void MyFileHandler::setFileSize() { FILE * fileHandle = NULL; fopen_s(&fileHandle, this->fileName, "rb"); fseek(fileHandle, 0L, SEEK_END); this->fileSize = ftell(fileHandle); rewind(fileHandle); fclose(fileHandle); return; } unsigned long MyFileHandler::getFileSize() { return (this->fileSize); } const char * MyFileHandler::readFile() { char * buffer = (char *)malloc((this->fileSize)+1); FILE * fileHandle = NULL; fopen_s(&fileHandle, this->fileName, "rb"); fread(buffer, this->fileSize, sizeof(char), fileHandle); fclose(fileHandle); buffer[this->fileSize] = '\0'; return buffer; } VertexShader.glsl
      #version 330 core layout (location = 0) vec3 VertexPositions; void main() { gl_Position = vec4(VertexPositions, 1.0f); } FragmentShader.glsl
      #version 330 core out vec4 FragmentColor; void main() { FragmentColor = vec4(1.0f, 0.0f, 0.0f, 1.0f); } I am attempting to create a simple engine/graphics utility using some object-oriented paradigms. My first goal is to get some output from my engine, namely, a simple red triangle.
      For this goal, the MyShapes class will be responsible for defining shapes such as triangles, polygons etc. Currently, there is only a drawTriangle() method implemented, because I first wanted to see whether it works or not before attempting to code other shape drawing methods.
      The constructor of the MyEngine class creates a GLFW window (GLAD is also initialized here to load all OpenGL functionality), and the myEngine.run() method in Main.cpp is responsible for firing up the engine. In this run() method, the shaders get loaded from files via the help of my FileHandler class. The vertices for the triangle are processed by the myShapes.drawTriangle() method where a vertex array object, a vertex buffer object and vertrex attributes are set for this purpose.
      The while loop in the run() method should be outputting me the desired red triangle, but all I get is a grey window area. Why?
      Note: The shaders are compiling and linking without any errors.
      (Note: I am aware that this code is not using any good software engineering practices (e.g. exceptions, error handling). I am planning to implement them later, once I get the hang of OpenGL.)

       
    • By KarimIO
      EDIT: I thought this was restricted to Attribute-Created GL contexts, but it isn't, so I rewrote the post.
      Hey guys, whenever I call SwapBuffers(hDC), I get a crash, and I get a "Too many posts were made to a semaphore." from Windows as I call SwapBuffers. What could be the cause of this?
      Update: No crash occurs if I don't draw, just clear and swap.
      static PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be { sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor 1, // Version Number PFD_DRAW_TO_WINDOW | // Format Must Support Window PFD_SUPPORT_OPENGL | // Format Must Support OpenGL PFD_DOUBLEBUFFER, // Must Support Double Buffering PFD_TYPE_RGBA, // Request An RGBA Format 32, // Select Our Color Depth 0, 0, 0, 0, 0, 0, // Color Bits Ignored 0, // No Alpha Buffer 0, // Shift Bit Ignored 0, // No Accumulation Buffer 0, 0, 0, 0, // Accumulation Bits Ignored 24, // 24Bit Z-Buffer (Depth Buffer) 0, // No Stencil Buffer 0, // No Auxiliary Buffer PFD_MAIN_PLANE, // Main Drawing Layer 0, // Reserved 0, 0, 0 // Layer Masks Ignored }; if (!(hDC = GetDC(windowHandle))) return false; unsigned int PixelFormat; if (!(PixelFormat = ChoosePixelFormat(hDC, &pfd))) return false; if (!SetPixelFormat(hDC, PixelFormat, &pfd)) return false; hRC = wglCreateContext(hDC); if (!hRC) { std::cout << "wglCreateContext Failed!\n"; return false; } if (wglMakeCurrent(hDC, hRC) == NULL) { std::cout << "Make Context Current Second Failed!\n"; return false; } ... // OGL Buffer Initialization glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glBindVertexArray(vao); glUseProgram(myprogram); glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_SHORT, (void *)indexStart); SwapBuffers(GetDC(window_handle));  
    • By Tchom
      Hey devs!
       
      I've been working on a OpenGL ES 2.0 android engine and I have begun implementing some simple (point) lighting. I had something fairly simple working, so I tried to get fancy and added color-tinting light. And it works great... with only one or two lights. Any more than that, the application drops about 15 frames per light added (my ideal is at least 4 or 5). I know implementing lighting is expensive, I just didn't think it was that expensive. I'm fairly new to the world of OpenGL and GLSL, so there is a good chance I've written some crappy shader code. If anyone had any feedback or tips on how I can optimize this code, please let me know.
       
      Vertex Shader
      uniform mat4 u_MVPMatrix; uniform mat4 u_MVMatrix; attribute vec4 a_Position; attribute vec3 a_Normal; attribute vec2 a_TexCoordinate; varying vec3 v_Position; varying vec3 v_Normal; varying vec2 v_TexCoordinate; void main() { v_Position = vec3(u_MVMatrix * a_Position); v_TexCoordinate = a_TexCoordinate; v_Normal = vec3(u_MVMatrix * vec4(a_Normal, 0.0)); gl_Position = u_MVPMatrix * a_Position; } Fragment Shader
      precision mediump float; uniform vec4 u_LightPos["+numLights+"]; uniform vec4 u_LightColours["+numLights+"]; uniform float u_LightPower["+numLights+"]; uniform sampler2D u_Texture; varying vec3 v_Position; varying vec3 v_Normal; varying vec2 v_TexCoordinate; void main() { gl_FragColor = (texture2D(u_Texture, v_TexCoordinate)); float diffuse = 0.0; vec4 colourSum = vec4(1.0); for (int i = 0; i < "+numLights+"; i++) { vec3 toPointLight = vec3(u_LightPos[i]); float distance = length(toPointLight - v_Position); vec3 lightVector = normalize(toPointLight - v_Position); float diffuseDiff = 0.0; // The diffuse difference contributed from current light diffuseDiff = max(dot(v_Normal, lightVector), 0.0); diffuseDiff = diffuseDiff * (1.0 / (1.0 + ((1.0-u_LightPower[i])* distance * distance))); //Determine attenuatio diffuse += diffuseDiff; gl_FragColor.rgb *= vec3(1.0) / ((vec3(1.0) + ((vec3(1.0) - vec3(u_LightColours[i]))*diffuseDiff))); //The expensive part } diffuse += 0.1; //Add ambient light gl_FragColor.rgb *= diffuse; } Am I making any rookie mistakes? Or am I just being unrealistic about what I can do? Thanks in advance
    • By yahiko00
      Hi,
      Not sure to post at the right place, if not, please forgive me...
      For a game project I am working on, I would like to implement a 2D starfield as a background.
      I do not want to deal with static tiles, since I plan to slowly animate the starfield. So, I am trying to figure out how to generate a random starfield for the entire map.
      I feel that using a uniform distribution for the stars will not do the trick. Instead I would like something similar to the screenshot below, taken from the game Star Wars: Empire At War (all credits to Lucasfilm, Disney, and so on...).

      Is there someone who could have an idea of a distribution which could result in such a starfield?
      Any insight would be appreciated
  • Popular Now