Friday, February 5, 2021

OPENGL from Microsoft and GLUT configuration Microsoft Visual Studio 2017

OPENGL from Microsoft and GLUT configuration Microsoft Visual Studio 2017

    Common Sense links

  1. A Python Developer's Guide to Powershell
  2. Python is a great scripting language - it’s available by default on Linux and Mac and so it’s easy to quickly write a short script that runs on many systems. However, this isn’t the case on Windows. You need to install Python or wrap your application to distribute it. Sometimes this is inconvenient, especially if you want to do something simple or deal directly with Windows specific functions, so we need an alternative. This is where PowerShell comes in.

  3. A Guide to Compiling Programs on Windows
  4. Compiling a program on a UNIX or UNIX-like system is often as simple as running cc main.c and having your executable ready to go. Things are not so simple on Windows. When it comes to compilation and running your code, Windows follows the mantra of make simple things difficult and make hard things possible. In this post, I will attempt to save you and my future self much head-scratching over seemingly simple tasks.

  5. Windows Data Types
  6. The data types supported by Windows are used to define function return values, function and message parameters, and structure members. They define the size and meaning of these elements. For more information about the underlying C/C++ data types, see Data Type Ranges.

    The following table contains the following types: character, integer, Boolean, pointer, and handle. The character, integer, and Boolean types are common to most C compilers. Most of the pointer-type names begin with a prefix of P or LP. Handles refer to a resource that has been loaded into memory.

    OPENGL in Microsoft

  7. Introduction to OpenGL
  8. As a software interface for graphics hardware, the main purpose of OpenGL is to render two- and three-dimensional objects into a framebuffer. These objects are described as sequences of vertices (that define geometric objects) or pixels (that define images). OpenGL performs several processes on this data to convert it to pixels to form the final desired image in the framebuffer.

    The following topics present a global view of how OpenGL works:

    • Primitives and Commands discusses points, line segments, and polygons as the basic units of drawing; and the processing of commands.
    • OpenGL Graphic Control describes which graphic operations OpenGL controls and which it does not control.
    • Execution Model discusses the client/server model for interpreting OpenGL commands.
    • Basic OpenGL Operation gives a high-level description of how OpenGL processes data to produce a corresponding image in the framebuffer.
    • OpenGL Function Names describes the naming conventions used in OpenGL.

    Questions,

  9. missing glaux.h in v6.0a sdk?
  10. When installing Visual Studio .NET 2003 and Visual Studio 8 the following sdk files were installed in <installdir > \VC\PlatformSDK\Include\gl:

    gl.h
    glaux.h
    glu.h

    With the Visual Studio 9 installation, the sdk is now installed at C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\gl, but the glaux.h file is missing.

    Where is glaux.h, and if it is no longer shipped, is there any information on alternatives?

    An Answer Based on the reply to https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1065518&SiteID=1, it looks like glaux.lib is deprecated. Instead link to kernel32.lib, user32.lib, gdi32.lib and advapi32.lib

    The easiest way to sort this out is to:

    1. install glut 3.6 or newer as directed.
    2. Open Visual studio 2008 and create a new project
    3. choose c++ - empty solution
    4. import all the files from your previous OpenGL project
    5. delete all headers i.e.
    6. #include <gl\glu.h >
      #include <gl\gluax.h >
      and any other GL headers
    7. then replace with #include <gl\glut.h >
    8. recompile.
    this worked for all of my 2003 & 2005 solutions.

  11. GLUT - The OpenGL Utility Toolkit
  12. 2000/03/22 - GLUT 3 specification is now available in PDF format!

  13. Header Files from Microsoft
  14. Applications that use:

    • The core OpenGL functions must include the header file .
    • The OpenGL Utility library must include the header file .
    • The OpenGL Programming Guide auxiliary library must include the header file .
    • The WGL functions must include the header file windows.h.
    • The Windows functions that support Microsoft's implementation of OpenGL in Windows must include the header file Windows.h.

  15. OpenGL Programming Guide
  16. This is a paragraph.

  17. OpenGL(R) Reference Manual: The Official Reference Document to OpenGL, Version 1.4 (4th Edition) 4th Edition
  18. This is a paragraph.

  19. OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.5 with SPIR-V 9th Edition
  20. This is a paragraph.

  21. openglredbook / examples
  22. OpenGL Red Book Example Code

    This is the example code for the OpenGL Programming Guide (Red Book), 9th Edition. It is mostly an import of code from previous editions with minor updates to match some of the descriptions in the latest edition of the book. We will be adding more samples and updating existing ones over time. Treat this as a live repository. Pull requests and issues are welcome. Go forth and fork!

  23. OpenGL Programming Guide (Addison-Wesley Publishing Company) Second Edition
  24. The Official Guide to Learning OpenGL, Version 1.1

  25. The Official Guide to Learning OpenGL, Version 1.1
  26. This is a paragraph.

  27. Where is glaux.h?
  28. A QuestionI am trying out some older tutorials from NeHe but do not have glaux.h (though glaux.so is there). Does anybody know where I can download a copy?

    An Answer:Just remember the glaux is a library created by Microsoft and is not support for it under linux. You can also find the glaux.h with the Visual C++ compiler. [This message has been edited by nexusone (edited 01-26-2004).]

  29. glaux.h
  30. content of glaux.h file from microsoft. saved a copy of it.

    I do not believe it – I cannot explain why I did not spot this page! Perhaps because I used other words as well in my search? I don’t know… Anyway, this was the 5th hit: http://www.ece.cmu.edu/~ece796/project99/8/final/code/18-796Project/include/gl/GLAUX.H 297

    An Suggestion:In MS Visual C++ follow these steps to have access to glaux.lib:

    • select the “Project” pull-down menu
    • select “Settings”
    • select the “Link” tab
    • click on the “Object/library modules” text line
    • click END
    • click SPACEBAR
    • type “glaux.lib”
    • select “OK”
    Also, since you are doing graphics, these libraries may be useful:
    • opengl32.lib
    • glu32.lib
    Just add them the same way.

  31. Problem with glaux.h locating
  32. A Question: I try to compile code, that beggins with:

    • #include <stdlib.h >
    • #include < GL/gl.h >
    • #include < glaux.h >
    I got error:
    test.c:3:18: error: glaux.h: No such file or directory

    So, I deleted glaux.h from includes (and all functions calls from this header) and successfully compiled with

    -lm -lGL

  33. glaux.h in Visual Studio 2008
  34. A Question: I'm porting some code from Visual Studio 2005 to Visual Studio 2008. Can i use the glaux.lib found in Visual Studio 2005 found in \PlatformSDK\Lib folder in Visual Studio 2008 ? I don't want to change my APIs and have the requirement to use glaux.h as said here , does this work

    An Solution: Download gluax.h from http://www.songho.ca/opengl/files/glaux.h and gluax.lib from http://www.songho.ca/opengl/files/glaux.lib. Set the path and you are done.

    Another Solution: AFAIK, most programmers miss the auxDIBImageLoad() function, and there is no documented workaround. The glaux.lib is a static library and introduces some code bloat.

    This image loader will work without <glaux.h >:
    HBITMAP hbm=LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(1)); if (!hbm) return false; BITMAP bm; GetObject(hbm,sizeof bm,&bm); BITMAPINFO bmi={sizeof bmi,bm.bmWidth,bm.bmHeight,1, 32}; // 24 = GL_BGR_EXT, 32 = GL_BGRA_EXT; all other fields are 0 DWORD*bits=new DWORD[bm.bmWidth*bm.bmHeight]; GetDIBits(hDC,hbm,0,bm.bmHeight,bits,&bmi,DIB_RGB_COLORS); ... glTexImage2D(GL_TEXTURE_2D,0,3,bm.bmWidth,bm.bmHeight,0, GL_BGRA_EXT,GL_UNSIGNED_BYTE,bits); ... delete[] bits; DeleteBitmap(hbm);
    This routine will handle both RGB (24-bit) and indexed images correctly! No need for manual pixel twiddeling! The example loads from process.exe's resource with numeric ID 1. The LoadBitmap() can be replaced by LoadImage() to load from a file. If your input image is known to be of uncompressed RGB type, GetDIBits is not needed, as you can LoadImage() with LR_CREATEDIBSECTION, access the bits using the bmBits pointer, and use the GL_BGR_EXT constant. (new and delete operators are not needed.) GetDIBits needs any valid device context handle to succeed. Use GetDC/ReleaseDC if you have no handle handy. The GL_BGRA_EXT constant is a Microsoft extension to opengl, its use is exactly for such GetDIBits output. Loading compressed PNG/GIF/JPG is not tested here but should work the same way; GetDIBits() is your friend. Moreover, that bitmap can be selected into a memory device context (making it to a painting canvas) and then modified by plain old GDI functions, especially text writing functions, to insert text to the bitmap. 

  35. How to fix this Error: #include <gl/glut.h > “Cannot open source file gl/glut.h”
  36. I was doing some OpenGL programming in C++. This is part of my code:

    • #include <time.h >
    • #include < windows.h >
    • #include < gl/gl.h >
    • #include < gl/glu.h >
    • #include < gl/glut.h > <--- Error here "Cannot open source file gl/glut.h"
    How can I fix this?

    A Solution:You probably haven't installed GLUT: Install GLUT If you do not have GLUT installed on your machine you can download it from: http://www.xmission.com/~nate/glut/glut-3.7.6-bin.zip (or whatever version) GLUT Libraries and header files are • glut32.lib • glut.h

    The quickest way is to download the latest header, and compiled DLLs for it, place it in your system32 folder or reference it in your project. Version 3.7 (latest as of this post) is here: http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip

    Another Solution: Here you can find every thing you need: http://web.eecs.umich.edu/~sugih/courses/eecs487/glut-howto/#win

  37. Installing GLUT on Visual Studio 2010
  38. I decided to do this write up for both myself and others who might be installing GLUT in Visual Studio 2010. I’ll include pictures if anyone requests it, but I think this is fairly straight forward.

  39. https://freeimage.sourceforge.io/
  40. FreeImage is an Open Source library project for developers who would like to support popular graphics image formats like PNG, BMP, JPEG, TIFF and others as needed by today's multimedia applications. FreeImage is easy to use, fast, multithreading safe, compatible with all 32-bit or 64-bit versions of Windows, and cross-platform (works both with Linux and Mac OS X).

  41. Building OpenGL/GLUT Programs
  42. very detailed:Building OpenGL/GLUT Programs .

  43. Building OpenGL/GLFW Apps
  44. very detailed: Building OpenGL/GLFW Apps

  45. GLUT :: Setup Basics
  46. In order to write applications with GLUT you should have the latest version – 3.7.6. You can find the windows binary files (h lib and dll), as well as GLUT’s source code in Nate Robins site.

    In order to write a C application using GLUT you’ll need three files:

    1. glut.h – This is the file you’ll have to include in your source code. The common place to put this file is in the gl folder which should be inside the include folder of your system.
    2. glut32.lib (Windows version) – This file must be linked to your application so make sure to put it your lib folder.
    3. glut32.dll (Windows) – You could place the dll file in your exe’s folder.

    A clean house If you’re serious about OpenGL, sooner or latter you’ll start adding other libs to your application. Having them all in one place is a good idea to keep everything updated, and even in the case where you want to move all your stuff to other computer.

    Hence my suggestion is to create a folder to keep all these files. This folder should have three sub folders, namely includes, libs and dlls. Then place all the files mentioned above in these sub folders. Whenever you need more libs just keep adding them to this folder structure

    Setting up in Visual Studio 2010 I’m not an expert in VS, so this is probably not the most efficient way of doing things. It should work if you follow these instructions step by step. If you know of a better/faster way of doing things let me know and I’ll update the tutorial.

    First make sure you start VS in C or C++ mode. Select File->New Project and a dialog opens. Select “Win32 Console Application” and give a name to your project. Press OK to move on.

    In the next dialog press “Next”. In the next screen select “Console Application and check “Empty Project”. Press “Finish” and your project is ready.

    Now go to solution explorer. If you can’t see it go to “View” and select “Solution Explorer”. The project you just created has a set of ‘folders’. Right click on “Source Files” and select “Add->New Item”. In the dialog for the new item select C++ or C File, give it a name and you are ready to start coding.

    After you got the code right and your app executes you may notice that two windows are opened: your window with the OpenGL rendering, and a console window. The console window is useful in case you want to print something out with printf. However, at the end of the day you may want to get rid of it.

    Ricardo has posted a comment on another page with a solution to get rid of the console window. Thanks Ricardo. Go to:

    ProjectProperties » Linker » System » SubSystem and set the property to: Windows (/SUBSYSTEM:WINDOWS)

    Then go to: Project Properties » Linker » Command Line and add: /ENTRY:mainCRTStartup to Additional Options.

    A final note, you must tell VS where it can find the include and lib files for GLUT. Right click on the project in Solution Explorer window and select “Properties”. In the left side if the properties dialog select VC++ Directories and add to the right side your path to the include and lib files.

    Notes on Using OpenGL with VS.NET Many people have experienced a small problem when using VS.NET to build OpenGL applications: a compiler error that, as far as I know, seems to exist only in these compilers (VS 2003 and 2005, VC 6.0 is OK). Here is the actual text generated by VS 2005:

    error C2381: 'exit' : redefinition; __declspec(noreturn) differs c:\opengl\toolkits\includes\gl\glut.h(146) : see declaration of 'exit'

    This problem seems to be caused by the inclusion of glut.h before stdlib.h. Reversing the order solves the problem. The following code causes the compiler error:

    • #include <GL/glut.h >
    • #include < stdlib.h >

    But when including first stdlib.h the problem disappears:

    • #include < stdlib.h >
    • #include < GL/glut.h >

  47. Using OpenGL & GLUT in Visual Studio .NET 2003 and 2008
  48. This guide will show you how to set up a Visual Studio OpenGL/GLUT project that will compile in both Windows and Linux, as long as it is a pure OpenGL program. This guide also assumes Visual Studio .NET 2003 (and/or 2002) is already installed and you are familiar with its use.

  49. A Brief MUI User Guide. a>
  50. The Micro User Interface (MUI) was written by Tom Davis (SGI) and comes as a part of the GLUT (OpenGL Utilities Toolkit) release 3.6. MUI's major drawback is that it is completely undocumented. The significance of MUI is that it is written entirely on top of GLUT and OpenGL - and as such should port cleanly across a wide range of UNIX, Mac, VMS and PC operating systems and be completely window-system independant.

  51. glut/include/mui/mui.h
  52. This is a paragraph.

  53. Frequently Asked OpenGL Utility Library (GLUT) Questions
  54. Here are a few questions that are the most frequently asked about GLUT 3.7.

No comments:

Post a Comment