Banner
GTAforums.com GTAGarage GTA Modding gta4.net gtasanan.com Illspirit.com Turnipfan.com Myriad Islands GTA Multiplayer Steve's GTA tools site Project Cerbera - GTA research and tools
Site menu
OGL Launcher

Well, you probably came here because you figured out that your game or graphical application needs a little more user input before launched and going to fullscreen and stuff like that.

so, if you have a list of things that would be neccesary to be done in launcher app you probably thought of these things:

  • Selection of window / fullscreen mode
  • Selection of color depth and screen resolution
  • maybe the launcher should look nice too, a spinning opengl logo would be very nice, wouldn't it be?

Before you start doing mistakes that will cripple your app remember that the a average GFX card on a PC is these days capable of handling at least 2 or more monitors, so before you make the users of your program stuck with primary screen take some time and think about this, graphical cards these days support hardware acceleration on both screens separately and sometimes it is even possible to use one opengl context over several screens at same time (at least nvidia can do this). Multimonitor api is supported in windows 98 and NT5 (win2000) and all newer os-es.

This should make it senseful, that a launcher app should also provide screen selection, and since not all screens are equally hardware accelerated on all graphical hardware vendors secondary screens may not always provide same resolutions you will have to change your resolution enumeration function, which is usually built around the "EnumDisplaySettings" winapi call. for primary screen you can just call the function with NULL devicename, but for enumerating resolutions for specific screen you will call this function with '\\.\Display' + screen number which starts with 1 for first screen and other screen numbers follow with 2, 3 etc..

To get the screen count simply call GetSystemMetrics(SM_CMONITORS). To get the screen resolution for specific screen size you can use GetMonitorInfoA api function in user32.dll, calling this function and retrieving the data in tagMONITORINFO will give you rcMonitor member of the struct which will contain the screen virtual location and size, you use this to position your window into that rectangle when going to fullscreen, if the mode is window you should center the window into this screen's rectangle. if your compiler cannot find definitions for GetMonitorInfoA you will need new winapi import headers. if you use borland delphi (delphi 4 and newer) you are on even better, the application has a screen object property where screen.monitorcount and screen.monitors[] will give you all you need.

You might want your app can even provide a neat visual selection of monitors this way, as the user will see which screen is positioned where and its size. here is an example of how to implement visual screen selection in a good way, just like windows desktop resolution dialog does:


The above cool display selection dialog was created with just a little imagination, the both screens were put into a rectangle, and then resized using aspect ratio to the panel on which they are placed on, this ensures friendly way for the user to pick the screen and the little screens are always placed nicely into the window no matter the window size. to make this easier for you, here is a delphi example for the above functionality.

The second part of the launcher is much simplier, it should provide opengl driver selection (ICD, Mesa, custom, etc..), color depth and vsync mode, the launcher can create a opengl context, to check if it is hardware accelerated, if it has needed extension and the name and vendor of the hardware device. An example of such dialog can be seen here:

This article will not tell you how to make all this user friendly or idiotproof, but i will just give you a little help on the cool spinning opengl logo that was mentioned before, this is very simple, i created the mesh in zmodeler, using the original big cmyk logo from SGI website as the template. it has around 371 polygons, here is the definition for vertex indexes:

