• Advertisement
Sign in to follow this  

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

This topic is 4224 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
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

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]

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

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.

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

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

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 :-)

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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
hey what about some threedimensional panels?

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.

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.

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

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.

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.

Share this post


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

getting :o 2200fps windowed, 650fps maximised

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 ;)

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.

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

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 :)

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.

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"/>

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]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
  • Advertisement
  • Popular Now

  • Advertisement
  • Similar Content

    • By khawk
      We've just released all of the source code for the NeHe OpenGL lessons on our Github page at https://github.com/gamedev-net/nehe-opengl. code - 43 total platforms, configurations, and languages are included.
      Now operated by GameDev.net, NeHe is located at http://nehe.gamedev.net where it has been a valuable resource for developers wanting to learn OpenGL and graphics programming.

      View full story
    • By TheChubu
      The Khronos™ Group, an open consortium of leading hardware and software companies, announces from the SIGGRAPH 2017 Conference the immediate public availability of the OpenGL® 4.6 specification. OpenGL 4.6 integrates the functionality of numerous ARB and EXT extensions created by Khronos members AMD, Intel, and NVIDIA into core, including the capability to ingest SPIR-V™ shaders.
      SPIR-V is a Khronos-defined standard intermediate language for parallel compute and graphics, which enables content creators to simplify their shader authoring and management pipelines while providing significant source shading language flexibility. OpenGL 4.6 adds support for ingesting SPIR-V shaders to the core specification, guaranteeing that SPIR-V shaders will be widely supported by OpenGL implementations.
      OpenGL 4.6 adds the functionality of these ARB extensions to OpenGL’s core specification:
      GL_ARB_gl_spirv and GL_ARB_spirv_extensions to standardize SPIR-V support for OpenGL GL_ARB_indirect_parameters and GL_ARB_shader_draw_parameters for reducing the CPU overhead associated with rendering batches of geometry GL_ARB_pipeline_statistics_query and GL_ARB_transform_feedback_overflow_querystandardize OpenGL support for features available in Direct3D GL_ARB_texture_filter_anisotropic (based on GL_EXT_texture_filter_anisotropic) brings previously IP encumbered functionality into OpenGL to improve the visual quality of textured scenes GL_ARB_polygon_offset_clamp (based on GL_EXT_polygon_offset_clamp) suppresses a common visual artifact known as a “light leak” associated with rendering shadows GL_ARB_shader_atomic_counter_ops and GL_ARB_shader_group_vote add shader intrinsics supported by all desktop vendors to improve functionality and performance GL_KHR_no_error reduces driver overhead by allowing the application to indicate that it expects error-free operation so errors need not be generated In addition to the above features being added to OpenGL 4.6, the following are being released as extensions:
      GL_KHR_parallel_shader_compile allows applications to launch multiple shader compile threads to improve shader compile throughput WGL_ARB_create_context_no_error and GXL_ARB_create_context_no_error allow no error contexts to be created with WGL or GLX that support the GL_KHR_no_error extension “I’m proud to announce OpenGL 4.6 as the most feature-rich version of OpenGL yet. We've brought together the most popular, widely-supported extensions into a new core specification to give OpenGL developers and end users an improved baseline feature set. This includes resolving previous intellectual property roadblocks to bringing anisotropic texture filtering and polygon offset clamping into the core specification to enable widespread implementation and usage,” said Piers Daniell, chair of the OpenGL Working Group at Khronos. “The OpenGL working group will continue to respond to market needs and work with GPU vendors to ensure OpenGL remains a viable and evolving graphics API for all its customers and users across many vital industries.“
      The OpenGL 4.6 specification can be found at https://khronos.org/registry/OpenGL/index_gl.php. The GLSL to SPIR-V compiler glslang has been updated with GLSL 4.60 support, and can be found at https://github.com/KhronosGroup/glslang.
      Sophisticated graphics applications will also benefit from a set of newly released extensions for both OpenGL and OpenGL ES to enable interoperability with Vulkan and Direct3D. These extensions are named:
      GL_EXT_memory_object GL_EXT_memory_object_fd GL_EXT_memory_object_win32 GL_EXT_semaphore GL_EXT_semaphore_fd GL_EXT_semaphore_win32 GL_EXT_win32_keyed_mutex They can be found at: https://khronos.org/registry/OpenGL/index_gl.php
      Industry Support for OpenGL 4.6
      “With OpenGL 4.6 our customers have an improved set of core features available on our full range of OpenGL 4.x capable GPUs. These features provide improved rendering quality, performance and functionality. As the graphics industry’s most popular API, we fully support OpenGL and will continue to work closely with the Khronos Group on the development of new OpenGL specifications and extensions for our customers. NVIDIA has released beta OpenGL 4.6 drivers today at https://developer.nvidia.com/opengl-driver so developers can use these new features right away,” said Bob Pette, vice president, Professional Graphics at NVIDIA.
      "OpenGL 4.6 will be the first OpenGL release where conformant open source implementations based on the Mesa project will be deliverable in a reasonable timeframe after release. The open sourcing of the OpenGL conformance test suite and ongoing work between Khronos and X.org will also allow for non-vendor led open source implementations to achieve conformance in the near future," said David Airlie, senior principal engineer at Red Hat, and developer on Mesa/X.org projects.

      View full story
    • By _OskaR
      Hi,
      I have an OpenGL application but without possibility to wite own shaders.
      I need to perform small VS modification - is possible to do it in an alternative way? Do we have apps or driver modifictions which will catch the shader sent to GPU and override it?
    • By xhcao
      Does sync be needed to read texture content after access texture image in compute shader?
      My simple code is as below,
      glUseProgram(program.get());
      glBindImageTexture(0, texture[0], 0, GL_FALSE, 3, GL_READ_ONLY, GL_R32UI);
      glBindImageTexture(1, texture[1], 0, GL_FALSE, 4, GL_WRITE_ONLY, GL_R32UI);
      glDispatchCompute(1, 1, 1);
      // Does sync be needed here?
      glUseProgram(0);
      glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer);
      glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                                     GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texture[1], 0);
      glReadPixels(0, 0, kWidth, kHeight, GL_RED_INTEGER, GL_UNSIGNED_INT, outputValues);
       
      Compute shader is very simple, imageLoad content from texture[0], and imageStore content to texture[1]. Does need to sync after dispatchCompute?
    • By Jonathan2006
      My question: is it possible to transform multiple angular velocities so that they can be reinserted as one? My research is below:
      // This works quat quaternion1 = GEQuaternionFromAngleRadians(angleRadiansVector1); quat quaternion2 = GEMultiplyQuaternions(quaternion1, GEQuaternionFromAngleRadians(angleRadiansVector2)); quat quaternion3 = GEMultiplyQuaternions(quaternion2, GEQuaternionFromAngleRadians(angleRadiansVector3)); glMultMatrixf(GEMat4FromQuaternion(quaternion3).array); // The first two work fine but not the third. Why? quat quaternion1 = GEQuaternionFromAngleRadians(angleRadiansVector1); vec3 vector1 = GETransformQuaternionAndVector(quaternion1, angularVelocity1); quat quaternion2 = GEQuaternionFromAngleRadians(angleRadiansVector2); vec3 vector2 = GETransformQuaternionAndVector(quaternion2, angularVelocity2); // This doesn't work //quat quaternion3 = GEQuaternionFromAngleRadians(angleRadiansVector3); //vec3 vector3 = GETransformQuaternionAndVector(quaternion3, angularVelocity3); vec3 angleVelocity = GEAddVectors(vector1, vector2); // Does not work: vec3 angleVelocity = GEAddVectors(vector1, GEAddVectors(vector2, vector3)); static vec3 angleRadiansVector; vec3 angularAcceleration = GESetVector(0.0, 0.0, 0.0); // Sending it through one angular velocity later in my motion engine angleVelocity = GEAddVectors(angleVelocity, GEMultiplyVectorAndScalar(angularAcceleration, timeStep)); angleRadiansVector = GEAddVectors(angleRadiansVector, GEMultiplyVectorAndScalar(angleVelocity, timeStep)); glMultMatrixf(GEMat4FromEulerAngle(angleRadiansVector).array); Also how do I combine multiple angularAcceleration variables? Is there an easier way to transform the angular values?
  • Advertisement