• Activity
  • Votes
  • Comments
  • New
  • All activity
  • Showing only topics with the tag "graphics". Back to normal view
    1. PySide vs .NET WinForms for a Desktop GUI App in 2023?

      Hello Folks, For an upcoming side project - a Desktop GUI app, open source, Apache 2.0 licensed, I'm slightly confused regarding what technology to use. Skills wise, C#/WinForms should be my...

      Hello Folks,

      For an upcoming side project - a Desktop GUI app, open source, Apache 2.0 licensed, I'm slightly confused regarding what technology to use.

      Skills wise, C#/WinForms should be my natural choice as that was the primary technology I had worked on before losing employment at my former company few years back and getting into freelancing. But post my freelance experience, I taught myself things like open source and Python as it came with the territory, and now PySide2 is also a running candidate in this race.

      The goal here is to be as much ubiquitous as possible - that my app should be easy to just "download, extract and run" by as many people as possible. A couple decades ago, a .NET GUI library targeting Microsoft Windows platform would have been the clear choice here as most people used Windows OS and targeting that platform meant being ubiquitous.

      But over the last few years, I've observed that Windows OS has been continuously losing its market share to Linux Distros and Mac OSX, mostly due to some incorrect decisions and strategic blunders by the former than some ground breaking or revolutionary innovation on part of the latter. This means .NET or WinForms is no longer the ideal choice today if you want to be cross-platform and ubiquitous.

      This lead my research to some other toolkits like the Java Swing library, for example. It's old but classic, not a bad choice at all in this case, platform independence is Java's biggest selling point. However, the app I'm making is non-trivial and slightly performance intensive, and Swing GUIs are known to be sluggish on PCs unless you ensure a good supply of RAM by tweaking the JVM settings. I'm also not very experienced in Java to be able to handle those situations in case they arise.

      I also considered Lazarus IDE/Object Pascal, it is also not a bad choice. It is open source, used as the primary course language across many Universities in Europe and most importantly, still maintained and developed. But guess I will have to teach myself a whole new paradigm along with a programming language in case I go this route.

      Finally, Python is something I've almost settled on for this project. It's a language that I'm very fond of and it has helped me survive through the tough times in the freelance market. It also has a vibrant ecosystem and rich repository of user contributed packages at PyPI.

      Now, I've worked on the default Tkinter library in past but somehow felt that it's quite limited in terms of making the GUI more flexible and "tweakable", especially a non-trivial one having several container widgets, syntax editors, menus and drop-downs, trees and list views, etc. PySide2 is, from what I understand, a better choice in this regard as it is comprehensive and based on the time-tested Qt interface. It is not only very easy to code and maintain but also very easy to port across various platforms.

      What do you think? In which direction should I go here?

      18 votes
    2. What game, in your opinion, has the best graphics?

      Completely ignoring gameplay, which game do you think has the most amazing graphics? Which game do you look at and it makes you question how far technology has come? Or maybe which game has such...

      Completely ignoring gameplay, which game do you think has the most amazing graphics? Which game do you look at and it makes you question how far technology has come? Or maybe which game has such effective art direction it completely sucks you in?

      For me, it's Horizon Forbidden West. I just went back to the DLC after taking a break from it. I forgot just how good it looks! I swear it looks like every grain of sand is modeled, and the character models are insane.

      20 votes
    3. Help with finding out more about an obsure c++ graphics library

      I recently started classes again a little over a week ago. One of the classes I am taking is Computer science 2. One of the things it includes is openGL based graphics programming. They have us...

      I recently started classes again a little over a week ago. One of the classes I am taking is Computer science 2. One of the things it includes is openGL based graphics programming. They have us using glut, which is not bad in it self. However what they do is provide us a wrapper library for glut. In the form of a header named "graph1.h" and a precompiled library. Which goes by various names, such as "graphLib1.lib", "graphLib2010.lib", "graphLib2022.lib", "graphicLib2015.lib", etc. It's provided in the form of Windows flavored x86, Macos flavored x86_64 and arm. However, no forms for Linux. While I have been using Windows and VS Studio for classes so far, I strongly prefer my current Linux based tool chain. (text editor, build system, debugger). I have tried cross compiling with mingw-w64, but it fails when I try to link it. I would very much like to use it natively. To do this I would need either the library or the sources to compile it myself. That is what I would really like to find.

      Here is more about the library it self. It is based off of BMPLoader, a small library for loading bitmaps as openGL textures. It also inherits its license from BMPLoader too, because it is a derivative of BMPLoader. (GPLv2; and has been distributed). When you unpack the library there are 3 object files, BMPLoader.o, loadPNG.o, and example2.o. (.o/.obj) I have found traces of it online, however they all link back to my University, University of Central Arkansas. I have also found evidence of it being used at GSU too, but it is from one of the professors that is now here at UCA. (They even provided a pdf on using it, I hashed them and they were the same). Here is a copy of the header graph1.h.

      graph1.h
      /*BMPLoader - loads Microsoft .bmp format
          Copyright (C) 2006  Chris Backhouse
      
          This program is free software; you can redistribute it and/or modify
          it under the terms of the GNU General Public License as published by
          the Free Software Foundation; either version 2 of the License, or
          (at your option) any later version.
      
          This program is distributed in the hope that it will be useful,
          but WITHOUT ANY WARRANTY; without even the implied warranty of
          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
          GNU General Public License for more details.
      
          You should have received a copy of the GNU General Public License along
          with this program; if not, write to the Free Software Foundation, Inc.,
          51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      
      
        cjbackhouse@hotmail.com 		www.backhouse.tk
        
        I would appreciate it if anyone using this in something cool would tell me
        so I can see where it ends up.
      
        Takes a filename, returns an array of RGB pixel data
        Loads:
        24bit bitmaps
        256 colour bitmaps
        16 colour bitmaps
        2 colour bitmaps  (Thanks to Charles Rabier)
      
        This code is designed for use in openGL programs, so bitmaps not correctly padded will not
        load properly, I believe this only applies to: 
        256cols if width is not a multiple of 4
        16cols if width is not a multiple of 8
        2cols if width is not a multiple of 32
      
        Sample code:
      
      	BMPClass bmp;
      	BMPLoad(fname,bmp);
      	glTexImage2D(GL_TEXTURE_2D,0,3,bmp.width,bmp.height,0,GL_RGB,GL_UNSIGNED_BYTE,bmp.bytes);
      */
      #include <windows.h>
      #include <gl/glut.h>
      #include <iostream>
      #include <cstring>
      #include <string>
      #define endg "_endg_"
      
      
      #ifndef BMPLOADER_H
      #define BMPLOADER_H
      
      #include <iostream>
      #include <cstring>
      
      using namespace std;
      
      typedef unsigned char BYTE;
      
      class BMPClass
      {
      public:
      	BMPClass();
      	~BMPClass();
      	BYTE& pixel(int x,int y,int c);
      	void allocateMem();
      	int width,height;
      	BYTE* bytes;			//OpenGL formatted pixels
      };
      
      #define BMPError char
      #define BMPNOTABITMAP 'b'	//Possible error flags
      #define BMPNOOPEN 'o'
      #define BMPFILEERROR 'f'
      #define BMPBADINT 'i'
      #define BMPNOERROR '\0'
      #define BMPUNKNOWNFORMAT 'u'
      
      //Loads the bmp in fname, and puts the data in bmp
      BMPError BMPLoad(string fname,BMPClass& bmp);
      
      //Translates my error codes into English	
      std::string TranslateBMPError(BMPError err);	
      
      //Load and select in OpenGL
      BMPError BMPLoadGL(string fname);
      
      struct Precision
      {
        int precision;
        bool precisionFlag;
      };
      
      struct GraphColor
      {
        int r;
        int g;
        int b;
      };
      
      class Gout
      {
        private:
          int x;
          int y;
          int r;
          int g;
          int b;
          int precision;
          bool precisionFlag;
      
      
        public:
          Gout() { r= 0; g=255; b= 0; precisionFlag = false; };
          void setX(int x) { this->x = x;}
          void setY(int y) { this->y = y;}
          int getX() { return x;}
          int getY() { return y;}
          void setR(int r) {this->r = r;}
          void setG(int g) {this->g = g;}
          void setB(int b) {this->b = b;}
          int getR() {return r;}
          int getG() { return g;}
          int getB() {return b;}
          void setPrecisionFlag(bool flag) { precisionFlag = flag;}
          bool getPrecisionFlag() {return precisionFlag;}
          void setPrecision(int precision) {this->precision = precision;}
          int  getPrecision() {return precision;}
          friend Gout& operator<<(Gout& g, int int_val);
          friend Gout& operator<<(Gout& g, double int_val);
          friend Gout& operator<<(Gout& g, char* char_val);
          friend Gout& operator<<(Gout& g, string string_val);
         
      };
      
      extern Gout gout;
      
      struct Point
      {
        int x;
        int y;
      };
      
      
      
      struct GraphObject
      {
        char* str;
        int id;
        int no_points;
        Point* points;
        double* colors;
        int radius;
        int no_objects;
        BMPClass* bmp;
        int remove;
        int width;
        int height;
        int del;
        BYTE* bytes; //PNG BYTES
      };
      
      void reshape(int w, int h);
      void display(void);
      void init(char* title);
      int drawPoint(int x, int y);
      int drawCircle(int radius, int x, int y);
      void drawMyCircle( int Radius, int numPoints, int x, int y );
      int drawLine(int x1, int y1, int x2, int y2, int width);
      int drawRect(int x1, int y1, int width, int height);
      void displayGraphics();
      int displayBMP(char* fn,int x, int y);
      int displayBMP(string fn, int x, int y);
      int displayPNG(string fn, int x, int y);
      int displayPNG(char* fn, int x, int y);
      int displayText(char* str, int x, int y, int r, int g, int b);
      void clearGraphics();
      void setColor(int obj_no, int r, int g, int b);
      GraphColor setColor(int r, int g, int b);
      void timerColor(int value);
      void moveObject(int obj_no, int x, int y);
      void processSpecialKeys(int key, int x, int y);
      DWORD WINAPI display1(LPVOID lpParam);
      void processMouse(int button, int state, int x, int y);
      void removeObject(int id);
      void clearText();
      void GRAPH_SS();
      bool up();
      bool down();
      bool left();
      bool right();
      bool leftMouse(int&x, int&y);
      bool rightMouse(int&x, int&y);
      bool middleMouse(int&x, int&y);
      Gout& operator<<(Gout& g, int int_val);
      Gout& operator<<(Gout& g, double int_val);
      Gout& operator<<(Gout& g, char* char_val);
      Gout& operator<<(Gout& g, char char_val);
      Gout& operator<<(Gout& g, Gout&(*pt2Func)(int x, int y));
      Gout& operator<<(Gout& g, Gout&(*pt2Func)(int r, int g, int b));
      Gout& operator<<(Gout& g, Point a);
      Gout& operator<<(Gout& g, GraphColor gc);
      Gout& operator<<(Gout& g, Precision p);
      Gout& operator<<(Gout& g, Gout&(*pt2Func)(int precision));
      Precision setPrecision(int precision);
      Point setPos(int x, int y);
      void getPos(int obj_no, Point points[], int& no_points);
      bool mouseDragged(int& x, int& y);
      void processMouseDragged(int x, int y);
      void replaceObject(int orig_obj, int new_obj);
      void closeGraphics();
      
      #endif
      

      Right now I am of the opinion that it is a in-house "hackjob". That is how it feels with the GPLed BMPLoader glued together with other graphics functions. In an attempt to not have to use new literature or new style libraries with the new ".net 2008" style ide, as they were likely transitioning out of a codewarrior environment, and before that a borland environment.

      So far, I have asked our computer science club about it. The main thing I was told was that the professor just wants us to use windows. That I can understand, but I still want to see how far I can go. I have also tried sending an email about it to the professor, but all I got sent was a link to the glut downloads. I did reply back asking about the graphlib sources too, but I haven't heard anything back yet. I don't want to push too hard, I still have a whole semester ahead of me. So now I am asking here on tildes. I understand if nothing can be found, but at least information and experiences can be collected.

      11 votes
    4. How would you write a GUI? Seeking opinions, recommendations, and what to avoid.

      Hi all. I am asking this open-ended question (bottom of this post) because I am considering making contributions to an open-source project that would directly benefit me and other users. Some...

      Hi all. I am asking this open-ended question (bottom of this post) because I am considering making contributions to an open-source project that would directly benefit me and other users.

      Some background:

      I have worked with an engineering simulation software called Ansys MAPDL basically everyday for the last 4 years, in both an academic and a professional capacity. It's not necessarily relevant whether you are familiar to that program to participate in this discussion. The relevant thing is that the GUI for MAPDL is written in Tcl/Tk and I don’t imagine it is going to be modernized (because of more modern, but distinctly different, replacements). This is a screenshot of the GUI for reference.

      Why do people put up with such an old interface?

      The power of the program is not its GUI, but the scripting language that can be run to setup and solve simulations. The program name is really the scripting language name, Ansys Parametric Design Language (APDL). It's somewhat like Matlab. The program also offers an enormous amount of control when compared to the more modern GUI that's been released, since the modern GUI holds a totally different philosophy.

      The older GUI is really helpful in certain circumstances because it will spit out a file containing commands that were used in the session. This is a great demonstration of how to run a command or use a setting/config command, but a lot of newer features are buried in the documentation and aren't available in the older GUI.

      My coding experience

      I know the MAPDL language very intimately, but my experience beyond it is limited to some Perl scripting, and a bit of Python exposure.

      Motivation

      Open-Source Ansys API

      Recently, Ansys started supporting an open-source Python project called PyAnsys. MAPDL is otherwise fully closed source, and this is really the only public-facing API. PyAnsys has basically converted a lot of MAPDL script commands to a pythonic format, hence Python can now be used to interact with MAPDL. This is great for several reasons, but is limited regarding interactivity. Interacting with MAPDL via Python is basically happening in a fancy console via Jupyter notebook or IDE like Spyder. Certain commands will bring up Python-based graphics displays of solid models and results plots, but there isn't a dedicated GUI open all the time.

      The Question(s)

      My question is whether it is feasible to write a frontend GUI to a bunch of python commands. If you were going to do it, how would you do it? What might you write it with? Would you even do it? Is this a stupid endeavor?

      7 votes
    5. SCOPETREX vector gaming on your oscilloscope!

      @tubetimeus: announcing the SCOPETREX -- the vector gaming console for your oscilloscope or XY monitor! ever wanted to buy a Vectrex, but can't afford the high prices on auction sites? well now you can build your own! full design files at https://t.co/hHAbFwwePE

      4 votes