indices: array[0..371 * 3 -1] of word = ( 1,0,2, 1,2,3, 3,2,4, 3,4,5, 5,4,6, 5,6,7, 7,6,8, 7,8,9, 9,8,10, 9,10,11, 11,10,12, 11,12,13, 13,12,14, 13,14,15, 13,15,16, 13,16,17, 17,16,18, 17,18,19, 19,18,20, 19,20,21, 21,20,22, 21,22,23, 23,22,24, 23,24,25, 25,24,26, 25,26,27, 27,26,28, 27,28,29, 29,28,30, 29,30,31, 31,30,32, 31,32,33, 33,32,34, 33,34,35, 35,34,36, 35,36,37, 37,36,38, 37,38,39, 37,39,40, 40,39,41, 40,41,42, 42,41,43, 42,43,44, 42,44,45, 45,44,46, 45,46,47, 47,48,49, 47,49,50, 50,45,47, 48,51,52, 48,52,49, 51,0,1, 51,1,52, 54,53,55, 54,55,56, 56,55,57, 56,57,58, 58,57,59, 60,61,62, 62,61,63, 62,63,64, 64,63,65, 64,65,66, 66,65,67, 66,67,57, 57,67,59, 65,63,68, 65,68,69, 69,68,70, 69,70,71, 71,70,72, 71,72,73, 73,72,74, 73,74,75, 75,74,76, 75,76,77, 77,76,78, 77,78,79, 79,78,80, 79,80,81, 81,80,82, 81,82,83, 83,82,84, 83,84,85, 85,84,86, 85,86,87, 87,86,88, 87,88,89, 89,88,90, 89,90,91, 91,90,92, 91,92,93, 91,93,94, 94,93,95, 94,95,96, 96,95,97, 96,97,98, 98,97,56, 98,56,58, 100,99,101, 100,101,102, 102,101,103, 102,103,104, 103,101,105, 103,105,106, 106,105,107, 106,107,108, 108,107,109, 108,109,110, 110,109,111, 110,111,112, 112,111,113, 112,113,114, 114,113,115, 115,113,116, 116,113,117, 116,117,118, 118,117,119, 118,119,120, 120,119,121, 120,121,122, 122,121,123, 122,123,124, 124,123,125, 124,125,126, 126,125,99, 126,99,127, 127,99,100, 127,100,128, 128,100,129, 128,129,130, 130,129,131, 130,131,132, 132,131,133, 132,133,134, 134,133,135, 134,135,136, 136,135,137, 136,137,138, 138,137,139, 138,139,140, 140,139,141, 140,141,142, 142,141,143, 143,141,144, 143,144,145, 145,144,146, 145,146,147, 147,146,148, 147,148,149, 149,148,150, 149,150,151, 151,150,152, 153,154,155, 155,154,156, 155,156,157, 157,156,158, 157,158,159, 159,158,160, 159,160,161, 159,161,162, 162,161,163, 158,156,164, 158,164,165, 165,164,166, 165,166,167, 167,166,168, 167,168,169, 169,168,170, 169,170,171, 171,170,172, 171,172,173, 173,172,174, 173,174,175, 173,175,176, 176,175,177, 176,177,178, 178,177,179, 178,179,180, 180,179,181, 182,183,184, 182,184,185, 185,184,186, 186,184,187, 189,188,190, 189,190,191, 191,190,192, 191,192,193, 193,192,194, 193,194,195, 195,194,196, 195,196,197, 197,196,198, 198,196,199, 198,199,200, 200,199,201, 201,199,202, 202,199,203, 203,199,204, 203,204,205, 205,204,206, 206,204,207, 206,207,208, 208,207,209, 208,209,210, 210,209,211, 210,211,212, 212,211,213, 212,213,214, 214,213,215, 214,215,216, 216,215,217, 217,215,218, 217,218,219, 219,218,220, 219,220,221, 221,220,222, 222,220,223, 222,223,224, 224,223,225, 224,225,226, 226,225,227, 226,227,228, 228,227,229, 228,229,230, 230,229,231, 230,231,232, 232,231,233, 232,233,234, 234,233,235, 234,235,236, 236,235,237, 237,235,238, 237,238,239, 239,238,240, 239,240,241, 241,240,242, 241,242,376, 243,242,244, 243,244,245, 245,244,246, 245,246,247, 247,246,248, 247,248,249, 249,248,250, 249,250,251, 251,250,252, 254,253,252, 254,252,250, 245,247,255, 255,247,256, 12,10,257, 12,257,258, 12,258,259, 12,259,260, 12,260,261, 12,261,262, 12,262,263, 263,262,264, 263,264,265, 265,264,266, 265,266,267, 267,266,268, 267,268,269, 269,268,270, 269,270,271, 271,270,272, 271,272,273, 273,272,274, 273,274,275, 275,274,276, 275,276,277, 277,276,278, 277,278,279, 279,278,280, 279,280,281, 281,280,282, 281,282,283, 283,282,284, 283,284,285, 285,284,286, 285,286,287, 287,286,288, 287,288,289, 289,288,290, 289,290,291, 291,290,292, 291,292,293, 291,293,294, 294,293,295, 294,295,296, 296,295,297, 296,297,298, 298,297,299, 298,299,300, 300,299,301, 300,301,302, 302,301,303, 302,303,304, 304,303,305, 304,305,306, 306,305,307, 306,307,308, 308,307,309, 308,309,310, 310,309,311, 310,311,312, 312,311,313, 312,313,314, 314,313,315, 314,315,316, 316,315,317, 47,46,318, 318,46,319, 319,46,320, 320,46,321, 321,46,322, 322,46,323, 322,323,324, 324,323,325, 324,325,326, 326,325,327, 326,327,328, 328,327,329, 328,329,330, 330,329,331, 330,331,332, 332,331,333, 332,333,334, 334,333,335, 334,335,336, 336,335,337, 336,337,338, 338,337,339, 338,339,340, 340,339,341, 340,341,342, 342,341,343, 342,343,344, 344,343,345, 344,345,346, 346,345,347, 346,347,348, 348,347,349, 348,349,350, 350,349,351, 350,351,352, 352,351,353, 352,353,354, 354,353,355, 354,355,356, 356,355,357, 356,357,358, 358,357,359, 358,359,360, 360,359,361, 360,361,362, 362,361,363, 362,363,364, 364,363,365, 364,365,366, 366,365,367, 366,367,368, 368,367,369, 368,369,370, 370,369,371, 370,371,372, 372,371,373, 372,373,374, 372,374,375, 242,243,376 );

