cl/gl interop : clCreateFromGLTexture2D with GLIntercept fails on AMD FUSION - opengl

I have a clgl interop executable which is making a call to clCreateFromGLTexture2D. It fails for that call...
clCreateFromGLTexture2D( 0x06691828, CL_MEM_WRITE_ONLY, GL_TEXTURE_2D, 0, 1, CL_INVALID_GL_OBJECT ) = 0x00000000
I am using GLIntercept. here. So I am using Opengl32.dll generated by GLIntercept here...
Ok, it works on Nvidia GTX and runs standalone fine without intercept on AMD FUSION with AMD Radeon GPU. However, it fails when using the open source GLIntercept.
The clgl interop test code is posted there if you are interested in downloading and recreating the problem..
Does anyone have an idea how to fix it?
Here are some statements from the my debug log... If it helps..
I created an open issue/ticket on GLIntercept code website if you are interested in downloading the test sample clgl interop code which I am using for this...
glutInit( ) =
glutInitDisplayMode( 12 )
glutInitWindowSize( 320, 258 )
wglChoosePixelFormat( 38010929, 001EF950 PIXELFORMATDESCRIPTOR { nSize 28 nVersion 1 dwFlags 25 PFD_DOUBLEBUFFER PFD_DRAW_TO_WINDOW PFD_SUPPORT_OPENGL iPixelType PFD_TYPE_RGBA cColorBits cRedBits cRedShift cGreenBits cGreenShift cBlueBits cBlueShift cAlphaBits cAlphaShift cAccumBits cAccumRedBits cAccumGreenBits cAccumBlueBits cAccumAlphaBits cDepthBits cStencilBits } 28 ) = 0x2
wglGetCurrentContext( ) = 0x00000000
wglGetCurrentDC( ) = 0x00000000
glutCreateWindow( OpenGL-CL interraction! ) = 0x1
glClearColor( 0, 0, 0, 0 )
glEnable( b71 )
glEnable( de1 )
glGenTextures( 1, 0125B194 { 1} )
glBindTexture( de1, 1 )
glTexEnvi( 2300, 2200, 1e01 )
glTexParameteri( de1, 2801, 2600 )
glTexParameteri( de1, 2800, 2600 )
glTexImage2D( de1, 0, 8058, 100, 100, 0, 1908, 1401, 00C2E858 )
glBindTexture( de1, 0 )
clGetPlatformIDs( 0, NULL, 1 ) = CL_SUCCESS
clGetPlatformIDs( 1, 05744514, NULL ) = CL_SUCCESS
clGetDeviceIDs( 05744514, CL_DEVICE_TYPE_GPU, 1, 04516F40 , NULL ) = CL_SUCCESS
clGetDeviceInfo( 0x04516F40, CL_DEVICE_NAME, 400, BeaverCreek, NULL ) = CL_SUCCESS
clGetDeviceInfo( 0x04516F40, CL_DEVICE_EXTENSIONS, 400, cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_gl_sharing cl_ext_atomic_counters_32 cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_popcnt cl_khr_d3d10_sharing , NULL ) = CL_SUCCESS
wglGetCurrentContext( ) = 0x00020000
wglGetCurrentDC( ) = 0x38010929
wglGetCurrentContext( ) = 0x00020000
clCreateContext( 8200 0x20000 8203 0x38010929 4228 0x5744514, 1, 04516F40 , NULL, NULL, CL_SUCCESS ) = 0x06A30828
clCreateCommandQueue( 0x06A30828, 0x04516F40, 0, CL_SUCCESS ) = 0x06A69900
clCreateProgramWithSource( 0x06A30828, 1, C:\Users\inteltc\Documents\clgl_latest\Debug\clgl_1.program, CL_SUCCESS ) = 0x06A6B9F8
clBuildProgram( 0x06A6B9F8, 0, NULL, NULL, NULL, NULL ) = CL_SUCCESS
clCreateKernel( 0x06A6B9F8, kernel1, CL_SUCCESS ) = 0x045266E0
clCreateFromGLTexture2D( 0x06A30828, CL_MEM_WRITE_ONLY, GL_TEXTURE_2D, , 0, 1, CL_INVALID_GL_OBJECT ) = 0x00000000

I don't see that you called glTexImage2D for your texture object, and that basically leaves the texture width, height and mipmaps undefined, so it's pretty obvious why it fails.

