glvertex

I am a noob in GL

was wondering since java is used

why cant I just used glvertex(x,y,z)

instead of glvertex3f(x,y,z)
or glvertex2f() etc forcing me to remember all the different type of parameters I put in ?

etc … I noticed this is a big problem
and this is the reason I hated C++ yet … seeing this being done in java really sadden me…

Hi,

Well it may not be a good answer but since JOGL is a binding to openGl, you find the same method calls and it’s a good point for many users.
For me, dealing with glblahblah3f, 2i, 4d is not a great problem and can help you to remember exactly what your are doing in huge projects.

just another idea I had …

imagine writing a dynamic code
that will generate glvertex dynamically for you

it could generate via different method such as 4 floating pts numbers or 2 double or via vector etc …

if I were to write a generator, this implies I need a separate code to generate glvertex4f() glvertex2d etc … instead of just glvertex …

this the beauty of polymorphism being expressed and used.

the origin glvertex2f etc calling is good when you are porting the codes over from C++ for example to jogl … but when you are writing a new program or like me trying to learn opengl … it increases the learning time trying to recalled all the different combinations to called.

dont mind, I am a total noob in programming also … java is my first and only programming I have done till now.

i don’t think you mean polymorphism, i think you’re talking about overloaded methods.

anyways, if you’d really prefer to have 1 function format, just do your own overloaded method

void glVertexAny(int x, int y, int z){ … }
void glVertexAny(double x, double y, double z){ … }
void glVertexAny(float x, float y, float z){ … }
void glVertexAny(int array){ … }
void glVertexAny(double array){ … }
void glVertexAny(float array){ … }

oops … you are correct I meant overloading.

I can do my own overloading… but was wondering why it wasnt design to be part of it in jogl …
this is only glvertex … what about other methods ? do I always have to do my own ? wouldnt it be easier to just remember glvertex … instead of all the different input parameters ?

this could collapse the number of different function calls I need to remember. it would speed up my programming else I would always need to reference the api for different type of the same function.

In fact it’s just the same.
On the one hand you have to remember which parameters can be put into the glVertex() overloaded methods (for example you can put 3 floats)
On the other hand you have to remember that you can use 3 floats for glVertex3f and so on…

Once again, JOGL is a binding to the C API, and a lot a developpers are used to use glVertex3f, it’s not the biggest problem you will face with openGL : :wink: