PDA

View Full Version : Updated the OpenGL defines to the 3.3 specification



rombust
03-26-2010, 12:55 PM
(ClanLib 2.2 SVN)

I have updated the OpenGL defines to the 3.3 specification.

Also I have removed deprecated and removed features from the OpenGL 3.3 Specification (using the defines)

Except:

// Legacy defines to be removed when clanlib allows it
CL_MATRIX_MODE = 0x0BA0,
CL_MODELVIEW_MATRIX = 0x0BA6,
CL_PROJECTION_MATRIX = 0x0BA7,
CL_MODELVIEW = 0x1700,
CL_PROJECTION = 0x1701,

We need to decide the best way to do that. Personally I would write to a uniform "cl_modelview_matrix" and adjust the shaders accordingly.

The modified API is listed here:

Removal - CL_TextureDepthMode()
Removal - CL_Texture::[set][get]_generate_mipmap()
Revised - CL_DrawBuffer enum (removed AUX types)
Revised - CL_PrimitivesType enum (removed QUADS and POLYGON's)
Removal - CL_Pen::[is][enable]_point_antialiased()
Removal - CL_Pen::[is][enable]_using_point_sprites()
Removal - CL_Pen::[is][enable]_line_stippled()
Removal - CL_Pen::[get][set]_min_point_size()
Removal - CL_Pen::[get][set]_max_point_size()
Removal - CL_Pen::[get][set]_point_distance_attenuation()
Renamed - CL_TextureCompareMode::cl_comparemode_compare_r_to _texture to cl_comparemode_compare_ref_to_texture

Note: I have not updated the OpenGL functions yet.
The plan is to use only the functions in ClanLib-2.2\Sources\GL\opengl3_context.h
and put them in ClanLib-2.2\Sources\API\GL\opengl_wrap.h

(using a text editor macro to convert it into the correct format).

rombust
03-29-2010, 10:38 AM
Updated the OpenGL functions and removed functions listed in the deprecated and removed features from the OpenGL 3.3 Specification (Excluding some matrix functions)

This included:

Removal - CL_Pen::[get][set]_line_stipple_pattern()
Removal - CL_Pen::[get][set]_line_stipple_repeat_count()

These functions have been left in, to be removed at a later time:


functions->matrixMode = (CL_GLFunctions::ptr_glMatrixMode) CL_OpenGL::get_proc_address("glMatrixMode");
functions->multMatrixd = (CL_GLFunctions::ptr_glMultMatrixd) CL_OpenGL::get_proc_address("glMultMatrixd");
functions->multMatrixf = (CL_GLFunctions::ptr_glMultMatrixf) CL_OpenGL::get_proc_address("glMultMatrixf");
functions->loadIdentity = (CL_GLFunctions::ptr_glLoadIdentity) CL_OpenGL::get_proc_address("glLoadIdentity");
functions->loadMatrixd = (CL_GLFunctions::ptr_glLoadMatrixd) CL_OpenGL::get_proc_address("glLoadMatrixd");
functions->loadMatrixf = (CL_GLFunctions::ptr_glLoadMatrixf) CL_OpenGL::get_proc_address("glLoadMatrixf");
functions->translated = (CL_GLFunctions::ptr_glTranslated) CL_OpenGL::get_proc_address("glTranslated");
functions->translatef = (CL_GLFunctions::ptr_glTranslatef) CL_OpenGL::get_proc_address("glTranslatef");
functions->rasterPos2i = (CL_GLFunctions::ptr_glRasterPos2i) CL_OpenGL::get_proc_address("glRasterPos2i");
functions->pixelZoom = (CL_GLFunctions::ptr_glPixelZoom) CL_OpenGL::get_proc_address("glPixelZoom");
functions->copyPixels = (CL_GLFunctions::ptr_glCopyPixels) CL_OpenGL::get_proc_address("glCopyPixels");

rombust
03-30-2010, 09:36 AM
The remaining legacy matrix functions have not been removed.

If you use CL_ProgramObjects with the GL target, you have to modify your program as follows:

If your shader contains:

gl_ModelViewMatrix, gl_ProjectionMatrix, gl_ModelViewProjectionMatrix, gl_NormalMatrix

Change these to:

cl_ModelViewMatrix, cl_ProjectionMatrix, cl_ModelViewProjectionMatrix, cl_NormalMatrix

Remember to add:

"uniform mat4 cl_ModelViewMatrix;"
"uniform mat4 cl_ProjectionMatrix;"
"uniform mat4 cl_ModelViewProjectionMatrix;"
"uniform mat3 cl_NormalMatrix;"

If you don't require all these uniforms, you can select which ones use want via the CL_ProgramMatrixFlags in

gc.set_program_object(program, program_matrix_flags);
(Note, program_matrix_flags defaults to cl_program_matrix_all_standard)