Related

SDL terminates when creating renderer

When I run this code:
#include <iostream>
#include <SDL.h>
#include <stdexcept>
#include <GL/gl3w.h>
int main() try {
if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER ) != 0 )
throw std::runtime_error{ "Could not initialize sdl" };
SDL_GL_SetAttribute( SDL_GL_CONTEXT_FLAGS, 0 );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 0 );
// Create window with graphics context
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 24 );
SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 8 );
auto window_flags = (SDL_WindowFlags) ( SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI );
auto window = SDL_CreateWindow( "window", SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags );
auto gl_context = SDL_GL_CreateContext( window );
SDL_GL_MakeCurrent( window, gl_context );
SDL_GL_SetSwapInterval( 1 ); // Enable vsync
if ( gl3wInit() != 0 )
throw std::runtime_error{ "Unable to initialize OpenGL loader" };
auto renderer = SDL_CreateRenderer( window, -1, 0 );
return 0;
}
catch ( std::exception& e ) {
std::cerr << e.what() << "\n";
return -1;
}
It produces the following output:
X Error of failed request: GLXBadDrawable
Major opcode of failed request: 151 (GLX)
Minor opcode of failed request: 5 (X_GLXMakeCurrent)
Serial number of failed request: 259
Current serial number in output stream: 259
Process finished with exit code 1
When I comment out the line that sets the opengl version, it runs fine.
What is causing this error and why does SDL_CreateRenderer terminate instead of returning a null pointer?

why openvr GetPoseActionDataForNextFrame is not getting position of controllers

