EmuNewz Network
Noob help: GL renderer - Printable Version

+- EmuNewz Network (https://www.emunewz.net/forum)
+-- Forum: Official Boards for Emunews Affiliated Emu Projects (https://www.emunewz.net/forum/forumdisplay.php?fid=47)
+--- Forum: Official RPCS3 Forum [archive] (https://www.emunewz.net/forum/forumdisplay.php?fid=172)
+---- Forum: RPCS3 - Support & Issue Reporting (https://www.emunewz.net/forum/forumdisplay.php?fid=163)
+---- Thread: Noob help: GL renderer (/showthread.php?tid=164907)



Noob help: GL renderer - gamenoob - 10-30-2014

Hi,
recently I got interest in emulation. I was lurking rpcs3 source code on github. There was a gl renderer.
https://github.com/DHrpcs3/rpcs3/blob/master/GL/glext.h

I look at them. It was full of macro with specific addresses and function prototypes. What are they actually? For example: look at this line.
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033

Now it says, whenever I say "GL_UNSIGNED_SHORT_4_4_4_4", it is equal to an address of "0x8033". But what is in that address?


RE: Noob help: GL renderer - Ashe - 10-30-2014

It's not an address, it's a simple numeric constant (basically it's an enum).
(btw: that header is not an OpenGL renderer, and your question is more about basic C than emulation)


RE: Noob help: GL renderer - gamenoob - 10-30-2014

what will we do with those enumerations? Also there are a whole bunch of function prototype, so those are enumeration too?

Is it because, we want to call some gl function(which will be executed by gpu driver) or we want to use some data structures, but we do not want to type lengthy names, so we define them as enums; and we just use those enums in stead of big lengthy names??


RE: Noob help: GL renderer - Bigpet - 10-30-2014

The reason for the constant definitions is easy to show. Just look at this without the constant aliases

glTexImage2D( 0x0DE1 , 0, 0x8051, 512, 512, 0, 0x1907, 0x1401, data)

and with the constant definitions:

glTexImage2D(GL_TEXTURE_2D , 0, GL_RGB8, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, data)


The function prototypes are there for the same reason they're in any header, so that you can use them and link against something that implements them.
The thing with the OpenGL extensions is just that they are loaded at runtime in some implementations because you can't know at link-time which extensions are available on all system you will be running on.

Anyway, this has nothing to do with rpcs3 specifically and we did not manually write the glext.h header (it's from the official opengl site https://www.opengl.org/registry/api/GL/glext.h ).


RE: Noob help: GL renderer - tambre - 10-30-2014

You just made me notice that they are kinda old, submited a pull request for the updated OpenGL 4.5 specification file.


RE: Noob help: GL renderer - gamenoob - 10-30-2014

(10-30-2014, 02:49 PM)Bigpet Wrote: The reason for the constant definitions is easy to show. Just look at this without the constant aliases

glTexImage2D( 0x0DE1 , 0, 0x8051, 512, 512, 0, 0x1907, 0x1401, data)

and with the constant definitions:

glTexImage2D(GL_TEXTURE_2D , 0, GL_RGB8, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, data)


The function prototypes are there for the same reason they're in any header, so that you can use them and link against something that implements them.
The thing with the OpenGL extensions is just that they are loaded at runtime in some implementations because you can't know at link-time which extensions are available on all system you will be running on.

Anyway, this has nothing to do with rpcs3 specifically and we did not manually write the glext.h header (it's from the official opengl site https://www.opengl.org/registry/api/GL/glext.h ).
Why can't we use
glTexImage2D( a , 0, b, 512, 512, 0, c, d, data)

in stead of,
glTexImage2D( 0x0DE1 , 0, 0x8051, 512, 512, 0, 0x1907, 0x1401, data)
, This saved us more typing! DodgyDodgyConfused

Personally, for me, this is more human friendly:
glTexImage2D(GL_TEXTURE_2D , 0, GL_RGB8, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, data)

May be you guys are more robot than human, lol Big Grin So you use this:
glTexImage2D( 0x0DE1 , 0, 0x8051, 512, 512, 0, 0x1907, 0x1401, data)

in stead of,
glTexImage2D(GL_TEXTURE_2D , 0, GL_RGB8, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, data)
this.


RE: Noob help: GL renderer - Bigpet - 10-30-2014

(10-30-2014, 03:28 PM)gamenoob Wrote: Personally, for me, this is more human friendly
That is the point


RE: Noob help: GL renderer - gamenoob - 11-01-2014

got it guys. Thanks.