Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Noob help: GL renderer
#1
ps3 
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?
Reply

#2
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)
Reply

#3
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??
Reply

#4
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 ).
Reply

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

#6
(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.
Reply

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

#8
got it guys. Thanks.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Powered By MyBB, © 2002-2022 iAndrew & Melroy van den Berg.