I'm trying to create simple application using OpenVR and OpenGL. Headset tracking and rendering is working, but I'm not getting position of controllers.
Example code from here https://github.com/ValveSoftware/openvr/wiki/API-Documentation works, and is reading my controllers fine.
I'm using json file copied from that example.
Here is simplified version of my code:
vr::IVRSystem* vrSystem= vr::VR_Init( &eError, vr::VRApplication_Scene );
vrSystem->GetRecommendedRenderTargetSize( &vrScreenWidth, &vrScreenHeight );
initWinapi();
initOpenGL();
gladLoadGL();
createTexturesForVrRendering(vrScreenWidth,vrScreenHeight);
vrProjection[vr::Eye_Left] = ConvertSteamVRMatrix44ToMatrix4( vrSystem->GetProjectionMatrix( vr::Eye_Left , 0.001, 100.0 ) );
vrProjection[vr::Eye_Right]= ConvertSteamVRMatrix44ToMatrix4( vrSystem->GetProjectionMatrix( vr::Eye_Right, 0.001, 100.0 ) );
vrEyeTransform[vr::Eye_Left] = ConvertSteamVRMatrix34ToMatrix4( vrSystem->GetEyeToHeadTransform( vr::Eye_Left ) );
vrEyeTransform[vr::Eye_Left].invert();
vrEyeTransform[vr::Eye_Right]= ConvertSteamVRMatrix34ToMatrix4( vrSystem->GetEyeToHeadTransform( vr::Eye_Right ) );
vrEyeTransform[vr::Eye_Right].invert();
compileShaders();
vr::VRCompositor();
vr::VRActionSetHandle_t actionsetDemo = vr::k_ulInvalidActionSetHandle;
vr::VRActionHandle_t handLeftPositionAction = vr::k_ulInvalidActionHandle;
vr::VRActionHandle_t handRightPositionAction = vr::k_ulInvalidActionHandle;
vr::VRActionHandle_t m_actionHideCubes= vr::k_ulInvalidActionHandle;
vr::VRInput()->SetActionManifestPath( "C:\\src\\helloWorldVr\\openvr_actions.json" );
vr::VRInput()->GetActionHandle( "/actions/demo/in/HideCubes", &m_actionHideCubes );
vr::VRInput()->GetActionSetHandle( "/actions/demo", &actionsetDemo );
vr::VRInput()->GetActionHandle( "/actions/demo/in/Hand_Left", &handLeftPositionAction );
vr::VRInput()->GetActionHandle( "/actions/demo/in/Hand_Right", &handRightPositionAction );
while( appStillRunning ){
static vr::TrackedDevicePose_t m_rTrackedDevicePose[vr::k_unMaxTrackedDeviceCount];
vr::VRCompositor()->WaitGetPoses( m_rTrackedDevicePose, vr::k_unMaxTrackedDeviceCount, NULL, 0 );
if( m_rTrackedDevicePose[vr::k_unTrackedDeviceIndex_Hmd].bPoseIsValid ){
vrHeadPosInv = Matrix4(
m_rTrackedDevicePose[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking.m[0][0], m_rTrackedDevicePose[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking.m[1][0], m_rTrackedDevicePose[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking.m[2][0], 0.0,
m_rTrackedDevicePose[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking.m[0][1], m_rTrackedDevicePose[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking.m[1][1], m_rTrackedDevicePose[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking.m[2][1], 0.0,
m_rTrackedDevicePose[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking.m[0][2], m_rTrackedDevicePose[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking.m[1][2], m_rTrackedDevicePose[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking.m[2][2], 0.0,
m_rTrackedDevicePose[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking.m[0][3], m_rTrackedDevicePose[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking.m[1][3], m_rTrackedDevicePose[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking.m[2][3], 1.0f
);
vrHeadPosInv.invert();
}
while( PeekMessage( &msg, 0, 0, 0, PM_REMOVE ) ){
TranslateMessage( &msg );
DispatchMessage( &msg );
}
vr::VREvent_t event;
while( vrSystem->PollNextEvent( &event, sizeof( event ) ) ){}
vr::VRActiveActionSet_t actionSet = { 0 };
actionSet.ulActionSet = actionsetDemo;
vr::VRInput()->UpdateActionState( &actionSet, sizeof( actionSet ), 1 );
vr::InputPoseActionData_t poseData;
vr::EVRInputError res = vr::VRInput()->GetPoseActionDataForNextFrame( handLeftPositionAction, vr::TrackingUniverseStanding, &poseData, sizeof( poseData ), vr::k_ulInvalidInputValueHandle );
if( res == vr::VRInputError_None ){
if( poseData.bActive && poseData.pose.bPoseIsValid ){ /// poseData.bActive is always false
vrHandPos[vr::Eye_Left]= vrHmdMatrix34_t2Matrix4( poseData.pose.mDeviceToAbsoluteTracking );
}
}
res = vr::VRInput()->GetPoseActionDataForNextFrame( handRightPositionAction, vr::TrackingUniverseStanding, &poseData, sizeof( poseData ), vr::k_ulInvalidInputValueHandle );
if( res == vr::VRInputError_None ){
if( poseData.bActive && poseData.pose.bPoseIsValid ){ /// poseData.bActive is always false
vrHandPos[vr::Eye_Right] = vrHmdMatrix34_t2Matrix4( poseData.pose.mDeviceToAbsoluteTracking );
}
}
renderScene();
vr::Texture_t leftEyeTexture = { (void*)(uintptr_t)vrScreenTexture[0], vr::TextureType_OpenGL, vr::ColorSpace_Gamma };
vr::VRCompositor()->Submit( vr::Eye_Left, &leftEyeTexture );
vr::Texture_t rightEyeTexture = { (void*)(uintptr_t)vrScreenTexture[1], vr::TextureType_OpenGL, vr::ColorSpace_Gamma };
vr::VRCompositor()->Submit( vr::Eye_Right, &rightEyeTexture );
glFinish();
SwapBuffers( hdc );
glClearColor( 0, 0, 0, 1 );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glFlush();
glFinish();
}
vr::VR_Shutdown();
shutDownOpenGL();
Am I missing something ?

How to get word list using ISpLexicon::GetWords?

I'm developping a Text-To-Speech application using Microsoft SAPI. I found out that it is possible to add customized prononciations of words in a dictionnary (correct me if I'm wrong). I implemented a function which allows to add words into this dictionnary. Here is my code:
int addPrononciation( const char* addPron, const char* phon )
{
hr = cpLexicon.CoCreateInstance( CLSID_SpLexicon );
hr = cpContainerLexicon.CoCreateInstance( CLSID_SpLexicon );
hr = SpEnumTokens( SPCAT_VOICES, NULL, NULL, &cpEnum );
cpEnum->Item( saveVoice, &cpVoiceToken ); //get saveVoice token defined at line 136
cpVoice->SetVoice( cpVoiceToken ); //Initialization of the voice
hr = cpContainerLexicon->AddLexicon( cpLexicon, eLEXTYPE_APP );
langId = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US );
hr = SpCreatePhoneConverter( langId, NULL, NULL, &cpPhoneConv );
int wchars_num = MultiByteToWideChar( CP_ACP, 0, addPron, -1, NULL, 0 );
wchar_t* pronWstr = new wchar_t[ wchars_num ];
MultiByteToWideChar( CP_ACP, 0, addPron, -1, pronWstr, wchars_num );
int phonWchars_num = MultiByteToWideChar( CP_ACP, 0, phon, -1, NULL, 0 );
wchar_t* phonWstr = new wchar_t[ phonWchars_num ];
MultiByteToWideChar( CP_ACP, 0, phon, -1, phonWstr, phonWchars_num );
if(SUCCEEDED( hr ))
{
hr = cpPhoneConv->PhoneToId( phonWstr, wszId );
hr = cpVoice->Speak( phonWstr, SPF_DEFAULT, NULL );
hr = cpLexicon->AddPronunciation( pronWstr, langId, SPPS_Noun, wszId );
hr = cpVoice->Speak( pronWstr, SPF_DEFAULT, NULL );
if( SUCCEEDED( hr ) )
{
printf( "Success\n" );
}
else
{
printf( "Failed\n" );
}
}
cpEnum.Release();
cpVoiceToken.Release();
cpContainerLexicon.Release();
cpLexicon.Release();
cpPhoneConv.Release();
delete new wchar_t[ wchars_num ];
delete new wchar_t[ phonWchars_num ];
return true;
}
Now I would like to list these words using ISpLexicon::GetWords.
I already read the documentation on the Microsoft website and tried to implement the function, but I can't figure out how to initialize the variable spWordList.
Here is my code:
ZeroMemory( &spWordList, sizeof( spWordList ) );
if( SUCCEEDED( hr ) )
{
hr = cpLexicon->GetWords( eLEXTYPE_APP, &dwGeneration, &dwCookie, &spWordList );
printf( "Words: %ls\n", spWordList ); //print words but the output is null
}
CoTaskMemFree( spWordList.pvBuffer );
I'm triying to print the words, but the output is null. I think the spWordList variable is not initialized. Here is a screenshot of the variable values.
How can I initialize it?
I found out how to initialize spWordList. You have to replace eLEXTYPE_APP with eLEXTYPE_USER. However, you can keep both of them like I did. Below you will find an example on how it lists the words.
ZeroMemory( &spWordList, sizeof( spWordList ) );
hr = S_FALSE;
if( hr == S_FALSE )
{
hr = cpLexicon->GetWords( eLEXTYPE_USER | eLEXTYPE_APP, &dwGeneration, &dwCookie, &spWordList );
for( spWord = spWordList.pFirstWord; spWord != NULL; spWord = spWord->pNextWord )
{
for( spWordPron = spWord->pFirstWordPronunciation; spWordPron != NULL; spWordPron = spWordPron->pNextWordPronunciation )
{
printf( "Words in dictionnary: %i\n", dwGeneration );
printf( "Word: %ls\n", spWord->pszWord );
//you can also display the pronunciation of words if you wish
}
}
}
CoTaskMemFree( spWordList.pvBuffer );
In the code, I loop through the entire dictionnary. Notice that the listed words are displayed randomly. I'll update my answer if I find other important information about ISpLexicon::GetWords

Creating Seperate Context for Each GPU while having one display monitor

I want to create one GL Context for each GPU on Linux using the GLX. As nVIDIA Slides show, it is pretty simple and I just have to use ":0.0" for the first gpu and ":0.1" for the second one in XOpenDisplay function. I have tried it but it only works with ":0.0" but not with ":0.1". I have two gpus: GTX 980 and GTX 970. Also, as the xorg.conf shows the Xinerama is disabled. Furthermore, I only have one display monitor and it is connected to the GTX 980.
Do you have any idea about how to fix that? or what is missing?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <GL/gl.h>
#include <GL/glx.h>
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
// Helper to check for extension string presence. Adapted from:
// http://www.opengl.org/resources/features/OGLextensions/
static bool isExtensionSupported(const char *extList, const char *extension)
{
const char *start;
const char *where, *terminator;
/* Extension names should not have spaces. */
where = strchr(extension, ' ');
if (where || *extension == '\0')
return false;
/* It takes a bit of care to be fool-proof about parsing the
OpenGL extensions string. Don't be fooled by sub-strings,
etc. */
for (start=extList;;) {
where = strstr(start, extension);
if (!where)
break;
terminator = where + strlen(extension);
if ( where == start || *(where - 1) == ' ' )
if ( *terminator == ' ' || *terminator == '\0' )
return true;
start = terminator;
}
return false;
}
static bool ctxErrorOccurred = false;
static int ctxErrorHandler( Display *dpy, XErrorEvent *ev )
{
ctxErrorOccurred = true;
return 0;
}
int main(int argc, char* argv[])
{
Display *display = XOpenDisplay(":0.1");
if (!display)
{
printf("Failed to open X display\n");
exit(1);
}
// Get a matching FB config
static int visual_attribs[] =
{
GLX_X_RENDERABLE , True,
GLX_DRAWABLE_TYPE , GLX_WINDOW_BIT,
GLX_RENDER_TYPE , GLX_RGBA_BIT,
GLX_X_VISUAL_TYPE , GLX_TRUE_COLOR,
GLX_RED_SIZE , 8,
GLX_GREEN_SIZE , 8,
GLX_BLUE_SIZE , 8,
GLX_ALPHA_SIZE , 8,
GLX_DEPTH_SIZE , 24,
GLX_STENCIL_SIZE , 8,
GLX_DOUBLEBUFFER , True,
//GLX_SAMPLE_BUFFERS , 1,
//GLX_SAMPLES , 4,
None
};
int glx_major, glx_minor;
// FBConfigs were added in GLX version 1.3.
if ( !glXQueryVersion( display, &glx_major, &glx_minor ) ||
( ( glx_major == 1 ) && ( glx_minor < 3 ) ) || ( glx_major < 1 ) )
{
printf("Invalid GLX version");
exit(1);
}
printf( "Getting matching framebuffer configs\n" );
int fbcount;
GLXFBConfig* fbc = glXChooseFBConfig(display, DefaultScreen(display), visual_attribs, &fbcount);
if (!fbc)
{
printf( "Failed to retrieve a framebuffer config\n" );
exit(1);
}
printf( "Found %d matching FB configs.\n", fbcount );
// Pick the FB config/visual with the most samples per pixel
printf( "Getting XVisualInfos\n" );
int best_fbc = -1, worst_fbc = -1, best_num_samp = -1, worst_num_samp = 999;
int i;
for (i=0; i<fbcount; ++i)
{
XVisualInfo *vi = glXGetVisualFromFBConfig( display, fbc[i] );
if ( vi )
{
int samp_buf, samples;
glXGetFBConfigAttrib( display, fbc[i], GLX_SAMPLE_BUFFERS, &samp_buf );
glXGetFBConfigAttrib( display, fbc[i], GLX_SAMPLES , &samples );
printf( " Matching fbconfig %d, visual ID 0x%2x: SAMPLE_BUFFERS = %d,"
" SAMPLES = %d\n",
i, vi -> visualid, samp_buf, samples );
if ( best_fbc < 0 || samp_buf && samples > best_num_samp )
best_fbc = i, best_num_samp = samples;
if ( worst_fbc < 0 || !samp_buf || samples < worst_num_samp )
worst_fbc = i, worst_num_samp = samples;
}
XFree( vi );
}
GLXFBConfig bestFbc = fbc[ best_fbc ];
// Be sure to free the FBConfig list allocated by glXChooseFBConfig()
XFree( fbc );
// Get a visual
XVisualInfo *vi = glXGetVisualFromFBConfig( display, bestFbc );
printf( "Chosen visual ID = 0x%x\n", vi->visualid );
printf( "Creating colormap\n" );
XSetWindowAttributes swa;
Colormap cmap;
swa.colormap = cmap = XCreateColormap( display,
RootWindow( display, vi->screen ),
vi->visual, AllocNone );
swa.background_pixmap = None ;
swa.border_pixel = 0;
swa.event_mask = StructureNotifyMask;
printf( "Creating window\n" );
Window win = XCreateWindow( display, RootWindow( display, vi->screen ),
0, 0, 100, 100, 0, vi->depth, InputOutput,
vi->visual,
CWBorderPixel|CWColormap|CWEventMask, &swa );
if ( !win )
{
printf( "Failed to create window.\n" );
exit(1);
}
// Done with the visual info data
XFree( vi );
XStoreName( display, win, "GL 3.0 Window" );
printf( "Mapping window\n" );
XMapWindow( display, win );
// Get the default screen's GLX extension list
const char *glxExts = glXQueryExtensionsString( display,
DefaultScreen( display ) );
// NOTE: It is not necessary to create or make current to a context before
// calling glXGetProcAddressARB
glXCreateContextAttribsARBProc glXCreateContextAttribsARB = 0;
glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc)
glXGetProcAddressARB( (const GLubyte *) "glXCreateContextAttribsARB" );
GLXContext ctx = 0;
// Install an X error handler so the application won't exit if GL 3.0
// context allocation fails.
//
// Note this error handler is global. All display connections in all threads
// of a process use the same error handler, so be sure to guard against other
// threads issuing X commands while this code is running.
ctxErrorOccurred = false;
int (*oldHandler)(Display*, XErrorEvent*) =
XSetErrorHandler(&ctxErrorHandler);
// Check for the GLX_ARB_create_context extension string and the function.
// If either is not present, use GLX 1.3 context creation method.
if ( !isExtensionSupported( glxExts, "GLX_ARB_create_context" ) ||
!glXCreateContextAttribsARB )
{
printf( "glXCreateContextAttribsARB() not found"
" ... using old-style GLX context\n" );
ctx = glXCreateNewContext( display, bestFbc, GLX_RGBA_TYPE, 0, True );
}
// If it does, try to get a GL 3.0 context!
else
{
int context_attribs[] =
{
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 0,
//GLX_CONTEXT_FLAGS_ARB , GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
None
};
printf( "Creating context\n" );
ctx = glXCreateContextAttribsARB( display, bestFbc, 0,
True, context_attribs );
// Sync to ensure any errors generated are processed.
XSync( display, False );
if ( !ctxErrorOccurred && ctx )
printf( "Created GL 3.0 context\n" );
else
{
// Couldn't create GL 3.0 context. Fall back to old-style 2.x context.
// When a context version below 3.0 is requested, implementations will
// return the newest context version compatible with OpenGL versions less
// than version 3.0.
// GLX_CONTEXT_MAJOR_VERSION_ARB = 1
context_attribs[1] = 1;
// GLX_CONTEXT_MINOR_VERSION_ARB = 0
context_attribs[3] = 0;
ctxErrorOccurred = false;
printf( "Failed to create GL 3.0 context"
" ... using old-style GLX context\n" );
ctx = glXCreateContextAttribsARB( display, bestFbc, 0,
True, context_attribs );
}
}
// Sync to ensure any errors generated are processed.
XSync( display, False );
// Restore the original error handler
XSetErrorHandler( oldHandler );
if ( ctxErrorOccurred || !ctx )
{
printf( "Failed to create an OpenGL context\n" );
exit(1);
}
// Verifying that context is a direct context
if ( ! glXIsDirect ( display, ctx ) )
{
printf( "Indirect GLX rendering context obtained\n" );
}
else
{
printf( "Direct GLX rendering context obtained\n" );
}
printf( "Making context current\n" );
glXMakeCurrent( display, win, ctx );
glClearColor( 0, 0.5, 1, 1 );
glClear( GL_COLOR_BUFFER_BIT );
glXSwapBuffers ( display, win );
sleep( 1 );
glClearColor ( 1, 0.5, 0, 1 );
glClear ( GL_COLOR_BUFFER_BIT );
glXSwapBuffers ( display, win );
sleep( 1 );
glXMakeCurrent( display, 0, 0 );
glXDestroyContext( display, ctx );
XDestroyWindow( display, win );
XFreeColormap( display, cmap );
XCloseDisplay( display );
return 0;
}
The reason it works with ":0.0" but not with ":0.1" is because they are the X display and screen numbers. ":0.0" means the first screen on the first display and ":0.1" means the second screen on the first display.
These numbers are for selecting which monitor you wish to display the window to and not which GPU you wish to use. As you have only one monitor attached you only have one screen so ":0.1" fails.
I believe the slides expect you to have two or more monitors attached, each driven by a different GPU.

function does not take 0 arguments / error C2660 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
This error I've managed to solve once more had some problems with the computer and I lost everything.
Could you help me?
I lack only resolve this error, More can not in any way.
------ Build started: Project: Ruby, Configuration: Release Win32 ------
main.cpp
main.cpp(172): error C2660: 'EscanerProcessoMemoria' :
function does not take 0 arguments
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The line :
// main.cpp
#include "StdAfx.h"
#include "MNameColor.h"
#include "MRealHooks.h"
#include "MMrsDecryptor.h"
#include "MInitialCostume.h"
#include "MD5Wrapper.h"
#include "ZGameClient.h"
#include "ZPost.h"
#include "Globais.h"
#include "D3D.h"
#include "MrsCheck.h"
#include "GunzEXP.h"
#include "Hack.h"
#include "HotKeys.h"
#include "Contador.h"
#include "Heuristica.h"
void Exchange1( DWORD Pointer, BYTE Value ){
DWORD Old;
VirtualProtect( (LPVOID)Pointer, 1, PAGE_EXECUTE_READWRITE, &Old );
*(BYTE*)Pointer = Value;
VirtualProtect( (LPVOID)Pointer, 1, Old, &Old );
}
void Exchange2( DWORD Pointer, WORD Value ){
DWORD Old;
VirtualProtect( (LPVOID)Pointer, 2, PAGE_EXECUTE_READWRITE, &Old );
*(WORD*)Pointer = Value;
VirtualProtect( (LPVOID)Pointer, 2, Old, &Old );
}
void Exchange4( DWORD Pointer, DWORD Value ){
DWORD Old;
VirtualProtect( (LPVOID)Pointer, 4, PAGE_EXECUTE_READWRITE, &Old );
*(DWORD*)Pointer = Value;
VirtualProtect( (LPVOID)Pointer, 4, Old, &Old );
}
DWORD ToDword( ... ){
__asm{
mov eax, dword ptr ss:[esp + 4]
retn
}
}
void Apply( void ){
md5wrapper mRunnable;
char szModule[ 256 ];
GetModuleFileName( GetModuleHandle( NULL ), szModule, 256 );
string mPath = string( szModule );
unsigned long Old;
MColor1Detour.Detour( (PBYTE)0x621C00, (PBYTE)GetUserGradeIDColor );
MColor1Detour.Apply();
MColor2Detour.Detour( (PBYTE)0x4A17A0, (PBYTE)GetUserGradeIDColor );
MColor2Detour.Apply();
StageDetour.Detour( (PBYTE)0x44BF40, (PBYTE)StageCreateHandler );
StageDetour.Apply();
ZAppUpdateDetour.Detour( (PBYTE)0x499720, (PBYTE)ZAppOnUpdate, true );
ZAppUpdateDetour.Apply();
SharedTable.Detour( (PBYTE)0x51EAB0, (PBYTE)MAddSharedCommandTable, true );
SharedTable.Apply();
OnRestoreDetour.Detour( (PBYTE)0x4E8DA0, (PBYTE)OnRestore, true );
OnRestoreDetour.Apply();
UpdateCostumes();
//VP
VirtualProtect( (LPVOID)0x6282F8, 15, PAGE_EXECUTE_READWRITE, &Old );
memcpy( (LPVOID)0x6282F8, "Carregando ...\0", 15 );
VirtualProtect( (LPVOID)0x6282F8, 15, Old, &Old );
VirtualProtect( (LPVOID)0x4C7C47, 3, PAGE_EXECUTE_READWRITE, &Old );
memcpy( (LPVOID)0x4C7C47, "\xC2\x10\x00", 3 );
VirtualProtect( (LPVOID)0x4C7C47, 3, Old, &Old );
VirtualProtect( (LPVOID)0x621E1B, 10, PAGE_EXECUTE_READWRITE, &Old );
memcpy( (LPVOID)0x621E1B, "\xEB\x10\xEB\x06\x90\x90\x90\x90\x90\x90", 10 );
VirtualProtect( (LPVOID)0x621E1B, 10, Old, &Old );
VirtualProtect( (LPVOID)0x621E2D, 10, PAGE_EXECUTE_READWRITE, &Old );
memcpy( (LPVOID)0x621E2D, "\x7F\xF6\x83\xEC\x08\xE9\x6C\xA5\xEE\xFF", 10 );
VirtualProtect( (LPVOID)0x621E2D, 10, Old, &Old );
VirtualProtect( (LPVOID)0x4982C1, 3, PAGE_EXECUTE_READWRITE, &Old );
memcpy( (LPVOID)0x4982C1, "\x08\xF7\x0D", 3 );
VirtualProtect( (LPVOID)0x4982C1, 3, Old, &Old );
VirtualProtect( (LPVOID)0x478558, 2, PAGE_EXECUTE_READWRITE, &Old );
memcpy( (PVOID)0x478558, "\xEB\x1B", 2 );
VirtualProtect( (LPVOID)0x478558, 2, Old, &Old );
VirtualProtect( (LPVOID)0x4785F8, 2, PAGE_EXECUTE_READWRITE, &Old );
memcpy( (PVOID)0x4785F8, "\xEB\x07", 2 );
VirtualProtect( (LPVOID)0x4785F8, 2, Old, &Old );
VirtualProtect( (LPVOID)0x4C7202, 2, PAGE_EXECUTE_READWRITE, &Old );
memcpy( (PVOID)0x4C7202, "\xEB", 2 );
VirtualProtect( (LPVOID)0x4C7202, 2, Old, &Old );
VirtualProtect( (LPVOID)0x4A9256, 2, PAGE_EXECUTE_READWRITE, &Old );
memcpy( (PVOID)0x4A9256, "\xEB", 2 );
VirtualProtect( (LPVOID)0x4A9256, 2, Old, &Old );
VirtualProtect( (LPVOID)0x4C6A39, 2, PAGE_EXECUTE_READWRITE, &Old );
memcpy( (PVOID)0x4C6A39, "\xE8\xE2\xD3\xFF\xFF", 2 );
VirtualProtect( (LPVOID)0x4C6A39, 2, Old, &Old );
//End
Exchange4( 0x62F17C, ToDword( &ZGameClient::OnCommand ) );
Exchange4( 0x62B30C, ToDword( &ZCharacter::OnDamaged ) );
Exchange4( 0x62B204, ToDword( &ZMyCharacter::OnDamaged ) );
ExchangeCall( 4728632, ToDword( &ZCharacter::OnDamaged ) );
ApplyHooks( 1 );
Exchange4( 0x4366A2, 8900 );
Exchange2( 0x40830F, 37008 );
Exchange4( 0x40830B, 48955826 );
Exchange1( 0x621CA9, 125 );
Exchange1( 0x45C742, 0 );
Exchange1( 0x4973D8, 56 );
Exchange1( 0x45C27A, 0 );
Exchange4( 0x41A342, 0x800000 );
Exchange4( 0x41AA20, 0x800000 );
Exchange4( 0x41AAB2, 0x800000 );
Exchange4( 0x41B9BA, 0x800000 );
Exchange4( 0x41C2EE, 0x800000 );
Exchange4( 0x43908A, 0x800000 );
Exchange4( 0x4C4B95, 0x800000 );
ExchangeReplaceCall( 0x42AF40, (unsigned long)&ZPostChannelChat );
ExchangeReplaceCall( 0x481170, (unsigned long)&ZPostSkill );
ExchangeReplaceCall( 0x42ADC0, (unsigned long)&ZPostPeerChat );
pGunz = (unsigned char*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 2231296 );
if( pGunz ){
for( int n = 0; n < 2231296; n++ ){
pGunz[ n ] = *(unsigned char*)(n + 4198400);
}
}
}
void Escaners(){
EscanerProcessoMemoria();
EscanerProcessoSistema();
}
int __stdcall DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpParam ){
DisableThreadLibraryCalls( hModule );
EscondeProtecao( hModule );
if( dwReason == DLL_PROCESS_ATTACH ){
Apply( );
CheckFiles();
ContarArquivos();
VerificarHack();
CreateThread (0,0,(LPTHREAD_START_ROUTINE)GunzEXP,0,0,0);
CreateThread (0,0,(LPTHREAD_START_ROUTINE)ChecarHotKeys,0,0,0);
CreateThread (0,0,(LPTHREAD_START_ROUTINE)Escaners,0,0,0);
CreateThread (0,0,(LPTHREAD_START_ROUTINE)TxtCheckWindow,0,0,0);
}
return true;
}
Please Help me
Check the declaration of EscanerProcessoMemoria(), and ensure it takes 0 arguments. If not, make sure you include any headers that might have potentially overloaded this function with 0 arguments.
Other than that, the compiler is pretty much giving you the answer. Bottom line: Check the documentation of EscanerProcessoMemoria()...if there is any.