Anyone know why for openGL applications must be used GLfloat (and GLint,
etc...) instead float, int, etc..?
thx,
Manuel 8 8883
Manuel wrote: Anyone know why for openGL applications must be used GLfloat (and GLint, etc...) instead float, int, etc..?
thx,
Manuel
Portability. The GL Red Book says:
"Implementation s of OpenGL have leeway in selecting which C data type to
use to represent OpenGL data types. If you resolutely use the OpenGL
defined data types throughout your application, you will avoid
mismatched types when porting your code between different implementations ."
W Marsh wrote: Portability. The GL Red Book says:
"Implementation s of OpenGL have leeway in selecting which C data type to use to represent OpenGL data types. If you resolutely use the OpenGL defined data types throughout your application, you will avoid mismatched types when porting your code between different implementations ."
Thanks.
But this is a problem with C++ too?
If I declare an "int" under windows, maybe different from an "int" under
linux or OSX ?
Regards,
Manuel
Manuel wrote: W Marsh wrote:
Portability. The GL Red Book says:
"Implementation s of OpenGL have leeway in selecting which C data type to use to represent OpenGL data types. If you resolutely use the OpenGL defined data types throughout your application, you will avoid mismatched types when porting your code between different implementations ." Thanks. But this is a problem with C++ too? If I declare an "int" under windows, maybe different from an "int" under linux or OSX ?
Regards,
Manuel
It may be. Even a char can have more than 8-bits.
Manuel wrote: W Marsh wrote:
Portability. The GL Red Book says:
"Implementation s of OpenGL have leeway in selecting which C data type to use to represent OpenGL data types. If you resolutely use the OpenGL defined data types throughout your application, you will avoid mismatched types when porting your code between different implementations ."
Thanks. But this is a problem with C++ too? If I declare an "int" under windows, maybe different from an "int" under linux or OSX ?
Yes. There is no requirement for an int to be the same size on every
platform.
sizeof returns a number of bytes. You are guaranteed that
sizeof char == 1
sizeof char <= sizeof short <= sizeof int <= sizeof long
CHAR_BIT >= 8
where CHAR_BIT, available by including the <climits> or <limits.h>
header, is the number of bits in a char (i.e. in a byte).
I believe there are also some *minimum* size guarantees for the
integral types. I'm not sure what they are, or whether they are
specified as a number of bits, a number of bytes, or a range of values
that must be accomodated.
Gavin Deane
Manuel wrote: W Marsh wrote:
Portability. The GL Red Book says:
"Implementation s of OpenGL have leeway in selecting which C data type to use to represent OpenGL data types. If you resolutely use the OpenGL defined data types throughout your application, you will avoid mismatched types when porting your code between different implementations ."
Thanks. But this is a problem with C++ too? If I declare an "int" under windows, maybe different from an "int" under linux or OSX ?
Yes. This is why there are typedefs in the various API's that use C
and C++ to nail this down on a particular implementation. Even in
the standard language we have things like size_t.
The later version of the C standard even includes some "predefined "
typedefs that assign traits to various integer types for example.
On 31 Dec 2005 06:37:11 -0800, "Gavin Deane" <de*********@ho tmail.com>
wrote in comp.lang.c++: Manuel wrote:
W Marsh wrote:
Portability. The GL Red Book says:
"Implementation s of OpenGL have leeway in selecting which C data type to use to represent OpenGL data types. If you resolutely use the OpenGL defined data types throughout your application, you will avoid mismatched types when porting your code between different implementations ."
Thanks. But this is a problem with C++ too? If I declare an "int" under windows, maybe different from an "int" under linux or OSX ?
Yes. There is no requirement for an int to be the same size on every platform.
sizeof returns a number of bytes. You are guaranteed that
sizeof char == 1 sizeof char <= sizeof short <= sizeof int <= sizeof long CHAR_BIT >= 8
where CHAR_BIT, available by including the <climits> or <limits.h> header, is the number of bits in a char (i.e. in a byte).
I believe there are also some *minimum* size guarantees for the integral types. I'm not sure what they are, or whether they are specified as a number of bits, a number of bytes, or a range of values that must be accomodated.
They are specified by a range of values, but if look at the binary
representation of the values you can easily work out the minimum
number of bits, although the actual bit usage may be greater because
padding bits are allowed in all but the "char" types.
You can see the ranges for all the integer types, including the C
"long long" type that is not part of C++, yet, here: http://www.jk-technology.com/c/inttypes.html#limits
You can easily work out the required minimum number of bits from the
required ranges:
char types, at least 8 bits
short int, at least 16 bits
int, at least 16 bits
long, at least 32 bits
long long (C since 1999, not official in C++) 64 bits
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++ http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Jack Klein wrote: You can see the ranges for all the integer types, including the C "long long" type that is not part of C++, yet, here:
http://www.jk-technology.com/c/inttypes.html#limits
You can easily work out the required minimum number of bits from the required ranges:
char types, at least 8 bits short int, at least 16 bits int, at least 16 bits long, at least 32 bits long long (C since 1999, not official in C++) 64 bits
Thanks Jack. A useful reference.
Gavin Deane
Ron Natalie wrote: But this is a problem with C++ too? If I declare an "int" under windows, maybe different from an "int" under linux or OSX ?
Yes. This is why there are typedefs in the various API's that use C and C++ to nail this down on a particular implementation. Even in the standard language we have things like size_t.
Thanks.
But I've some difficult yo understand the problem.
Maybe a loop go "out of size"?
The problem is not limited to openGL, but it is about all multiplatform
application?
If yes...how solve the problem without using GLtypes?
Can you show an example where using various "int types" can crash or
ruin the application?
Thanks! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: yensao |
last post by:
Hi,
I have a hard time to understand difference and similarities between
Relational database model and the Object-Oriented model. Can somebody
help me with this?
Thank you in advance.
Yensao
|
by: b83503104 |
last post by:
Hi,
Can someone tell me the difference between single quote and double
quote?
Thanks
|
by: Frank |
last post by:
For my website i would like to display the age of my son in years,
months, days and hours.
For now i manage to get a result for totals. Like the total number of
days.
This is the beginning:
starttime = Date.parse("Aug 10,2003, 07:07")
sdt = new Date(starttime)
|
by: Rich |
last post by:
I was considering C# for developing a scientific application, but I have
noticed a ~30% difference between VC++ .NET and C# on the same machine,
under identical conditions:
double a = 0,b = 0, c = 0, d = 0, e = 0;
for(int n = 0; n != 6000000; n++)
{
a = n % 5 *2 / 3 - 4 + 6 / 3 - n + n * 2;
b = n * 2.3 - 1 *2 / 3 - 4 + 6 / 3 - n + n * 2;
c = n * 3 / 3.5 *2 / 3 - 4 + 6 / 3 - n + n * 2;
|
by: jamesyreid |
last post by:
Hi,
I'm really sorry to post this as I know it must have been asked
countless times before, but I can't find an answer anywhere.
Does anyone have a snippet of JavaScript code I could borrow which
calculated the difference in years and days between two dates, and
takes leap years into account?
I'm calculating the difference in the usual way, i.e....
| |
by: bbawa1 |
last post by:
Hi,
I have a table which has a field ItemsReceived of type datetime. I
have a grid view which has two columns.
In first column i have to show the data from field ItemsReceived and
in second column I have to show
difference between Currenttime and date from ItemReceived. How can I
do that.
|
by: Petronius |
last post by:
Hallo, does anyone have an idea how to implement difference lists in
Javascript?
Thanks allot in advance
|
by: Julius |
last post by:
Hej dudes,
I need to calc the difference between two timestamps / dates ...
For example what i need to calculate:
Date 1: 2007.11.06 - 20:13:04
Date 2: 2007.11.07 - 21:13:04
Difference: 1 day, 1hour
|
by: viki1967 |
last post by:
Hi all!
This new forum its great! :)
Congratulations !!!
My answer: why this my code not working?
Nothing error but not work the difference.... :
<html>
|
by: cmb3587 |
last post by:
I have two arrays and I'm trying to create a 3rd array that is the difference between the two arrays
Ex:
arrayA: 3 5 8 9
arrayB: 3 4 6 9
difference of A-B: 5 8
however, my code is just returning me an array of 0's
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |