• 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

Updated on 11/17/05 Calling the destructor on the main GUI frame now frees up all the allocated resources. Link up Updated on 10/16/05 Ok I figured I'll clean up this message a bit and simply post the essentials: This GUI package now uses sdt::strings and tinyxml for parsing as per popular request. Here's the list of the main features of this package: Widgets: Buttons, vertical and horizontal sliders, combo boxes, text fields, panels, radio buttons, labels, check boxes and separators. Texture class recognizing DDS, PNG, JPG and TGA files as well as a TextureManager to prevent loading a resource twice. Linux and Win32 compatible now. Timer and benchmark utilities. Fewer files than previous versions. etc... You can grab the zip package containing both linux make file and Dot net project file right here I would like to thank everyone who contributed to this project (woah so many :P) you guys deserve two enthusiastics thumbs up. Ok snapshots: Linux port. Windows XP. Setup sample.
<Panel visible     = "true"
       name        = "Main Frame">

  <Texture  type        = "TEXTURE_2D"
            path        = "GUIElements.PNG" 
            mode        = "MODULATE"
            mipmap      = "true">

    <Wrap   s           = "REPEAT"
            t           = "REPEAT" />

    <Filter mag         = "LINEAR" 
            min         = "LINEAR_MIPMAP_LINEAR" />
  </Texture>
  
  <Font path = "ArialSmall.tga" />
  <Panel description = "ColorSliders.xml" />

  <Panel name           = "Parent"
         layout         = "CEN_YAXIS"
         drawBounds     = "true"
         drawBackground = "true">

    <BordersColor     x    = "216" y = "169" z =   "0" />
    <BGColor          x    = "255" y = "255" z = "1.0" w = "1.0"/>
    <Texture          type = "TEXTURE_2D" path = "opengl.jpg" />
    <TextureRectangle x    = "0.0" y = "0.0" z = "1.0" w = "1.0" />

    <TabbedPanel callbackString = "tabs">   
       <TabButtonsBordersColor  x = "50" g = "50" b = "50" />
       <TabButtonsColor         x = "255" g = "180" b = "40" />
       <BordersColor            x = "216" y = "169" z =  "0" />
       <BGColor                 x =  "50" y =  "50" z = "50" />
 
       <Panel description = "Sliders.xml"   />
       <Panel description = "Buttons.xml"   />
       <Panel description = "Editable.xml"  />
       <Panel description = "Checkable.xml" />
       <Panel description = "Others.xml"    />
    </TabbedPanel>

  </Panel>

  <Panel name        = "EParent"
         anchorPoint = "CORNERRD">
 
     <BordersColor x = "216" y = "169" z =  "0" />
     <BGColor      x =  "50" y =  "50" z = "50" />
     <Position     x = "-10" y = "-10"/>
     
    <Button callbackString = "exit">
      <EdgeOffsets x = "0.0" y = "0.0" />
      <Text    string  = "EXIT" />
    </Button>

  </Panel>
  
  <Panel name           = "DStats"
         layout         = "YAXIS"
         drawBounds     = "true"
         anchorPoint    = "CORNERLU"
         drawBackground = "true"> 

    <BGColor      x =  "50" y =  "50" z = "50" />
    <BordersColor x = "216" y = "169" z =  "0" />

    <Position    x = "10" y = "10"/>
    <Interval    y = "2" />

    <Label name = "Title">    
      <Text string = "FPS Monitor" fontIndex ="1">
         <Color r = "255" g = "180" b = "40" />
       </Text>
    </Label>
    <Separator ratio = "1.0" />
    <Label name = "fpsCounter"><Text string = "Current FPS:" /></Label>
    
  </Panel>
     
  <TexCoordsDesc xStart = "201" yStart = "2" xEnd = "233" yEnd = "34" type = "SLIDER"/>
  <TexCoordsDesc xStart = "167" yStart = "2" xEnd = "199" yEnd = "34" type = "CHECK_BOX"/>
  <TexCoordsDesc xStart = "131" yStart = "1" xEnd = "165" yEnd = "35" type = "CHECK_BOX_MARK"/>
  <TexCoordsDesc xStart =   "1" yStart = "1" xEnd =  "65" yEnd = "66" type = "RADIO_BUTTON"/>
  <TexCoordsDesc xStart =  "66" yStart = "2" xEnd = "130" yEnd = "66" type = "CHECK_RB_MARK"/>
</Panel>




[Edited by - JavaCoolDude on November 17, 2005 2:51:39 PM]
0

Share this post


Link to post
Share on other sites
good stuff mate, i would to see some code and and use it in my project ...i am getting 1800fps on my machine...
specs:
64athlon 3.2
1gb RAM
9800 pro

0

Share this post


Link to post
Share on other sites
I'm in the middle of some relocation right now, gimmie few days and I'll upload the new stuff to my server :)
Thanks for the feedback brother, I find it bizarre however that you got more FPS than I do even though my GF6800 is a helluva faster than your Radeon, must be my 1.9 Athlon holding me back, seriously[sad]
0

Share this post


Link to post
Share on other sites
no trouble at all mate, if there is any testing or what not that you want done give me shout ;-) ..i am more than willing to help out
0

Share this post


Link to post
Share on other sites
I'm very interested too! i especially would like to have a look at your source code as an inspiration on how to build a simple Opengl-GUI. why not supply the code you already have? or please email me your code: post at andre-krause.net

are there any other known opengl-gui's suitable for games out there?

i got around 80 fps with a nvidia gforce 4 ti 4200.
0

Share this post


Link to post
Share on other sites
I still have to implement TextAreas and drop down menues, that's what's holding me back [pig]
I have an older unoptimized version on my site which is tightly tied to the 0.5 built of my SXML engine, you can give it a try, you need to look into the GUIUtils folder.
A single day is what I'm asking for to release the new code and much improved code, you'll like the new stuff even more. :)
PS: I thought about reproducing some of World of Warcraft GUI layouts but I totally lack the textures and arts [sad] X 2
0

Share this post


Link to post
Share on other sites
me personally i ain't in no hurry ...whenever it's done it's done ....do i keep checking your website for updates or will you post in here? ...if u want any testing just email me at tim_at_sterlingmicros_dot_com_dot_au
0

Share this post


Link to post
Share on other sites
Looking pretty fly there.

Since my precious Radeon 9800 broke down I am running a oldschool Geforce2 MX with 32Mbyte of RAM, and figured it is nice to give some feedback of how well the GUI would run on legacy(if it isn't legacy, it should be :P) hardware.

Getting 250-260fps when the size is the standard of starting the application, maximizing it gives ~100fps (1280x1024). This is a 1.8Ghz Athlon (2500+ with AMD way of rating)

Usefull standard widgets as you are saying yourself missing is a textfield and dropdown lisbox, aswell as a normal multiselective listbox. I assume the sliders can be placed vertical aswell? A minor widget that could be usefull would be a image/icon area, wich then would basicly be a un-clickable button as you have it now.

I am a firm beliver in making things crossplatform and would love to see this as a _easy to use_ platform independant library (well atleast something more than windows only). Since I know you don't mind sharing code/solutions I know making it open source in some way would not be alien too you, and I dig that.

Don't be afriad to ask for help :-)

0

Share this post


Link to post
Share on other sites
Just my $.02f.
Skinnable will be a plus.
Scrollable text box.(good for debug console)
And you might wanna consider some high level gui(like open dialog).(Hmm, that might be a bad idea, cuz' it's somewhat too platform specific)

And for the perf stat:
fps:1784(beginning) 890(resize to 1024*768)
Athlon64 3200+
GF6600GT AGP8

Since the fps is not linear, Change fps(frame per second) to spf(second per frame?) may be better.
0

Share this post


Link to post
Share on other sites
hey what about some threedimensional panels?
0

Share this post


Link to post
Share on other sites
The GUI looks nice , but how about the usability of GUI. How to create components , how to use them ? Some simple example maybe.
0

Share this post


Link to post
Share on other sites
My specs:
P4 1.6Ghz
Radeon 9200
512 RAM

Default size, 310 FPS
Maximized(1024x728), 218 FPS

I like it. What language did you use. If C++, I'd definetly be interested in some source code, especially for the text boxes.
0

Share this post


Link to post
Share on other sites
Yup C++ all the way :)
Ok here's my to-do list, please notify me if I'm missing anything:
TextArea
SelectionBox
Vertical Sliders
Drop down menues

The skinnable surface is already there and here's a list of its features:

Vertex and Pixel Shader/Program support.
Alpha/Blending attribues.
Up to 8 textures.
Materials.

I will provide an example later with some fancy pixel shading :D

Now this GUI should be really easy to use, to handle the user events, one is ought to provide the GUIFrame with an actionPeformed function to where it will direct all the events, an example:


void SceneFrame::actionPerformed(GUIEvent evt)
{
if(!evt.getEventSource())
return;

const String &callbackString = evt.getCallbackString();

if(evt.getEventSource()->getWidgetType() == CHECK_BOX)
{
GUICheckBox *checkBox = (GUICheckBox*)evt.getEventSource();
if(callbackString == "showVelocities")
{
if(velocitiesSurface) velocitiesSurface->setVisible(checkBox->isChecked());
return;
}

if(callbackString == "showLocations")
{
if(locationsSurface) locationsSurface->setVisible(checkBox->isChecked());
return;
}

if(callbackString == "showNormals")
{
if(normalsSurface) normalsSurface->setVisible(checkBox->isChecked());
return;
}

if(callbackString == "displayInfo")
if(checkBox->isClicked() && demoInfo)
demoInfo->setVisible(checkBox->isChecked());

}

if(evt.getEventSource()->getWidgetType() == RADIO_BUTTON)
{
GUIRadioButton *radioButton = (GUIRadioButton*)evt.getEventSource();
}

if(evt.getEventSource()->getWidgetType() == SLIDER)
{
GUISlider *slider = (GUISlider*)evt.getEventSource();

if(callbackString == "swimSize")
{
swimmerSize = clamp(int(slider->getProgress() * 10.0f), 1, 8);
slider->setLabelString(String("Swimmer Size: ") + swimmerSize);
return;
}

if(callbackString == "swimRadius")
{
swimmerRadius = clamp(slider->getProgress(), 0.1f, 1.0f);
swimmerRadius *= 10.0f;
slider->setLabelString(String("Swimmer Radius: ") + int(swimmerRadius));
swimmerRadius *= 8.0f;
return;
}

if(callbackString == "swimSpeed")
{
swimmerSpeed = clamp(slider->getProgress(), 0.1f, 1.0f);
slider->setLabelString(String("Swimmer Speed: ") + int(swimmerSpeed*10));
swimmerSpeed = 1.0f - swimmerSpeed;
swimmerSpeed = 0.0125f + swimmerSpeed*0.0125f;
return;
}

if(callbackString == "swimHeight")
{
swimmerHeight = clamp(slider->getProgress(), 0.1f, 1.0f);
slider->setLabelString(String("Swimmer Height: ") + swimmerHeight);
return;
}

if(callbackString == "dampFactor")
{
dampFactor = slider->getProgress();
dampFactor = dampFactor/10.0f + 0.85f;
slider->setLabelString(String("Damp Factor: ") + dampFactor);
return;
}
}
}



Aight, off to work on the new stuff
0

Share this post


Link to post
Share on other sites
Looking nice.

Quote:
Original post by JavaCoolDude
would you guys like to see my GUI widgets in a crossplatform library instantly functional with any existent C++ OpenGL code out there?


Of course. Might I suggest releasing it under the MIT license? Here's a link to the lua page describing the license (as well as the license itself). However, if you want something more restrictive (the GPL is an alternative, but be aware of the viral implications of releasing code under the GPL), do whatever you want.

Quote:
What kinda frame rate are you guys getting?

Sorry, I don't currently have access to windows.
0

Share this post


Link to post
Share on other sites
Yes, i would be interested in it. But something i really would like is if you would consider writing an article on how to make a complete GUI system. There are really no tutorials/articles on it on the net. Not any thak i can find anyhow.

