11 votes

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 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.

10 comments

  1. [4]
    vivarium
    (edited )
    Link
    While I agree with the rest of the responses here that the practical move would be to use Windows... I hecking love rabbit holes like this. It may not be useful to go down this rabbit hole for...
    • Exemplary

    While I agree with the rest of the responses here that the practical move would be to use Windows... I hecking love rabbit holes like this. It may not be useful to go down this rabbit hole for career purposes or whatever, but like... It's fun!!! It's really fun. It's a hobby in and of itself, imo.

    I started poking around by doing a Google search for "graph1.h" "glut". Doing so returns this post, but also a few other results (GitHub repos, StackOverflow questions). They seem to be from people who took your class years ago, given the repeated mentions of CSI and CSII.

    Curiously, there's a copy of graph1.h in one of those GitHub repos, added in 2015. For kicks, I tried diffing it with the copy you shared, and it looks like 5 lines have been added between 2015 and now. I think this supports your theory that this is an in-house hackjob?

    I also tried looking a little more deeply into BMPLoader itself, since I was curious what the original library looked like (and therefore which parts were hacked on):

    • Searching bmploader chris backhouse yields this StackOverflow answer with a link to a now-dead university page. Thankfully, there's the Wayback Machine, and luckily the site has been preserved! (Snapshots: 2007, 2011 -- no difference.) What a lovely little retro site. :3
    • The page has a download link for BMPLoader, but sadly this wasn't preserved. Still, we now know that bmploader.zip existed at one point. Searching for this filename leads to a Japanese blog post with a download link for bmploader.zip... but drat, it's on Google Drive, and sharing is restricted. (EDIT: I asked for and received permission -- it's entirely unrelated to the BMPLoader found in the follow-up below.)
    • There is also a link to this Japanese page cataloging links from fireemblem.net of all things! This page contains a download link to BMPLoader.zip, but of course it's down. However, if we plug this link into Wayback Machine, we get an archived download from 2006 that works! Yet, the only file contained inside is EBOOT.PBP, which seems to be a firmware file for the PSP. Google Translate says "Image/Textbook Reader BMP Loader 0.2 English BMP document reading device for PSP", so it's dubious if this is even related. I almost went down the rabbit hole of unpacking the EBOOT.PBP file, but I didn't get very far before stopping. Still, Playstation Portable modding... neat!
    • I wanted to dig a little more into the Wayback Machine, but while I was looking into this, the site seems to have gone down. Yeesh!

    If I get bored again, I may try poking around some more. Good luck, though! :3

    6 votes
    1. vivarium
      (edited )
      Link Parent
      With BMPLoader found, I wanted to try to find the source for loadPNG next: Found this old course page for your CSI class:...

      With BMPLoader found, I wanted to try to find the source for loadPNG next:

      • Found this old course page for your CSI class: https://faculty.uca.edu/clarenceb/Courses/Fall%202015/CSCI%201470%20Computer%20Science%20I/CSCI_1470_F15_index.htm
      • Downloaded UCA_Graphics.zip from the page and unpacked graphLib2010.lib.
      • Inside were the object files you describe (Debug/), but also a bunch of glut32 dll files and 1.txt and 2.txt?
      • Inside the text files seem to be a log of sorts, containing what appear to be symbols for each obj file? I honed in on the loadPng.obj part of the log, then picked out some distinctive-sounding symbols. Ones that caught my eye were LodePNGState and State@lodepng.
      • I had come across lodepng before in my GitHub searches. Curiously, the typo isn't a typo -- it's the name of the author, Lode Vandevenne. Given the distinctiveness here, I can only assume that's a match?

      This is fine and dandy, but the real trick will be example2.obj. It seems like that's where the meat of your utility functions are located, given:

      1.txt
      Debug\example2.obj    ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z
      Debug\example2.obj    ??$_Debug_pointer@D@std@@YAXPBDPB_WI@Z
      Debug\example2.obj    ??$_Pow_int@N@@YANNH@Z
      Debug\example2.obj    ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z
      Debug\example2.obj    ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z
      Debug\example2.obj    ??0Gout@@QAE@XZ
      Debug\example2.obj    ??0_Sentry_base@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@AAV12@@Z
      Debug\example2.obj    ??0sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@AAV12@@Z
      Debug\example2.obj    ??1EndOfProcess@@QAE@XZ
      Debug\example2.obj    ??1_Sentry_base@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@XZ
      Debug\example2.obj    ??1sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@XZ
      Debug\example2.obj    ??6@YAAAVGout@@AAV0@D@Z
      Debug\example2.obj    ??6@YAAAVGout@@AAV0@H@Z
      Debug\example2.obj    ??6@YAAAVGout@@AAV0@N@Z
      Debug\example2.obj    ??6@YAAAVGout@@AAV0@P6AAAV0@H@Z@Z
      Debug\example2.obj    ??6@YAAAVGout@@AAV0@P6AAAV0@HH@Z@Z
      Debug\example2.obj    ??6@YAAAVGout@@AAV0@P6AAAV0@HHH@Z@Z
      Debug\example2.obj    ??6@YAAAVGout@@AAV0@PAD@Z
      Debug\example2.obj    ??6@YAAAVGout@@AAV0@UGraphColor@@@Z
      Debug\example2.obj    ??6@YAAAVGout@@AAV0@UPoint@@@Z
      Debug\example2.obj    ??6@YAAAVGout@@AAV0@UPrecision@@@Z
      Debug\example2.obj    ??Bsentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QBEPQ_Bool_struct@2@HXZ
      Debug\example2.obj    ??_C@_02DPKJAMEF@?$CFd?$AA@
      Debug\example2.obj    ??_C@_02HAOIJKIC@?$CFc?$AA@
      Debug\example2.obj    ??_C@_02LMMGGCAJ@?3?5?$AA@
      Debug\example2.obj    ??_C@_02NJPGOMH@?$CFf?$AA@
      Debug\example2.obj    ??_C@_05KBEOJPB@?$CFd?4?$CFd?$AA@
      Debug\example2.obj    ??_C@_06KEFCCGGF@Prev?3?5?$AA@
      Debug\example2.obj    ??_C@_06NMKBCHA@_endg_?$AA@
      Debug\example2.obj    ??_C@_07OLGGKKJM@?$CFd?4?$CFd?$CFd?$AA@
      Debug\example2.obj    ??_C@_09CLAONDDD@Error?5is?5?$AA@
      Debug\example2.obj    ??_C@_09GAFANOLF@Current?3?5?$AA@
      Debug\example2.obj    ??_C@_09HOLCPCNH@Refresh?3?5?$AA@
      Debug\example2.obj    ??_C@_09NEOAEOCO@?$CFd?4?$CFd?$CFd?$CFd?$AA@
      Debug\example2.obj    ??_C@_0BA@KAIOPEF@?$CFd?4?$CFd?$CFd?$CFd?$CFd?$CFd?$CFd?$AA@
      Debug\example2.obj    ??_C@_0BD@MMJIMFDE@Program?5Exiting?4?4?4?$AA@
      Debug\example2.obj    ??_C@_0BH@LMOPJDNC@Program?5is?5exiting?4?4?4?4?$AA@
      Debug\example2.obj    ??_C@_0CF@BCEFHFGG@SEVERE?5ERROR?9?5GRAPHICS?5TEXT?5OVER@
      Debug\example2.obj    ??_C@_0CG@JCJNGGCG@All?5Previously?5displayed?5data?5is@
      Debug\example2.obj    ??_C@_0CI@GHPFGGEN@Error?5occurred?5when?5reading?5bitm@
      Debug\example2.obj    ??_C@_0CJ@PPLFFGOE@Press?5Any?5Key?5to?5Close?5Graphics?5@
      Debug\example2.obj    ??_C@_0DB@LLKKJKHJ@?$CB?$CB?$CBSEVER?5ERROR?5?9?5CANNOT?5START?5GR@
      Debug\example2.obj    ??_C@_0DE@CEGFEIMN@Correct?5Problem?5by?5calling?5?$CCclea@
      Debug\example2.obj    ??_C@_0DG@IDOEOHNC@SEVERE?5ERROR?3?5ALL?5AVAILABLE?5GRAP@
      Debug\example2.obj    ??_C@_0DK@CKCEEDPO@Please?5Reinstall?5Graphics?5Librar@
      Debug\example2.obj    ??_C@_0M@KFHEJLPD@?$CFd?4?$CFd?$CFd?$CFd?$CFd?$AA@
      Debug\example2.obj    ??_C@_0N@KAAFFJFH@C?$CL?$CL?5Graphics?$AA@
      Debug\example2.obj    ??_C@_0O@GHFLHHGO@?$CFd?4?$CFd?$CFd?$CFd?$CFd?$CFd?$AA@
      Debug\example2.obj    ??_C@_0P@EMMNNIFA@decoder?5error?5?$AA@
      Debug\example2.obj    ?GRAPH_SS@@YAXXZ
      Debug\example2.obj    ?_Inside@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE_NPBD@Z
      Debug\example2.obj    ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z
      Debug\example2.obj    ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBD@Z
      Debug\example2.obj    ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBDI@Z
      Debug\example2.obj    ?bmp@@3VBMPClass@@A
      Debug\example2.obj    ?clearGraphics@@YAXXZ
      Debug\example2.obj    ?clearText@@YAXXZ
      Debug\example2.obj    ?cos@@YAMM@Z
      Debug\example2.obj    ?display1@@YGKPAX@Z
      Debug\example2.obj    ?display@@YAXXZ
      Debug\example2.obj    ?displayBMP@@YAHPADHH@Z
      Debug\example2.obj    ?displayGraphics@@YAXXZ
      Debug\example2.obj    ?displayPNG@@YAHPADHH@Z
      Debug\example2.obj    ?displayText@@YAHPADHHHHH@Z
      Debug\example2.obj    ?down@@YA_NXZ
      Debug\example2.obj    ?down_v@@3_NA
      Debug\example2.obj    ?drawCircle@@YAHHHH@Z
      Debug\example2.obj    ?drawLine@@YAHHHHHH@Z
      Debug\example2.obj    ?drawMyCircle@@YAXHHHH@Z
      Debug\example2.obj    ?drawPoint@@YAHHH@Z
      Debug\example2.obj    ?drawRect@@YAHHHHH@Z
      Debug\example2.obj    ?eop@@3VEndOfProcess@@A
      Debug\example2.obj    ?font@@3HA
      Debug\example2.obj    ?gbuffer@@3PADA
      Debug\example2.obj    ?getB@Gout@@QAEHXZ
      Debug\example2.obj    ?getG@Gout@@QAEHXZ
      Debug\example2.obj    ?getPos@@YAXHQAUPoint@@AAH@Z
      Debug\example2.obj    ?getPrecision@Gout@@QAEHXZ
      Debug\example2.obj    ?getPrecisionFlag@Gout@@QAE_NXZ
      Debug\example2.obj    ?getR@Gout@@QAEHXZ
      Debug\example2.obj    ?getX@Gout@@QAEHXZ
      Debug\example2.obj    ?getY@Gout@@QAEHXZ
      Debug\example2.obj    ?gout@@3VGout@@A
      Debug\example2.obj    ?graph_objects@@3PAUGraphObject@@A
      Debug\example2.obj    ?handle@@3PAXA
      Debug\example2.obj    ?init@@YAXPAD@Z
      Debug\example2.obj    ?iteration@@3HA
      Debug\example2.obj    ?left@@YA_NXZ
      Debug\example2.obj    ?leftMouse@@YA_NAAH0@Z
      Debug\example2.obj    ?left_mouse@@3_NA
      Debug\example2.obj    ?left_v@@3_NA
      Debug\example2.obj    ?length@?$char_traits@D@std@@SAIPBD@Z
      Debug\example2.obj    ?m_x@@3HA
      Debug\example2.obj    ?m_y@@3HA
      Debug\example2.obj    ?md_x@@3HA
      Debug\example2.obj    ?md_y@@3HA
      Debug\example2.obj    ?middleMouse@@YA_NAAH0@Z
      Debug\example2.obj    ?middle_mouse@@3_NA
      Debug\example2.obj    ?mouseDragged@@YA_NAAH0@Z
      Debug\example2.obj    ?mouse_dragged@@3_NA
      Debug\example2.obj    ?moveObject@@YAXHHH@Z
      Debug\example2.obj    ?no_objects@@3HA
      Debug\example2.obj    ?pow@@YANNH@Z
      Debug\example2.obj    ?processMouse@@YAXHHHH@Z
      Debug\example2.obj    ?processMouseDragged@@YAXHH@Z
      Debug\example2.obj    ?processSpecialKeys@@YAXHHH@Z
      Debug\example2.obj    ?redisplay@@3HA
      Debug\example2.obj    ?refresh_time@@3HA
      Debug\example2.obj    ?removeObject@@YAXH@Z
      Debug\example2.obj    ?replaceObject@@YAXHH@Z
      Debug\example2.obj    ?reshape@@YAXHH@Z
      Debug\example2.obj    ?right@@YA_NXZ
      Debug\example2.obj    ?rightMouse@@YA_NAAH0@Z
      Debug\example2.obj    ?right_mouse@@3_NA
      Debug\example2.obj    ?right_v@@3_NA
      Debug\example2.obj    ?setB@Gout@@QAEXH@Z
      Debug\example2.obj    ?setColor@@YA?AUGraphColor@@HHH@Z
      Debug\example2.obj    ?setColor@@YAXHHHH@Z
      Debug\example2.obj    ?setG@Gout@@QAEXH@Z
      Debug\example2.obj    ?setPos@@YA?AUPoint@@HH@Z
      Debug\example2.obj    ?setPrecision@@YA?AUPrecision@@H@Z
      Debug\example2.obj    ?setPrecision@Gout@@QAEXH@Z
      Debug\example2.obj    ?setPrecisionFlag@Gout@@QAEX_N@Z
      Debug\example2.obj    ?setR@Gout@@QAEXH@Z
      Debug\example2.obj    ?setX@Gout@@QAEXH@Z
      Debug\example2.obj    ?setY@Gout@@QAEXH@Z
      Debug\example2.obj    ?sin@@YAMM@Z
      Debug\example2.obj    ?skip_timer@@3HA
      Debug\example2.obj    ?stmt_count@@3HA
      Debug\example2.obj    ?timerColor@@YAXH@Z
      Debug\example2.obj    ?up@@YA_NXZ
      Debug\example2.obj    ?up_v@@3_NA
      Debug\example2.obj    ?win_no@@3HA
      Debug\example2.obj    __real@3f800000
      Debug\example2.obj    __real@400921fb4d12d84a
      Debug\example2.obj    __real@4024000000000000
      Debug\example2.obj    __real@4070000000000000
      Debug\example2.obj    __real@bf800000
      Debug\example2.obj    __real@bff0000000000000
      Debug\example2.obj    _cosf
      Debug\example2.obj    _sinf
      
      3 votes
    2. vivarium
      (edited )
      Link Parent
      Ah, wait. GitHub code search is as magical as ever: opengl playground containing all the relevant BMPLoader files. (header diff)

      Ah, wait. GitHub code search is as magical as ever: opengl playground containing all the relevant BMPLoader files. (header diff)

      2 votes
    3. Dotz0cat
      Link Parent
      Yeah, its for the love of rabbit holes that I posted this. Another pair of eyes that has not been looking at this for a week, can see more than one that has.

      Yeah, its for the love of rabbit holes that I posted this. Another pair of eyes that has not been looking at this for a week, can see more than one that has.

      2 votes
  2. kacey
    Link
    Former weird CS undergraduate here — seconding the proposal to just use whatever the course suggests. However! Most of the interesting stuff I’ve learned — the bits which let me contribute outside...

    Former weird CS undergraduate here — seconding the proposal to just use whatever the course suggests.

    However! Most of the interesting stuff I’ve learned — the bits which let me contribute outside my “area of expertise” — came from being stubborn about problems like yours and teaching myself a tonne from scratch. Here are some thoughts that past-kacey probably would have pursued, beyond trying to find the source code (which seems like your current tack):

    • write a bunch of makefiles to invoke a wine-msvc tool chain to do the build, then use winedbg as my debugger.
    • decompile the pre compiled binary, port it, then recompile. The NSA released a cool free tool called ghidra which should help.
    • port my tool chain over to windows on msys2.

    Zooming out: most of my coworkers are the punch in/punch out type, and they absolutely would have broken down and done whatever the prof asked. They are paid embarassing amounts of money, and lead rich and interesting lives outside of work. If the goal is to get a degree, get a job, and crank out code, being stubborn hasn’t seemed useful — in my experience and section of the industry. Could be different for you.

    That said, if you enjoy this stuff, imo there’s nothing quite like setting up your own challenges and accomplishing something people have told you is impossible or foolhardy.

    8 votes
  3. raze2012
    Link
    It's awful. That library was antiquated when I was in school over a decade ago. Why are professors still using that now 25 yo library when GLFW is more functional, more actively developed, and an...

    They have us using glut, which is not bad in it self.

    It's awful. That library was antiquated when I was in school over a decade ago. Why are professors still using that now 25 yo library when GLFW is more functional, more actively developed, and an arguably easier API? That library stopped being updated nearly a decade before OpenGL 3.

    From the looks of graph1.h, it looks like you are using OpenGL2 to draw stuff, so that may unfortunately answer some questions... I know this isn't explicitly an OpenGL course, but "Computer Science 2", so I'll withhold my rant there.

    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'd normally applaud this. However, we are talking OpenGL, and the answer to "how far I can go" tends to be "to the very abyss of the GPU". My answer to this would be to simply ask the professor about looking at and/or compiling an implementation for Linux, but you seem to have already done that to TBD results.

    While I agree, at the same time "Just use windows" is a horrible, dismissive explanation, especially for a university student. So let me explain a bit about the tools you are using and why you may end up spending more time trying to make this work (assuming you never get the source code for this wrapper) than you would on the entire course work proper:

    1. understand the goals of your tools. To make this verrrrrrry short, OpenGL's goal is to provide an interface for drawing to the screen using your GPU. And nothing else. Every and anything else has to to be made around it; your window (especially because windowing systems aren't cross compatible, as you may see here), how you load textures, manually requesting every single OpenGL command your program needs and graphics card supports, etc.
      1.1 With that above mentality in mind, this is where GLUT comes in. Among a few other functions, the goal of GLUT to provide some (hopefully) cross-platform boilerplate and actually draw a window. Which is important to help learn concepts (or in industry, make many products), but the actual work of creating such a windowing system is not fairly productive. You will simply be making separately implementing code for each platform based on X11/Windows/Mac interfaces which leads to a blank window. This takes a lot of time with not much to show for it if you wanted to make this yourself, a common theme of graphics programming APIs (I assure you, if you want to do this on modern APIs like Vulkan/Metal/X12, it gets worse)
      1.2 Same with BMPLoader, and then your professor's wrapper. I can't even find BMPLoader, but the name implies that the goal is to read an ancient image format into an array (buffer) of colors, and then the wrapper can use that information to store those color buffers into a texture for OpenGL. Again, very boilerplate stuff that doesn't necessarily teach you how to draw on screen. It should be noted that the BMP format was made for windows, so that may be more friction to encounter if you wanted to diverge into Linux. learning the BMP format and how to read it may not be the best of your time. Nor would solving those bugs even if everything compiled.
    2. Now that you understand the tools, you should understand the value of these tools and investing in them. And the unfortunate answer is "not that much". Even if you were in a more advanced graphics programmer class and you wanted to go above and beyond (with the professor's permission of course), you'd probably end up replacing all the above with modern OpenGL implementation (or maybe even Vulkan if you dare), GLFW for windows, and stbImage to load images. The work to render a texture or draw 2D shapes would be a lot more involved (OpenGL 3/4 has a LOT more boilerplate since it was made for 3D rendering), but it would still be very doable. Not much work for someone who's worked in OpenGL, but it would be quite an endeavor for a newcomer. One I feel every graphics programmer should try themselves at some point, but that of course leads to the last question
    3. Answer this question: "What is the problem I'm trying to solve?". And while I spent all this time talking about the mindset of a graphics programmer... you don't sound like you're in a graphics programming course right now (for the love of God I hope not, not with those tools and implied tools...). Not only will diving off into the deep end of this rabbit hole be unproductive to the goals of your course, it may also be a bit out of your element. That presents situations to grow as a programmer/engineer, but is this the way you want to grow? fixing ancient frameworks made in a bygone era? There are certainly careers for that, but it may not be something to aim for early in your career.

    Anyways, all that was a very blow-hardy way to say "use Windows", but if you went so far as to ask on Tildes about this, I may as well give a similar mind dump on the why's behind those words.

    6 votes
  4. [4]
    gadling
    Link
    Can you use it on Linux via Wine?

    Can you use it on Linux via Wine?

    4 votes
    1. [3]
      Dotz0cat
      Link Parent
      I wish I could, but the main cross compiler to make the windows binaries (mingw-w64) fails to link. It throws an error about “could not find definition for function()”

      I wish I could, but the main cross compiler to make the windows binaries (mingw-w64) fails to link. It throws an error about “could not find definition for function()”

      2 votes
      1. [2]
        kacey
        Link Parent
        I’m not the person who asked, but I think they were suggesting using the windows tool chain in wine? Apparently people have msvc running in wine, at least.

        I’m not the person who asked, but I think they were suggesting using the windows tool chain in wine? Apparently people have msvc running in wine, at least.

        5 votes
        1. Dotz0cat
          Link Parent
          This is what ended up working so far. I used wine-msvc. On their github page they mentioned using it natively with clang, so I set it up with clang in a makefile.

          This is what ended up working so far. I used wine-msvc. On their github page they mentioned using it natively with clang, so I set it up with clang in a makefile.

          2 votes