473,387 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

error: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style

I want to convert a array parameter like 'double [i]' to point like "const GLfloat *"
in Visual Studio 2008,and the array is "double [i][j]".
thanks help!
Apr 17 '08 #1
2 4542
147 100+
I want to convert a array parameter like 'double [i]' to point like "const GLfloat *"
in Visual Studio 2008,and the array is "double [i][j]".
thanks help!
Post the code that gives you the compiler error.
Apr 17 '08 #2
110 100+
Since you are asking how to do this, I'm assuming you can't compile this because you don't know how...

I'm assuming you are using OpenGL, and wanting to pass an array of GLfloat's, when you have double's. And more specifically, I'm guessing for manipulating the matrix opengl uses for projections?

Maybe not, but it's a guess : )

For the 1D array:
Expand|Select|Wrap|Line Numbers
  1. // You have an array of double's called "input"
  2. //    like double input[i];
  4. // This is GLfloat *toConvertTo;  
  5. //    with i data elements allocated
  6. GLfloat toConvertTo[i]; 
  8. // Probably don't need register.  Use register with caution...
  9. //    Bad use of register can slow program down.
  10. for (register int count = 0; count < i; ++count)
  11. {
  12.   toConvertTo[i] = (GLfloat)input[i];
  13. } // End for
  15. // If passing to a parameter that takes in 
  16. //   const GLfloat *, just pass toConvertTo
  17. //   and ignore making it a const.
  18. const GLfloat *constConverteTo = toConvertTo;
Do a nestled loop (one loop inside another) similar to the above code for a 2D array of double's to GLfloats. GLfloat is usually just a "typedef float GLfloat;" which means it's equivalent to a float.

like: GLfloat pi = 3.14f; // where f tells the compiler that
// 3.14 is a float
Apr 18 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Michael Wagner | last post by:
I do some Windows kernel programming, where what I need to pass to some Kernel call is "void* Context". Sometime later, I will get that Conext back. I want to pass a class pointer to this system...
by: Matthew Del Buono | last post by:
Don't try to solve the problem. I've found a way -- around or fixing it. I'm just curious as to whether this is Microsoft's problem in their compiler or if there's a standard saying this is to be...
by: troloo | last post by:
Hello, I hope you can help me :)) The story goes as follows: I have a class with different methods and member variables. I store pointers to objects of this class inside a vector. Now, I would like...
by: DiskMan | last post by:
System: Redhat 7.2 Kernel- GCC-3.4.3 CCC-6.5.9 Binutils-2.15 Make-3.80 GTK/GLIB-2.6.7 For some reason my Linux box is suddenly having issues trying to read ;
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
by: Born Bugler | last post by:
What I'm actually talking about is, when you put the same class in different assemblies, you get two different types. This is reasonable (if you would call it) in most cases as it avoids possible...
by: Markus Dehmann | last post by:
I think this is a question about automatic type conversion, but I didn't find the answer after googling for these words ... I have a class called Value (source see below) which can hold an int...
by: krishna81m | last post by:
I am a newbie and have been trying to understand conversion from double to int and then back to int using the following code was posted on the c++ google group. Could someone help me out with...
by: lovecreatesbea... | last post by:
Gcc only gives out a warning: `assignment discards qualifiers from pointer target type' against code such as following: $ type a.c int main(void) { const char *pc; char *p = pc;
by: ma740988 | last post by:
Consider the equation (flight dynamics stuff): Yaw (Degrees) = Azimuth Angle(Radians) * 180 (Degrees) / 3.1415926535897932384626433832795 (Radians) There's a valid reason to use single...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.