Keep up the good work.
0

Share this post


Link to post
Share on other sites
amd64 3500+
1gig ram
radeon x800xl

getting :o 2200fps windowed, 650fps maximised
0

Share this post


Link to post
Share on other sites
Really nice looking gui. Great work. I'm getting between 40 and 60 fps on my gf4go 420.

One notice though, IMO the fades for the check- and radiobuttons are too slow. Perhaps I've just had too many cups of coffee today, tho ;)
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Allmight
Yes, i would be interested in it. But something i really would like is if you would consider writing an article on how to make a complete GUI system. There are really no tutorials/articles on it on the net. Not any thak i can find anyhow.


The book Data Structures for Game Programmers by Ron Penton has a useful GUI class for use with SDL (though the concepts would work outside of SDL). I have mixed feelings about the rest of the book, as most of the book teaches you how to do things that you should be using the c++ standard library for.
0

Share this post


Link to post
Share on other sites
well on my athlon amd 1.8 running at 1.1 128 megs of ram and geforce fx 5200 i got 400-700 fps windowed, 400-500 max
0

Share this post


Link to post
Share on other sites
Quote:
Original post by kusma
Really nice looking gui. Great work. I'm getting between 40 and 60 fps on my gf4go 420.

One notice though, IMO the fades for the check- and radiobuttons are too slow. Perhaps I've just had too many cups of coffee today, tho ;)


Damn it, changing the fading time was supposed to be as simple as adding an (alphaFadeTime = "whatever here") in the setup file...turns out that it's broken.
No worries though, tonight you shall have it fully operational :)

0

Share this post


Link to post
Share on other sites
Looks like a nice project JavaCoolDude, I like the graphics :)

Quote:
Original post by herc
are there any other known opengl-gui's suitable for games out there?


Yep, CEGUI is a nice one that has renderers for DirectX, OpenGL, Ogre, and probably a bunch more by now. It's LGPL too.
0

Share this post


Link to post
Share on other sites
The Graphics are totally custom, you can specify your own by drawing your widgets into a texture and then providing the bounding rectangle in the XML file, check this out:

<TexCoordsDesc xStart = "201" yStart = "2" xEnd = "233" yEnd = "34" type = "SLIDER"/>
<TexCoordsDesc xStart = "167" yStart = "2" xEnd = "199" yEnd = "34" type = "CHECK_BOX"/>
<TexCoordsDesc xStart = "131" yStart = "1" xEnd = "165" yEnd = "35" type = "CHECK_BOX_MARK"/>
<TexCoordsDesc xStart = "1" yStart = "1" xEnd = "65" yEnd = "66" type = "RADIO_BUTTON"/>
<TexCoordsDesc xStart = "66" yStart = "2" xEnd = "130" yEnd = "66" type = "CHECK_RB_MARK"/>

0

Share this post


Link to post
Share on other sites
CPU: Celeron 633mhz
Memory: 256MB SDRAM
GFX: Integrated Graphics (very old)

Windowed: 3 FPS, so it ran a bit slow, but it was still fully functionaly!
Fullscreen: Failed

Great work! It is very impresive on this very old computer I am working on right now.

Quote:
What widgets am I missing in the above demo?


Just some ideas:

Scroll Box
RichEdit Box
Text Labels
Tabbed Displays
ListBox
And probabally a few others, but I'm too lazy to load up C# Windows.Forms to get more ideas [wink]

Great work! All of those great demos [grin]
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 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
    • By afraidofdark
      I have just noticed that, in quake 3 and half - life, dynamic models are effected from light map. For example in dark areas, gun that player holds seems darker. How did they achieve this effect ? I can use image based lighting techniques however (Like placing an environment probe and using it for reflections and ambient lighting), this tech wasn't used in games back then, so there must be a simpler method to do this.
      Here is a link that shows how modern engines does it. Indirect Lighting Cache It would be nice if you know a paper that explains this technique. Can I apply this to quake 3' s light map generator and bsp format ?
  • Popular Now