# OpenGL 4.6 declares for Windows

**URL:** <https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826>\
**Category:** Windows\
**Created:** [August 9, 2023, 4:12pm UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826 "2023-08-09T16:12:20Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alwyn\_Bester](https://forum.xojo.com/user_avatar/forum.xojo.com/alwyn_bester/32/23099_2.png) [@Alwyn\_Bester](https://forum.xojo.com/u/Alwyn_Bester)\
**Post date:** [August 9, 2023, 4:12pm UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/1 "2023-08-09T16:12:20Z")

</div>

Not sure if this will be of any use to anyone, but I went through the painstaking process of defining most of the OpenGL 4.6 declares for Windows.

I’m providing this to the public domain, for anyone to use freely, privately or commercially… don’t even need to give any attributions.

This library is provided as-is, and unfortunately I will not be available to assist with any OpenGL troubleshooting related questions.

> **[GitHub - Zoclee/xojo-opengl46: Xojo function declarations for OpenGL 4.6](https://github.com/Zoclee/xojo-opengl46)**
>
> Xojo function declarations for OpenGL 4.6. Contribute to Zoclee/xojo-opengl46 development by creating an account on GitHub.

That being said, the library is complete enough to write your own advanced shaders. Here is an example of a shader I wrote and ran via the above library, to render a realistic looking water bottle…

 ![waterbottle](https://forum.xojo.com/uploads/default/original/2X/8/8c39d6be5d06319a386e66b87a312e902a781aa2.png)

I hope this library might be useful to those of you brave enough to dabble in OpenGL programming.

---

<div class="post-metadata">

**Author:** ![Eugene\_Dakin](https://forum.xojo.com/user_avatar/forum.xojo.com/eugene_dakin/32/178_2.png) [@Eugene\_Dakin](https://forum.xojo.com/u/Eugene_Dakin)\
**Post date:** [August 9, 2023, 5:07pm UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/2 "2023-08-09T17:07:53Z")

</div>

Hi @Alwyn_Bester,

Its great to hear from you and thanks for your hard work. This is great.

Unfortunately, when I went to download the Github project I have a virus warning:

![Virus](https://forum.xojo.com/uploads/default/original/2X/2/237b1466bf781c484de9a5347f841249e33e7dac.png)

Could I ask you to check the files on another computer?

Warm regards.

---

<div class="post-metadata">

**Author:** ![Alwyn\_Bester](https://forum.xojo.com/user_avatar/forum.xojo.com/alwyn_bester/32/23099_2.png) [@Alwyn\_Bester](https://forum.xojo.com/u/Alwyn_Bester)\
**Post date:** [August 9, 2023, 5:24pm UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/3 "2023-08-09T17:24:54Z")

</div>

Hello Eugene,

It is great to hear from you too 🙂

I’ve just downloaded with Firefox, Edge and Chrome… and scanned with McAfee and aren’t getting any virus warnings.

Which anti-virus are you using Eugene? I’m pretty sure it must be a false positive since the downloaded file does not hold any executable binaries, and only contains the source code with the declares to the OpenGL functions.

---

<div class="post-metadata">

**Author:** ![Alwyn\_Bester](https://forum.xojo.com/user_avatar/forum.xojo.com/alwyn_bester/32/23099_2.png) [@Alwyn\_Bester](https://forum.xojo.com/u/Alwyn_Bester)\
**Post date:** [August 9, 2023, 5:31pm UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/4 "2023-08-09T17:31:48Z")

</div>

Also did a scan with Windows Defender… giving it the all clear?

![image](https://forum.xojo.com/uploads/default/original/2X/2/230b00f983928bca99965132ee480abef9844b90.png)

---

<div class="post-metadata">

**Author:** ![Eugene\_Dakin](https://forum.xojo.com/user_avatar/forum.xojo.com/eugene_dakin/32/178_2.png) [@Eugene\_Dakin](https://forum.xojo.com/u/Eugene_Dakin)\
**Post date:** [August 9, 2023, 5:37pm UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/5 "2023-08-09T17:37:35Z")

</div>

I am not sure what to say. I attempted to download the zipped file on two different computers, both with edge and chrome browsers, and both automatically deleted the file because of a virus. Both computers used Windows Defender. Weird.

You are correct, as they are just text files. It must be the zipped file is triggering an issue.

Thanks for checking.

---

<div class="post-metadata">

**Author:** ![Alwyn\_Bester](https://forum.xojo.com/user_avatar/forum.xojo.com/alwyn_bester/32/23099_2.png) [@Alwyn\_Bester](https://forum.xojo.com/u/Alwyn_Bester)\
**Post date:** [August 9, 2023, 5:43pm UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/6 "2023-08-09T17:43:31Z")

</div>

I had a quick look on Microsoft’s site about this Wacatac.H!ml virus… reading through their description I suspect your computer/network might have been previously infected from a different source, now causing the download issue.

[https://answers.microsoft.com/en-us/windows/forum/all/windows-defender-trojanscriptwacatachml-keeps/93ef0ec1-3170-48d6-86af-5373ff6c3cd1](https://answers.microsoft.com/en-us/windows/forum/all/windows-defender-trojanscriptwacatachml-keeps/93ef0ec1-3170-48d6-86af-5373ff6c3cd1)

Might be worthwhile to get a malware remover to remove the virus as per their suggestion?

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [August 9, 2023, 5:43pm UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/7 "2023-08-09T17:43:43Z")

</div>

I didn’t want to be _that guy_ but the debug executable got uploaded to github, and git holds on to _everything **forever** _. So even if a commit removes the DebugOpenGL folder, the string of bytes that’s triggering the false positive could be still stored inside the `.git` folder that makes things operate.

[The repo zip did pass Virustotal](https://www.virustotal.com/gui/url/6e0dba8fe71a3f9005d03adeedc32f9456ad9023c81c0a328d2f9e3537cf7967), but it’s not unheard of for Xojo builds to trigger false positives.

It may be of benefit to delete this repository, create a new one, and use the Xojo template that has some basic ignore settings:

 ![Screen Shot 2023-08-09 at 13.43.16](https://forum.xojo.com/uploads/default/original/2X/b/b73e10260dac86c2b75c70f8c5c25c7ad66f1cc9.png)

(sorry this was meant to be a reply to the thread, not you directly)

---

<div class="post-metadata">

**Author:** ![Alwyn\_Bester](https://forum.xojo.com/user_avatar/forum.xojo.com/alwyn_bester/32/23099_2.png) [@Alwyn\_Bester](https://forum.xojo.com/u/Alwyn_Bester)\
**Post date:** [August 9, 2023, 5:45pm UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/8 "2023-08-09T17:45:06Z")

</div>

My bad… I see now the debug folder got added by mistake 😅

Let me quickly delete and re-create the repository. Sorry about that.

Thank you for pointing this out Tim… much appreciated.

---

<div class="post-metadata">

**Author:** ![Alwyn\_Bester](https://forum.xojo.com/user_avatar/forum.xojo.com/alwyn_bester/32/23099_2.png) [@Alwyn\_Bester](https://forum.xojo.com/u/Alwyn_Bester)\
**Post date:** [August 9, 2023, 5:51pm UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/9 "2023-08-09T17:51:54Z")

</div>

Ok, repository was deleted, re-created without the debug folder, and future proofed with a .gitignore file 👍

@Eugene_Dakin, the download should now pass the anti-virus check.

@Tim_Parnell FYI ^

---

<div class="post-metadata">

**Author:** ![Eugene\_Dakin](https://forum.xojo.com/user_avatar/forum.xojo.com/eugene_dakin/32/178_2.png) [@Eugene\_Dakin](https://forum.xojo.com/u/Eugene_Dakin)\
**Post date:** [August 9, 2023, 5:56pm UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/10 "2023-08-09T17:56:28Z")

</div>

That downloads and unzips perfectly now! Thank you, there are no issues and is safe to download. 🙂

---

<div class="post-metadata">

**Author:** ![Alwyn\_Bester](https://forum.xojo.com/user_avatar/forum.xojo.com/alwyn_bester/32/23099_2.png) [@Alwyn\_Bester](https://forum.xojo.com/u/Alwyn_Bester)\
**Post date:** [August 9, 2023, 5:59pm UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/11 "2023-08-09T17:59:02Z")

</div>

You’re welcome Eugene… good to know that it now downloads successfully 🙂

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [August 9, 2023, 6:05pm UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/12 "2023-08-09T18:05:03Z")

</div>

Thanks for sharing the project, Alwyn! Hopefully the gitignore template helps you with your future projects too 🙂

---

<div class="post-metadata">

**Author:** ![Claes\_Lundstrom](https://forum.xojo.com/letter_avatar_proxy/v4/letter/c/e19adc/32.png) [@Claes\_Lundstrom](https://forum.xojo.com/u/Claes_Lundstrom)\
**Post date:** [August 10, 2023, 8:57am UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/13 "2023-08-10T08:57:12Z")

</div>

I wish I had time to evaluate it as an option… 🤔

 ![Yra](https://forum.xojo.com/uploads/default/original/2X/8/8afa0f143ef9f5bc306b887ac68bd8d85a98a8dc.jpeg)

---

<div class="post-metadata">

**Author:** ![Alwyn\_Bester](https://forum.xojo.com/user_avatar/forum.xojo.com/alwyn_bester/32/23099_2.png) [@Alwyn\_Bester](https://forum.xojo.com/u/Alwyn_Bester)\
**Post date:** [August 11, 2023, 8:00pm UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/14 "2023-08-11T20:00:25Z")

</div>

Here is a more exciting project that uses the OpenGL 4.6 declares, where I took my first jab at loading glTF objects, and rendering them using physical based rendering (PBR) shaders.

The project is far from complete, but should provide a good example on how to get started with OpenGL Shader programming.

[Viewport.zip](https://uploadnow.io/f/n8W02Rx)

After loading and running the project in Xojo… open the WaterBottle.glb model in the root folder of the zip file.

---

<div class="post-metadata">

**Author:** ![Alwyn\_Bester](https://forum.xojo.com/user_avatar/forum.xojo.com/alwyn_bester/32/23099_2.png) [@Alwyn\_Bester](https://forum.xojo.com/u/Alwyn_Bester)\
**Post date:** [August 12, 2023, 12:01pm UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/15 "2023-08-12T12:01:03Z")

</div>

Just something to keep in mind when trying to run the project. There is a FreeImage.dll file in the project’s /bin folder. You need to copy the FreeImage.dll either next to the compiled application’s .exe file, or to the Windows/System32 folder. I usually copy it to the Windows/System32 folder then the file can be used by any application from any folder.

---

<div class="post-metadata">

**Author:** ![Andrew\_Lambert](https://forum.xojo.com/user_avatar/forum.xojo.com/andrew_lambert/32/215_2.png) [@Andrew\_Lambert](https://forum.xojo.com/u/Andrew_Lambert)\
**Post date:** [August 12, 2023, 5:50pm UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/16 "2023-08-12T17:50:22Z")

</div>

On Windows you can tell the OS to look for DLLs in a specific folder. This folder will be searched first:

```
Declare Function SetDllDirectoryW Lib "Kernel32" (PathName As WString) As Boolean
Call SetDllDirectoryW("C:\Example\")

```

---

<div class="post-metadata">

**Author:** ![Norbert\_Kollmetz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/e99b99/32.png) [@Norbert\_Kollmetz](https://forum.xojo.com/u/Norbert_Kollmetz)\
**Post date:** [June 20, 2024, 9:38am UTC](https://forum.xojo.com/t/opengl-4-6-declares-for-windows/76826/18 "2024-06-20T09:38:06Z")

</div>

Hello Alwyn,

First of all, thank you for all your work. How can you pass an array of doubles?

When passing vert\_coords, a pointer is required. For me, vert\_coords is an array of doubles.

```auto
OpenGL46.glBufferData(OpenGL46.GL_ARRAY_BUFFER, no_verts * 3 * sizeofDouble,vert_coords, OpenGL46.GL_STATIC_DRAW)

```

Thanks & regards Norbert