and here are actual vertices (glvertex2f)

vertices: array[0..377 * 2 -1] of single = ( -26.939983,-0.108363, -18.841255,-0.270827, -26.912468,-1.069957, -18.761343,-1.149870, -26.726004,-2.055551, -18.574879,-2.055551, -26.432991,-2.987869, -18.066511,-3.132322, -26.006788,-4.000100, -17.274139,-4.000100, -25.340847,-5.012331, -15.991027,-4.559491, -16.945477,-5.931530, -15.005433,-4.559491, -16.017664,-6.024562, -14.978795,-6.051200, -13.993202,-5.864737, -14.019839,-4.319752, -13.007608,-5.465171, -13.487086,-4.000100, -12.048653,-4.879143, -13.034246,-3.600535, -11.249523,-4.000100, -12.608044,-2.961231, -10.663494,-2.987869, -12.155203,-2.002275, -10.397118,-2.002275, -11.975498,-0.987791, -10.210653,-1.043320, -11.948860,-0.006704, -10.210653,-0.004451, -12.082048,0.945493, -10.343842,1.007780, -12.370559,1.822283, -10.636856,1.993374, -13.034246,2.747843, -11.142973,2.952330, -13.937674,3.342882, -11.995377,3.964561, -13.007608,4.683778, -15.034324,3.584875, -14.019839,5.003429, -16.019917,3.584875, -15.060962,5.183134, -15.964389,5.156496, -16.976620,3.298619, -16.972115,4.950154, -26.086700,3.005605, -26.539541,1.966736, -18.281864,1.993374, -17.749111,2.685953, -26.832556,0.954505, -18.649195,1.007780, -9.571295,7.288974, -8.218581,7.288974, -9.571295,4.125370, -8.218581,4.299913, -9.571295,2.423569, -7.934948,2.947200, -8.196763,2.205389, -9.571295,-1.863660, -8.218581,-1.863660, -9.571295,-1.220030, -8.218581,-1.285484, -9.571295,0.023594, -7.950233,0.093357, -9.571295,1.027220, -8.196763,1.027220, -7.607678,-1.809115, -7.367681,-0.543673, -6.974957,-1.961840, -6.657592,-0.760513, -5.993150,-2.005476, -6.036785,-0.761853, -4.898758,-1.716932, -5.425882,-0.412765, -4.078080,-1.100361, -5.011342,0.001776, -3.549539,-0.303676, -4.705890,0.656315, -3.265905,0.569043, -4.612294,1.441761, -3.194127,1.419943, -4.662254,2.030846, -3.222269,2.074482, -4.814980,2.729021, -3.374995,2.859928, -5.120431,3.252652, -3.767718,3.754465, -5.644062,3.623557, -4.334985,4.343549, -6.254965,3.776282, -4.967706,4.823545, -5.936049,5.034125, -6.844050,3.732646, -6.840139,5.034125, -7.258591,3.579921, -7.653270,4.753425, -7.607678,3.339923, -1.252484,0.720413, -1.252484,2.007686, 2.102226,0.720413, 2.102226,2.007686, 3.498721,0.720413, 3.498721,2.007686, 1.969598,0.267918, 3.280274,-0.168975, 1.688738,-0.215784, 2.874589,-0.793106, 1.251846,-0.527850, 2.300616,-1.432842, 0.896262,-0.738346, 1.392275,-1.947751, 0.409268,-0.824313, 0.752540,-2.072577, 0.097202,-2.041370, -0.402104,-1.916544, -0.090038,-0.746297, -0.917013,-1.698098, -0.495724,-0.527851, -1.509938,-1.370429, -0.838996,-0.231388, -1.915624,-0.902330, -1.073046,0.111885, -2.305706,-0.340611, -1.213475,0.423951, -2.539756,0.252314, -2.672384,0.720413, -2.672384,1.890661, -1.213475,2.467983, -2.555359,2.670825, -1.041839,2.967288, -2.321310,3.357371, -0.745111,3.341238, -1.946830,4.012710, -0.277277,3.622627, -1.338302,4.543221, 0.065995,3.700644, -0.620550,4.933304, 0.315648,3.763057, -0.027625,5.073734, 0.861763,3.763057, 0.534094,5.136147, 1.142623,5.089337, 1.361069,3.653833, 1.844771,4.824081, 1.719945,3.341767, 2.500110,4.449602, 2.016407,2.920478, 3.124242,3.700644, 2.102226,2.546000, 3.373895,3.060908, 3.498721,2.546000, 4.152398,-1.844177, 5.470766,-1.844177, 4.152398,-1.005215, 5.470766,-1.078970, 4.152398,0.008914, 5.672908,-0.003507, 4.152398,1.041482, 5.470766,0.488320, 5.470766,1.004604, 4.152398,4.876735, 5.470766,4.876735, 5.977830,-1.613693, 6.125340,-0.470493, 6.494114,-1.890274, 6.733818,-0.710196, 7.121031,-2.019345, 7.286979,-0.747073, 7.766386,-2.019345, 7.840140,-0.599564, 8.522373,-1.834958, 8.208916,-0.286106, 9.001780,-1.539938, 9.425871,-1.152725, 8.356424,-0.027964, 9.665573,-0.581125, 8.402522,0.230178, 9.739328,-0.009525, 8.402522,4.876735, 9.739328,4.876735, 21.811810,-5.670063, 24.088949,-5.670063, 24.088949,2.784140, 21.811810,4.655581, 29.114357,4.655581, 29.114357,2.784140, 17.971058,-2.241795, 20.119518,-2.241795, 17.814806,-2.827738, 20.021860,-2.983990, 17.502302,-3.257430, 19.709356,-3.804311, 17.131205,-3.589465, 19.279663,-4.351192, 16.681982,-3.882437, 18.771847,-4.859009, 18.185904,-5.269170, 16.135101,-4.038688, 17.599960,-5.581672, 16.935890,-5.776987, 16.389009,-5.855113, 15.724940,-5.874644, 15.529626,-4.058219, 15.099934,-5.835581, 14.435864,-5.718392, 14.826493,-3.882436, 13.713201,-5.523078, 14.279613,-3.589464, 13.088194,-5.191043, 13.810858,-3.179304, 12.424125,-4.702757, 13.459291,-2.691017, 11.916307,-4.116814, 13.205383,-2.085542, 11.584272,-3.589464, 11.213175,-2.944926, 12.990537,-1.245690, 10.900672,-1.890228, 12.971005,-0.542558, 10.724889,-1.187096, 10.685825,-0.562089, 12.971005,0.023855, 10.705357,0.258232, 13.088194,0.746518, 10.920203,1.312930, 13.322572,1.371525, 11.252237,2.191846, 13.674138,1.996531, 11.701461,3.051229, 14.142893,2.504349, 12.267874,3.656705, 14.787431,2.855915, 13.049131,4.281711, 15.412437,3.070761, 13.810858,4.672340, 14.631179,4.848123, 16.076506,3.070761, 15.783535,4.945780, 16.584324,3.031698, 16.603855,4.848123, 17.057610,2.914227, 18.068714,4.144991, 17.521833,2.602006, 18.615595,3.539515, 18.010120,2.016063, 20.305065,2.738726, 18.166372,1.449650, 20.305065,1.605902, 18.224966,0.834410, 20.305065,0.834410, 20.305065,-0.864827, 15.959318,-0.864827, 15.959318,0.834410, 18.849972,4.652808, 20.305065,4.652808, -24.352631,-6.202297, -23.428951,-7.173345, -22.481588,-7.954919, -21.107912,-8.878598, -19.734236,-9.707541, -18.470480,-10.325033, -16.042038,-6.508910, -17.198439,-10.833850, -14.908766,-7.202751, -16.088295,-11.273282, -13.729237,-7.757823, -14.631229,-11.712714, -12.457196,-8.243511, -13.436037,-12.015245, -11.370179,-8.613560, -12.110275,-12.267787, -10.005626,-9.052992, -10.768850,-12.499067, -8.664201,-9.376785, -8.964866,-12.753475, -7.438416,-9.605884, -7.785352,-12.892243, -6.212646,-9.769960, -6.467054,-12.961627, -4.963734,-9.885601, -5.264398,-12.984527, -3.576053,-9.978113, -3.784204,-12.984527, -2.558420,-10.047497, -2.535292,-12.938499, -1.357581,-10.085039, -1.242850,-12.847692, -0.155834,-10.069830, 0.164321,-12.707219, 1.303959,-9.954985, 1.465856,-12.475939, 2.599132,-12.267786, 2.390980,-9.885600, 3.687853,-12.015082, 3.524252,-9.769960, 4.796293,-11.735842, 4.750037,-9.561808, 5.952694,-11.388922, 5.790798,-9.376783, 7.109095,-10.949489, 7.016582,-9.099247, 8.265495,-10.510056, 8.104122,-8.775978, 9.236873,-10.024368, 9.099150,-8.476358, 10.046353,-9.584936, 10.046353,-8.104743, 11.133369,-8.960480, 10.994601,-7.711566, 11.965979,-8.428535, 11.835783,-7.312407, 12.937355,-7.734694, 12.752331,-6.809574, 13.769963,-6.971470, 13.376787,-6.439526, 13.793092,-6.601422, -24.909855,4.801398, -23.629250,6.168823, -22.609106,7.080441, -21.523849,7.818417, -20.047897,8.773444, -16.064203,5.716873, -18.505602,9.553356, -14.762125,6.437667, -16.784998,10.274150, -13.320537,7.158461, -14.948135,10.925190, -11.809195,7.716495, -13.274034,11.343716, -10.600121,8.042015, -11.716189,11.669235, -8.949271,8.460540, -10.006121,11.935536, -7.740197,8.693054, -8.680791,12.071956, -6.554375,8.902317, -7.251918,12.180766, -5.345313,9.065077, -5.880095,12.227269, -4.252496,9.158083, -4.592607,12.225502, -3.098744,9.230723, -3.127769,12.177880, -1.764595,9.274340, -1.700456,12.087761, -0.299756,9.251088, -0.067242,11.925001, 0.955821,9.181334, 1.374346,11.717439, 2.095140,9.088328, 2.676425,11.436721, 3.346351,8.972071, 4.234270,11.064698, 4.536538,8.762808, 5.373590,10.751894, 5.652611,8.576797, 6.396656,10.436911, 6.791930,8.344283, 7.373216,10.041636, 7.861495,8.088517, 8.675295,9.506853, 8.931060,7.716495, 9.837865,8.925568, 10.047128,7.274718, 10.982452,8.276708, 10.930682,6.856193, 11.923046,7.667813, 11.790984,6.391164, 13.057097,6.796975, 12.604784,5.926136, 13.819125,6.148114, 13.260853,5.540919, 13.653261,5.522753, 13.906863,5.763376, 17.375095,4.604287 );

this data is very easy to render, do it like this:

procedure renderthisvertex(index: integer);
begin
glnormal3f(0, 0, 1); // normal direction
glvertex2fv(@vertices[index * 2]);
end;

// opengl logo color
glcolor4ub($65, $99, $CB, $FF);

glbegin(gl_triangles);

for i:= 0 to high(indices) div 3 do begin
renderthisvertex(indices[i * 3 + 0]);
renderthisvertex(indices[i * 3 + 1]);
renderthisvertex(indices[i * 3 + 2]);
end;

glend;


*Note that this opengl mesh might not be allowed to be used to reprisent the OpenGL logo, contact SGI about this.

Website and content is copyright Jernej L. RSS