Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am stucked in a problem assigning a string, converted by using stringify, to a character pointer. It seemed that the character pointer(char * particleVS ) is taking only first 256 character of the string. My working in 64bit platform. Also the same code works fine for 32bit platform. I couldn't figure out why only 256 character is only being assigned in a char pointer variable in 64 bit platform could anyone please help.. Thank in advance.

code is given below
C++
#define STRINGIFY(A) #A

const char *particleVS = STRINGIFY(
uniform float pointRadius;  // point size in world space    \n
uniform float pointScale;   // scale to calculate size in pixels \n
uniform vec4 eyePos;                                        \n
void main()                                                 \n
{                                                           \n
	vec4 wpos = vec4(gl_Vertex.xyz, 1.0);                   \n
    gl_Position = gl_ModelViewProjectionMatrix * wpos;      \n

    // calculate window-space point size                    \n
    vec4 eyeSpacePos = gl_ModelViewMatrix * wpos;           \n
    float dist = length(eyeSpacePos.xyz);                   \n
    gl_PointSize = pointRadius * (pointScale / dist);       \n

    gl_TexCoord[0] = gl_MultiTexCoord0; // sprite texcoord  \n
    gl_TexCoord[1] = eyeSpacePos;                           \n

    gl_FrontColor = gl_Color;                               \n
}                                                           \n
);
Posted
Comments
Richard MacCutchan 14-May-13 11:32am    
Like you, I tested this in 32-bit and it works fine. Unfortunately I do not have a 64-bit capable compiler so cannot test it fully. However, are you sure that this is the only way to generate this string?
amsainju 15-May-13 3:30am    
I tried other methods too but the result is same.. thank you for your consideration.
Richard MacCutchan 15-May-13 4:15am    
The only thing I can think of is that somehow there is a character in the string that is getting misinterpreted somehow. But, as I said above, this seems a rather complicated way of generating a string.
amsainju 15-May-13 4:35am    
but unfortunately it works fine for 32 bit system.. thats bugging me.. if it had some misinterpreting character, it should had failed in 32 bit compile too.
Richard MacCutchan 15-May-13 4:47am    
I found this note in MSDN, which may be part of the problem, although it does not say so specifically. I would suggest you consider an alternative to using this macro (although you still have not really explained what problem you are trying to solve).

1 solution

Have you tried with W2A & A2W convertion
 
Share this answer
 
Comments
Richard MacCutchan 14-May-13 11:30am    
What does that have to do with the stringizing operator?
amsainju 15-May-13 3:29am    
no idea... i am not being able to figure out why only part of the total string is assigned.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900