• Advertisement

Archived

This topic is now archived and is closed to further replies.

Problems linking with OpenGL

This topic is 4985 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Unaware that glColor*ub would allow colors to be entered in hex, I wrote a simple function to convert hex to floats: void glColor3fRGB(int r,int g,int b) { glColor3f((float) r/255,(float) g/255,(float) b/255); } Which worked as expected within the source, but when linked it always rendered the object green. Since learning of glColor4ub, I wrote another seemingly simple function to be able to convert alpha in percent to hex: void glColor4uba(int r,int g,int b,float alpha) { glColor4ub(r,g,b,alpha*255); } Which also worked when included within the source itself, but when linked, all my alpha''d objects were no longer rendered. I''m curious as to whether this is a GL problem, or perhaps something else?

Share this post

Share on other sites
Advertisement
quote:
Original post by Sir Eibwen
I''m curious as to whether this is a GL problem, or perhaps something else?

No it isn''t a OpenGL problem.
This should have been posted in the OpenGL forum.

"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"

Share this post

Share on other sites
quote:
Original post by CPPMaster Poppet
No it isn''t a OpenGL problem.
This should have been posted in the OpenGL forum.

Unless I''m mistaken that''s a contradiction. Either I''ve an OpenGL problem, which is doubtful as the functions work as coded within the source, or a programming problem, or perhaps something else entirely -- hence the thread.

Though to my knowledge I''ve linked the function properly:

test.c -- program source
function.c -- function source
test.h -- header file containing function declaration (included in test.c)

$cc -c function.c$ cc test.c function.o -o test -lglut

It compiles without warnings, but it renders as described above.

Share this post

Share on other sites

• Advertisement